[android-developers] Re: How to add a ViewFlipper to the layout?
How can I make use of adb logcat, DDMS, or the DDMS perspective in Eclipse if I can't reproduce the error in the emulator? It doesn't crash there. Have I implemented the right aproach with the threads? I call on yield() on the 2d thread for every onResume() and onPause() call to the 2d activity. I call on yield() on the 3d thread for every onResume() and onPause() call to the 3d activity. I have set the priorities to MIN_PRIORITY. Is it better to implement the threading in some other way? I also call on finish() on the current activity after every call to startActivity. The app seems to run slower after starting the 3d activity several times. This did not happen when I used the view flipper. Is it possible that several instances of the 3d activity are on the activity stack? This is how I start the activities: Intent glIntent=new Intent(astral.worlds2.GLActivity); glIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); getContext().startActivity(glIntent); On Sep 22, 9:11 pm, Mark Murphy mmur...@commonsware.com wrote: Use adb logcat, DDMS, or the DDMS perspective in Eclipse to examine LogCat and figure out what the crashes are. On Thu, Sep 22, 2011 at 2:43 PM, MobileVisuals eyv...@astralvisuals.com wrote: Does anyone have an idea what I can do to improve the stability of this 3d app, which has 2 activities? I want to avoid the crashes. On Sep 22, 1:14 pm, MobileVisuals eyv...@astralvisuals.com wrote: I thought that it worked like it should,but I noticed that this is not the case. This version crashes sometimes, often when onResume() is called on any of the activities. It crashes on my Samsung Galaxy device. I have tried to reproduce this on the emulator, but it doesn't crashes there. The previous version based on ViewFlipper never crashed, even on the Samsung device. Maybe the crashes are caused by the threads? I have set the priorities to MIN_PRIORITY. I call on yield() on the 2d thread for every onResume() and onPause() call to the 2d activity. I call on yield() on the 3d thread for every onResume() and onPause() call to the 3d activity. Should I implement another approach for the threading? Or do think that something else causes the crashes? On Sep 21, 8:10 pm, MobileVisuals eyv...@astralvisuals.com wrote: Thanks for the info. I have redesigned the app now and it worked. On Sep 20, 6:37 pm, Mark Murphy mmur...@commonsware.com wrote: Use startActivity(), with FLAG_ACTIVITY_REORDER_TO_FRONT, to bring an existing activity back into the foreground (or create it if it does not exist). On Tue, Sep 20, 2011 at 12:32 PM, MobileVisuals eyv...@astralvisuals.com wrote: I see, then I would have to use one SurfaceView for the first activity and a GLSurfaceView for the other activity. I searched for information about how to switch between 2 activities on the forum and found one of your threads: http://groups.google.com/group/android-developers/browse_thread/threa... You recommend using a viewflipper here, so I can not use that approach. I found another thread http://groups.google.com/group/android-developers/browse_thread/threa... where they used the StartActivityForResult method. How would you recommend that I should swith between the activites without using a ViewFlipper? On Sep 20, 4:43 pm, Mark Murphy mmur...@commonsware.com wrote: Use two activities. On Tue, Sep 20, 2011 at 9:54 AM, MobileVisuals eyv...@astralvisuals.com wrote: I got the viewflipper to work, but I found that it is not possible to use a GLSurfaceView in a viewflipper, like this thread describes: http://groups.google.com/group/android-developers/browse_thread/threa... How can I then switch between 2d and 3d rendering? On Jul 27, 2:53 pm, Mark Murphy mmur...@commonsware.com wrote: On Wed, Jul 27, 2011 at 8:49 AM, MobileVisuals eyv...@astralvisuals.com wrote: I try to add 2 views to a Viewflipper, but I get java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. when I try to add the view. I don't know why this happens. I try to remove the view from the ViewFlipper, but I still get the same message. How can I add a ViewFlipper to the layout? You can view my code and XML layout below: --- setContentView(R.layout.lunar_layout); mLunarView = (LunarView) findViewById(R.id.lunar); ViewFlipper vf=(ViewFlipper) findViewById(R.id.flip); vf.addView(mLunarView, 0); The error should be self-explanatory. You already have R.id.lunar as a child of the LinearLayout. layout: -- ?xml
[android-developers] Re: How to add a ViewFlipper to the layout?
Or maybe the objects in the 3d activity are not garbage collected when I switch to the 2d activity? Maybe I should set the objects in the 3d activity to null, when it switches to the 2d activity? On Sep 22, 9:11 pm, Mark Murphy mmur...@commonsware.com wrote: Use adb logcat, DDMS, or the DDMS perspective in Eclipse to examine LogCat and figure out what the crashes are. On Thu, Sep 22, 2011 at 2:43 PM, MobileVisuals eyv...@astralvisuals.com wrote: Does anyone have an idea what I can do to improve the stability of this 3d app, which has 2 activities? I want to avoid the crashes. On Sep 22, 1:14 pm, MobileVisuals eyv...@astralvisuals.com wrote: I thought that it worked like it should,but I noticed that this is not the case. This version crashes sometimes, often when onResume() is called on any of the activities. It crashes on my Samsung Galaxy device. I have tried to reproduce this on the emulator, but it doesn't crashes there. The previous version based on ViewFlipper never crashed, even on the Samsung device. Maybe the crashes are caused by the threads? I have set the priorities to MIN_PRIORITY. I call on yield() on the 2d thread for every onResume() and onPause() call to the 2d activity. I call on yield() on the 3d thread for every onResume() and onPause() call to the 3d activity. Should I implement another approach for the threading? Or do think that something else causes the crashes? On Sep 21, 8:10 pm, MobileVisuals eyv...@astralvisuals.com wrote: Thanks for the info. I have redesigned the app now and it worked. On Sep 20, 6:37 pm, Mark Murphy mmur...@commonsware.com wrote: Use startActivity(), with FLAG_ACTIVITY_REORDER_TO_FRONT, to bring an existing activity back into the foreground (or create it if it does not exist). On Tue, Sep 20, 2011 at 12:32 PM, MobileVisuals eyv...@astralvisuals.com wrote: I see, then I would have to use one SurfaceView for the first activity and a GLSurfaceView for the other activity. I searched for information about how to switch between 2 activities on the forum and found one of your threads: http://groups.google.com/group/android-developers/browse_thread/threa... You recommend using a viewflipper here, so I can not use that approach. I found another thread http://groups.google.com/group/android-developers/browse_thread/threa... where they used the StartActivityForResult method. How would you recommend that I should swith between the activites without using a ViewFlipper? On Sep 20, 4:43 pm, Mark Murphy mmur...@commonsware.com wrote: Use two activities. On Tue, Sep 20, 2011 at 9:54 AM, MobileVisuals eyv...@astralvisuals.com wrote: I got the viewflipper to work, but I found that it is not possible to use a GLSurfaceView in a viewflipper, like this thread describes: http://groups.google.com/group/android-developers/browse_thread/threa... How can I then switch between 2d and 3d rendering? On Jul 27, 2:53 pm, Mark Murphy mmur...@commonsware.com wrote: On Wed, Jul 27, 2011 at 8:49 AM, MobileVisuals eyv...@astralvisuals.com wrote: I try to add 2 views to a Viewflipper, but I get java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. when I try to add the view. I don't know why this happens. I try to remove the view from the ViewFlipper, but I still get the same message. How can I add a ViewFlipper to the layout? You can view my code and XML layout below: --- setContentView(R.layout.lunar_layout); mLunarView = (LunarView) findViewById(R.id.lunar); ViewFlipper vf=(ViewFlipper) findViewById(R.id.flip); vf.addView(mLunarView, 0); The error should be self-explanatory. You already have R.id.lunar as a child of the LinearLayout. layout: -- ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:layout_width=wrap_content android:layout_height=wrap_content ViewFlipper android:id=@+id/flip android:layout_width=fill_parent android:layout_height=fill_parent/ astral.effectsf.LunarView android:id=@+id/lunar android:layout_width=fill_parent android:layout_height=fill_parent/ /LinearLayout Make the LunarView be a child element of your ViewFlipper, and get rid of the Java code to try adding it to the ViewFlipper, and you will be set. Here are some projects demonstrating the use of a
Re: [android-developers] Re: How to add a ViewFlipper to the layout?
You said it crashes on your Samsung device, can't you get a stack trace there? -- Kostya Vasilyev 23.09.2011 13:01 пользователь MobileVisuals eyv...@astralvisuals.com написал: Or maybe the objects in the 3d activity are not garbage collected when I switch to the 2d activity? Maybe I should set the objects in the 3d activity to null, when it switches to the 2d activity? On Sep 22, 9:11 pm, Mark Murphy mmur...@commonsware.com wrote: Use adb logcat, DDMS, or the DDMS perspective in Eclipse to examine LogCat and figure out what the crashes are. On Thu, Sep 22, 2011 at 2:43 PM, MobileVisuals eyv...@astralvisuals.com wrote: Does anyone have an idea what I can do to improve the stability of this 3d app, which has 2 activities? I want to avoid the crashes. On Sep 22, 1:14 pm, MobileVisuals eyv...@astralvisuals.com wrote: I thought that it worked like it should,but I noticed that this is not the case. This version crashes sometimes, often when onResume() is called on any of the activities. It crashes on my Samsung Galaxy device. I have tried to reproduce this on the emulator, but it doesn't crashes there. The previous version based on ViewFlipper never crashed, even on the Samsung device. Maybe the crashes are caused by the threads? I have set the priorities to MIN_PRIORITY. I call on yield() on the 2d thread for every onResume() and onPause() call to the 2d activity. I call on yield() on the 3d thread for every onResume() and onPause() call to the 3d activity. Should I implement another approach for the threading? Or do think that something else causes the crashes? On Sep 21, 8:10 pm, MobileVisuals eyv...@astralvisuals.com wrote: Thanks for the info. I have redesigned the app now and it worked. On Sep 20, 6:37 pm, Mark Murphy mmur...@commonsware.com wrote: Use startActivity(), with FLAG_ACTIVITY_REORDER_TO_FRONT, to bring an existing activity back into the foreground (or create it if it does not exist). On Tue, Sep 20, 2011 at 12:32 PM, MobileVisuals eyv...@astralvisuals.com wrote: I see, then I would have to use one SurfaceView for the first activity and a GLSurfaceView for the other activity. I searched for information about how to switch between 2 activities on the forum and found one of your threads: http://groups.google.com/group/android-developers/browse_thread/threa... You recommend using a viewflipper here, so I can not use that approach. I found another thread http://groups.google.com/group/android-developers/browse_thread/threa... where they used the StartActivityForResult method. How would you recommend that I should swith between the activites without using a ViewFlipper? On Sep 20, 4:43 pm, Mark Murphy mmur...@commonsware.com wrote: Use two activities. On Tue, Sep 20, 2011 at 9:54 AM, MobileVisuals eyv...@astralvisuals.com wrote: I got the viewflipper to work, but I found that it is not possible to use a GLSurfaceView in a viewflipper, like this thread describes: http://groups.google.com/group/android-developers/browse_thread/threa... How can I then switch between 2d and 3d rendering? On Jul 27, 2:53 pm, Mark Murphy mmur...@commonsware.com wrote: On Wed, Jul 27, 2011 at 8:49 AM, MobileVisuals eyv...@astralvisuals.com wrote: I try to add 2 views to a Viewflipper, but I get java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. when I try to add the view. I don't know why this happens. I try to remove the view from the ViewFlipper, but I still get the same message. How can I add a ViewFlipper to the layout? You can view my code and XML layout below: --- setContentView(R.layout.lunar_layout); mLunarView = (LunarView) findViewById(R.id.lunar); ViewFlipper vf=(ViewFlipper) findViewById(R.id.flip); vf.addView(mLunarView, 0); The error should be self-explanatory. You already have R.id.lunar as a child of the LinearLayout. layout: -- ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android= http://schemas.android.com/apk/res/ android android:layout_width=wrap_content android:layout_height=wrap_content ViewFlipper android:id=@+id/flip android:layout_width=fill_parent android:layout_height=fill_parent/ astral.effectsf.LunarView android:id=@+id/lunar android:layout_width=fill_parent android:layout_height=fill_parent/ /LinearLayout Make the LunarView be a child element of your ViewFlipper, and get rid of the Java code to try adding it to the ViewFlipper,
Re: [android-developers] Re: How to add a ViewFlipper to the layout?
On Fri, Sep 23, 2011 at 4:11 AM, MobileVisuals eyv...@astralvisuals.com wrote: How can I make use of adb logcat, DDMS, or the DDMS perspective in Eclipse if I can't reproduce the error in the emulator? It doesn't crash there. adb logcat, DDMS, and the DDMS perspective of Eclipse are perfectly capable of examining LogCat on your phone. I also call on finish() on the current activity after every call to startActivity. The app seems to run slower after starting the 3d activity several times. Well, sure. Don't do that. The whole point behind FLAG_ACTIVITY_REORDER_TO_FRONT was to reuse the existing activity instances. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training...At Your Office: http://commonsware.com/training -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to add a ViewFlipper to the layout?
Thanks, it got stable when I removed the finish() calls and added this code to the 2d view class: @Override public void onWindowFocusChanged(boolean hasWindowFocus) { if (!hasWindowFocus) { thread.setRunning(false); thread.yield(); } else { thread.setRunning(true); thread.yield(); } } On Sep 23, 12:42 pm, Mark Murphy mmur...@commonsware.com wrote: On Fri, Sep 23, 2011 at 4:11 AM, MobileVisuals eyv...@astralvisuals.com wrote: How can I make use of adb logcat, DDMS, or the DDMS perspective in Eclipse if I can't reproduce the error in the emulator? It doesn't crash there. adb logcat, DDMS, and the DDMS perspective of Eclipse are perfectly capable of examining LogCat on your phone. I also call on finish() on the current activity after every call to startActivity. The app seems to run slower after starting the 3d activity several times. Well, sure. Don't do that. The whole point behind FLAG_ACTIVITY_REORDER_TO_FRONT was to reuse the existing activity instances. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android Training...At Your Office:http://commonsware.com/training -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to add a ViewFlipper to the layout?
I thought that it worked like it should,but I noticed that this is not the case. This version crashes sometimes, often when onResume() is called on any of the activities. It crashes on my Samsung Galaxy device. I have tried to reproduce this on the emulator, but it doesn't crashes there. The previous version based on ViewFlipper never crashed, even on the Samsung device. Maybe the crashes are caused by the threads? I have set the priorities to MIN_PRIORITY. I call on yield() on the 2d thread for every onResume() and onPause() call to the 2d activity. I call on yield() on the 3d thread for every onResume() and onPause() call to the 3d activity. Should I implement another approach for the threading? Or do think that something else causes the crashes? On Sep 21, 8:10 pm, MobileVisuals eyv...@astralvisuals.com wrote: Thanks for the info. I have redesigned the app now and it worked. On Sep 20, 6:37 pm, Mark Murphy mmur...@commonsware.com wrote: Use startActivity(), with FLAG_ACTIVITY_REORDER_TO_FRONT, to bring an existing activity back into the foreground (or create it if it does not exist). On Tue, Sep 20, 2011 at 12:32 PM, MobileVisuals eyv...@astralvisuals.com wrote: I see, then I would have to use one SurfaceView for the first activity and a GLSurfaceView for the other activity. I searched for information about how to switch between 2 activities on the forum and found one of your threads: http://groups.google.com/group/android-developers/browse_thread/threa... You recommend using a viewflipper here, so I can not use that approach. I found another thread http://groups.google.com/group/android-developers/browse_thread/threa... where they used the StartActivityForResult method. How would you recommend that I should swith between the activites without using a ViewFlipper? On Sep 20, 4:43 pm, Mark Murphy mmur...@commonsware.com wrote: Use two activities. On Tue, Sep 20, 2011 at 9:54 AM, MobileVisuals eyv...@astralvisuals.com wrote: I got the viewflipper to work, but I found that it is not possible to use a GLSurfaceView in a viewflipper, like this thread describes: http://groups.google.com/group/android-developers/browse_thread/threa... How can I then switch between 2d and 3d rendering? On Jul 27, 2:53 pm, Mark Murphy mmur...@commonsware.com wrote: On Wed, Jul 27, 2011 at 8:49 AM, MobileVisuals eyv...@astralvisuals.com wrote: I try to add 2 views to a Viewflipper, but I get java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. when I try to add the view. I don't know why this happens. I try to remove the view from the ViewFlipper, but I still get the same message. How can I add a ViewFlipper to the layout? You can view my code and XML layout below: --- setContentView(R.layout.lunar_layout); mLunarView = (LunarView) findViewById(R.id.lunar); ViewFlipper vf=(ViewFlipper) findViewById(R.id.flip); vf.addView(mLunarView, 0); The error should be self-explanatory. You already have R.id.lunar as a child of the LinearLayout. layout: -- ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:layout_width=wrap_content android:layout_height=wrap_content ViewFlipper android:id=@+id/flip android:layout_width=fill_parent android:layout_height=fill_parent/ astral.effectsf.LunarView android:id=@+id/lunar android:layout_width=fill_parent android:layout_height=fill_parent/ /LinearLayout Make the LunarView be a child element of your ViewFlipper, and get rid of the Java code to try adding it to the ViewFlipper, and you will be set. Here are some projects demonstrating the use of a ViewFlipper: https://github.com/commonsguy/cw-android/tree/master/Fancy/Flipper1ht... -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android Training in NYC:http://marakana.com/training/android/ -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android Training...At Your
[android-developers] Re: How to add a ViewFlipper to the layout?
Does anyone have an idea what I can do to improve the stability of this 3d app, which has 2 activities? I want to avoid the crashes. On Sep 22, 1:14 pm, MobileVisuals eyv...@astralvisuals.com wrote: I thought that it worked like it should,but I noticed that this is not the case. This version crashes sometimes, often when onResume() is called on any of the activities. It crashes on my Samsung Galaxy device. I have tried to reproduce this on the emulator, but it doesn't crashes there. The previous version based on ViewFlipper never crashed, even on the Samsung device. Maybe the crashes are caused by the threads? I have set the priorities to MIN_PRIORITY. I call on yield() on the 2d thread for every onResume() and onPause() call to the 2d activity. I call on yield() on the 3d thread for every onResume() and onPause() call to the 3d activity. Should I implement another approach for the threading? Or do think that something else causes the crashes? On Sep 21, 8:10 pm, MobileVisuals eyv...@astralvisuals.com wrote: Thanks for the info. I have redesigned the app now and it worked. On Sep 20, 6:37 pm, Mark Murphy mmur...@commonsware.com wrote: Use startActivity(), with FLAG_ACTIVITY_REORDER_TO_FRONT, to bring an existing activity back into the foreground (or create it if it does not exist). On Tue, Sep 20, 2011 at 12:32 PM, MobileVisuals eyv...@astralvisuals.com wrote: I see, then I would have to use one SurfaceView for the first activity and a GLSurfaceView for the other activity. I searched for information about how to switch between 2 activities on the forum and found one of your threads: http://groups.google.com/group/android-developers/browse_thread/threa... You recommend using a viewflipper here, so I can not use that approach. I found another thread http://groups.google.com/group/android-developers/browse_thread/threa... where they used the StartActivityForResult method. How would you recommend that I should swith between the activites without using a ViewFlipper? On Sep 20, 4:43 pm, Mark Murphy mmur...@commonsware.com wrote: Use two activities. On Tue, Sep 20, 2011 at 9:54 AM, MobileVisuals eyv...@astralvisuals.com wrote: I got the viewflipper to work, but I found that it is not possible to use a GLSurfaceView in a viewflipper, like this thread describes: http://groups.google.com/group/android-developers/browse_thread/threa... How can I then switch between 2d and 3d rendering? On Jul 27, 2:53 pm, Mark Murphy mmur...@commonsware.com wrote: On Wed, Jul 27, 2011 at 8:49 AM, MobileVisuals eyv...@astralvisuals.com wrote: I try to add 2 views to a Viewflipper, but I get java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. when I try to add the view. I don't know why this happens. I try to remove the view from the ViewFlipper, but I still get the same message. How can I add a ViewFlipper to the layout? You can view my code and XML layout below: --- setContentView(R.layout.lunar_layout); mLunarView = (LunarView) findViewById(R.id.lunar); ViewFlipper vf=(ViewFlipper) findViewById(R.id.flip); vf.addView(mLunarView, 0); The error should be self-explanatory. You already have R.id.lunar as a child of the LinearLayout. layout: -- ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:layout_width=wrap_content android:layout_height=wrap_content ViewFlipper android:id=@+id/flip android:layout_width=fill_parent android:layout_height=fill_parent/ astral.effectsf.LunarView android:id=@+id/lunar android:layout_width=fill_parent android:layout_height=fill_parent/ /LinearLayout Make the LunarView be a child element of your ViewFlipper, and get rid of the Java code to try adding it to the ViewFlipper, and you will be set. Here are some projects demonstrating the use of a ViewFlipper: https://github.com/commonsguy/cw-android/tree/master/Fancy/Flipper1ht... -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android Training in NYC:http://marakana.com/training/android/ -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to
Re: [android-developers] Re: How to add a ViewFlipper to the layout?
Use adb logcat, DDMS, or the DDMS perspective in Eclipse to examine LogCat and figure out what the crashes are. On Thu, Sep 22, 2011 at 2:43 PM, MobileVisuals eyv...@astralvisuals.com wrote: Does anyone have an idea what I can do to improve the stability of this 3d app, which has 2 activities? I want to avoid the crashes. On Sep 22, 1:14 pm, MobileVisuals eyv...@astralvisuals.com wrote: I thought that it worked like it should,but I noticed that this is not the case. This version crashes sometimes, often when onResume() is called on any of the activities. It crashes on my Samsung Galaxy device. I have tried to reproduce this on the emulator, but it doesn't crashes there. The previous version based on ViewFlipper never crashed, even on the Samsung device. Maybe the crashes are caused by the threads? I have set the priorities to MIN_PRIORITY. I call on yield() on the 2d thread for every onResume() and onPause() call to the 2d activity. I call on yield() on the 3d thread for every onResume() and onPause() call to the 3d activity. Should I implement another approach for the threading? Or do think that something else causes the crashes? On Sep 21, 8:10 pm, MobileVisuals eyv...@astralvisuals.com wrote: Thanks for the info. I have redesigned the app now and it worked. On Sep 20, 6:37 pm, Mark Murphy mmur...@commonsware.com wrote: Use startActivity(), with FLAG_ACTIVITY_REORDER_TO_FRONT, to bring an existing activity back into the foreground (or create it if it does not exist). On Tue, Sep 20, 2011 at 12:32 PM, MobileVisuals eyv...@astralvisuals.com wrote: I see, then I would have to use one SurfaceView for the first activity and a GLSurfaceView for the other activity. I searched for information about how to switch between 2 activities on the forum and found one of your threads: http://groups.google.com/group/android-developers/browse_thread/threa... You recommend using a viewflipper here, so I can not use that approach. I found another thread http://groups.google.com/group/android-developers/browse_thread/threa... where they used the StartActivityForResult method. How would you recommend that I should swith between the activites without using a ViewFlipper? On Sep 20, 4:43 pm, Mark Murphy mmur...@commonsware.com wrote: Use two activities. On Tue, Sep 20, 2011 at 9:54 AM, MobileVisuals eyv...@astralvisuals.com wrote: I got the viewflipper to work, but I found that it is not possible to use a GLSurfaceView in a viewflipper, like this thread describes: http://groups.google.com/group/android-developers/browse_thread/threa... How can I then switch between 2d and 3d rendering? On Jul 27, 2:53 pm, Mark Murphy mmur...@commonsware.com wrote: On Wed, Jul 27, 2011 at 8:49 AM, MobileVisuals eyv...@astralvisuals.com wrote: I try to add 2 views to a Viewflipper, but I get java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. when I try to add the view. I don't know why this happens. I try to remove the view from the ViewFlipper, but I still get the same message. How can I add a ViewFlipper to the layout? You can view my code and XML layout below: --- setContentView(R.layout.lunar_layout); mLunarView = (LunarView) findViewById(R.id.lunar); ViewFlipper vf=(ViewFlipper) findViewById(R.id.flip); vf.addView(mLunarView, 0); The error should be self-explanatory. You already have R.id.lunar as a child of the LinearLayout. layout: -- ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:layout_width=wrap_content android:layout_height=wrap_content ViewFlipper android:id=@+id/flip android:layout_width=fill_parent android:layout_height=fill_parent/ astral.effectsf.LunarView android:id=@+id/lunar android:layout_width=fill_parent android:layout_height=fill_parent/ /LinearLayout Make the LunarView be a child element of your ViewFlipper, and get rid of the Java code to try adding it to the ViewFlipper, and you will be set. Here are some projects demonstrating the use of a ViewFlipper: https://github.com/commonsguy/cw-android/tree/master/Fancy/Flipper1ht... -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android Training in NYC:http://marakana.com/training/android/ -- You received this message because you are subscribed to the
[android-developers] Re: How to add a ViewFlipper to the layout?
Thanks for the info. I have redesigned the app now and it worked. On Sep 20, 6:37 pm, Mark Murphy mmur...@commonsware.com wrote: Use startActivity(), with FLAG_ACTIVITY_REORDER_TO_FRONT, to bring an existing activity back into the foreground (or create it if it does not exist). On Tue, Sep 20, 2011 at 12:32 PM, MobileVisuals eyv...@astralvisuals.com wrote: I see, then I would have to use one SurfaceView for the first activity and a GLSurfaceView for the other activity. I searched for information about how to switch between 2 activities on the forum and found one of your threads: http://groups.google.com/group/android-developers/browse_thread/threa... You recommend using a viewflipper here, so I can not use that approach. I found another thread http://groups.google.com/group/android-developers/browse_thread/threa... where they used the StartActivityForResult method. How would you recommend that I should swith between the activites without using a ViewFlipper? On Sep 20, 4:43 pm, Mark Murphy mmur...@commonsware.com wrote: Use two activities. On Tue, Sep 20, 2011 at 9:54 AM, MobileVisuals eyv...@astralvisuals.com wrote: I got the viewflipper to work, but I found that it is not possible to use a GLSurfaceView in a viewflipper, like this thread describes: http://groups.google.com/group/android-developers/browse_thread/threa... How can I then switch between 2d and 3d rendering? On Jul 27, 2:53 pm, Mark Murphy mmur...@commonsware.com wrote: On Wed, Jul 27, 2011 at 8:49 AM, MobileVisuals eyv...@astralvisuals.com wrote: I try to add 2 views to a Viewflipper, but I get java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. when I try to add the view. I don't know why this happens. I try to remove the view from the ViewFlipper, but I still get the same message. How can I add a ViewFlipper to the layout? You can view my code and XML layout below: --- setContentView(R.layout.lunar_layout); mLunarView = (LunarView) findViewById(R.id.lunar); ViewFlipper vf=(ViewFlipper) findViewById(R.id.flip); vf.addView(mLunarView, 0); The error should be self-explanatory. You already have R.id.lunar as a child of the LinearLayout. layout: -- ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:layout_width=wrap_content android:layout_height=wrap_content ViewFlipper android:id=@+id/flip android:layout_width=fill_parent android:layout_height=fill_parent/ astral.effectsf.LunarView android:id=@+id/lunar android:layout_width=fill_parent android:layout_height=fill_parent/ /LinearLayout Make the LunarView be a child element of your ViewFlipper, and get rid of the Java code to try adding it to the ViewFlipper, and you will be set. Here are some projects demonstrating the use of a ViewFlipper: https://github.com/commonsguy/cw-android/tree/master/Fancy/Flipper1ht... -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android Training in NYC:http://marakana.com/training/android/ -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android Training...At Your Office:http://commonsware.com/training -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android Training...At Your Office:http://commonsware.com/training -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this
[android-developers] Re: How to add a ViewFlipper to the layout?
I got the viewflipper to work, but I found that it is not possible to use a GLSurfaceView in a viewflipper, like this thread describes: http://groups.google.com/group/android-developers/browse_thread/thread/66e38a36c1378cfb/1b890dfece8fcb8a#1b890dfece8fcb8a How can I then switch between 2d and 3d rendering? On Jul 27, 2:53 pm, Mark Murphy mmur...@commonsware.com wrote: On Wed, Jul 27, 2011 at 8:49 AM, MobileVisuals eyv...@astralvisuals.com wrote: I try to add 2 views to a Viewflipper, but I get java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. when I try to add the view. I don't know why this happens. I try to remove the view from the ViewFlipper, but I still get the same message. How can I add a ViewFlipper to the layout? You can view my code and XML layout below: --- setContentView(R.layout.lunar_layout); mLunarView = (LunarView) findViewById(R.id.lunar); ViewFlipper vf=(ViewFlipper) findViewById(R.id.flip); vf.addView(mLunarView, 0); The error should be self-explanatory. You already have R.id.lunar as a child of the LinearLayout. layout: -- ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:layout_width=wrap_content android:layout_height=wrap_content ViewFlipper android:id=@+id/flip android:layout_width=fill_parent android:layout_height=fill_parent/ astral.effectsf.LunarView android:id=@+id/lunar android:layout_width=fill_parent android:layout_height=fill_parent/ /LinearLayout Make the LunarView be a child element of your ViewFlipper, and get rid of the Java code to try adding it to the ViewFlipper, and you will be set. Here are some projects demonstrating the use of a ViewFlipper: https://github.com/commonsguy/cw-android/tree/master/Fancy/Flipper1https://github.com/commonsguy/cw-android/tree/master/Fancy/Flipper2 -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android Training in NYC:http://marakana.com/training/android/ -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: How to add a ViewFlipper to the layout?
Use two activities. On Tue, Sep 20, 2011 at 9:54 AM, MobileVisuals eyv...@astralvisuals.com wrote: I got the viewflipper to work, but I found that it is not possible to use a GLSurfaceView in a viewflipper, like this thread describes: http://groups.google.com/group/android-developers/browse_thread/thread/66e38a36c1378cfb/1b890dfece8fcb8a#1b890dfece8fcb8a How can I then switch between 2d and 3d rendering? On Jul 27, 2:53 pm, Mark Murphy mmur...@commonsware.com wrote: On Wed, Jul 27, 2011 at 8:49 AM, MobileVisuals eyv...@astralvisuals.com wrote: I try to add 2 views to a Viewflipper, but I get java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. when I try to add the view. I don't know why this happens. I try to remove the view from the ViewFlipper, but I still get the same message. How can I add a ViewFlipper to the layout? You can view my code and XML layout below: --- setContentView(R.layout.lunar_layout); mLunarView = (LunarView) findViewById(R.id.lunar); ViewFlipper vf=(ViewFlipper) findViewById(R.id.flip); vf.addView(mLunarView, 0); The error should be self-explanatory. You already have R.id.lunar as a child of the LinearLayout. layout: -- ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:layout_width=wrap_content android:layout_height=wrap_content ViewFlipper android:id=@+id/flip android:layout_width=fill_parent android:layout_height=fill_parent/ astral.effectsf.LunarView android:id=@+id/lunar android:layout_width=fill_parent android:layout_height=fill_parent/ /LinearLayout Make the LunarView be a child element of your ViewFlipper, and get rid of the Java code to try adding it to the ViewFlipper, and you will be set. Here are some projects demonstrating the use of a ViewFlipper: https://github.com/commonsguy/cw-android/tree/master/Fancy/Flipper1https://github.com/commonsguy/cw-android/tree/master/Fancy/Flipper2 -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android Training in NYC:http://marakana.com/training/android/ -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training...At Your Office: http://commonsware.com/training -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: How to add a ViewFlipper to the layout?
I see, then I would have to use one SurfaceView for the first activity and a GLSurfaceView for the other activity. I searched for information about how to switch between 2 activities on the forum and found one of your threads: http://groups.google.com/group/android-developers/browse_thread/thread/c6ffe95d4909167b/fd1be2b4a1912c1a?lnk=gstq=switch+between+activities#fd1be2b4a1912c1a You recommend using a viewflipper here, so I can not use that approach. I found another thread http://groups.google.com/group/android-developers/browse_thread/thread/e17375dd36d0cdc6/eb66078f6325c77c?lnk=gstq=switch+between+activities#eb66078f6325c77c where they used the StartActivityForResult method. How would you recommend that I should swith between the activites without using a ViewFlipper? On Sep 20, 4:43 pm, Mark Murphy mmur...@commonsware.com wrote: Use two activities. On Tue, Sep 20, 2011 at 9:54 AM, MobileVisuals eyv...@astralvisuals.com wrote: I got the viewflipper to work, but I found that it is not possible to use a GLSurfaceView in a viewflipper, like this thread describes: http://groups.google.com/group/android-developers/browse_thread/threa... How can I then switch between 2d and 3d rendering? On Jul 27, 2:53 pm, Mark Murphy mmur...@commonsware.com wrote: On Wed, Jul 27, 2011 at 8:49 AM, MobileVisuals eyv...@astralvisuals.com wrote: I try to add 2 views to a Viewflipper, but I get java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. when I try to add the view. I don't know why this happens. I try to remove the view from the ViewFlipper, but I still get the same message. How can I add a ViewFlipper to the layout? You can view my code and XML layout below: --- setContentView(R.layout.lunar_layout); mLunarView = (LunarView) findViewById(R.id.lunar); ViewFlipper vf=(ViewFlipper) findViewById(R.id.flip); vf.addView(mLunarView, 0); The error should be self-explanatory. You already have R.id.lunar as a child of the LinearLayout. layout: -- ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:layout_width=wrap_content android:layout_height=wrap_content ViewFlipper android:id=@+id/flip android:layout_width=fill_parent android:layout_height=fill_parent/ astral.effectsf.LunarView android:id=@+id/lunar android:layout_width=fill_parent android:layout_height=fill_parent/ /LinearLayout Make the LunarView be a child element of your ViewFlipper, and get rid of the Java code to try adding it to the ViewFlipper, and you will be set. Here are some projects demonstrating the use of a ViewFlipper: https://github.com/commonsguy/cw-android/tree/master/Fancy/Flipper1ht... -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android Training in NYC:http://marakana.com/training/android/ -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android Training...At Your Office:http://commonsware.com/training -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: How to add a ViewFlipper to the layout?
Use startActivity(), with FLAG_ACTIVITY_REORDER_TO_FRONT, to bring an existing activity back into the foreground (or create it if it does not exist). On Tue, Sep 20, 2011 at 12:32 PM, MobileVisuals eyv...@astralvisuals.com wrote: I see, then I would have to use one SurfaceView for the first activity and a GLSurfaceView for the other activity. I searched for information about how to switch between 2 activities on the forum and found one of your threads: http://groups.google.com/group/android-developers/browse_thread/thread/c6ffe95d4909167b/fd1be2b4a1912c1a?lnk=gstq=switch+between+activities#fd1be2b4a1912c1a You recommend using a viewflipper here, so I can not use that approach. I found another thread http://groups.google.com/group/android-developers/browse_thread/thread/e17375dd36d0cdc6/eb66078f6325c77c?lnk=gstq=switch+between+activities#eb66078f6325c77c where they used the StartActivityForResult method. How would you recommend that I should swith between the activites without using a ViewFlipper? On Sep 20, 4:43 pm, Mark Murphy mmur...@commonsware.com wrote: Use two activities. On Tue, Sep 20, 2011 at 9:54 AM, MobileVisuals eyv...@astralvisuals.com wrote: I got the viewflipper to work, but I found that it is not possible to use a GLSurfaceView in a viewflipper, like this thread describes: http://groups.google.com/group/android-developers/browse_thread/threa... How can I then switch between 2d and 3d rendering? On Jul 27, 2:53 pm, Mark Murphy mmur...@commonsware.com wrote: On Wed, Jul 27, 2011 at 8:49 AM, MobileVisuals eyv...@astralvisuals.com wrote: I try to add 2 views to a Viewflipper, but I get java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. when I try to add the view. I don't know why this happens. I try to remove the view from the ViewFlipper, but I still get the same message. How can I add a ViewFlipper to the layout? You can view my code and XML layout below: --- setContentView(R.layout.lunar_layout); mLunarView = (LunarView) findViewById(R.id.lunar); ViewFlipper vf=(ViewFlipper) findViewById(R.id.flip); vf.addView(mLunarView, 0); The error should be self-explanatory. You already have R.id.lunar as a child of the LinearLayout. layout: -- ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:layout_width=wrap_content android:layout_height=wrap_content ViewFlipper android:id=@+id/flip android:layout_width=fill_parent android:layout_height=fill_parent/ astral.effectsf.LunarView android:id=@+id/lunar android:layout_width=fill_parent android:layout_height=fill_parent/ /LinearLayout Make the LunarView be a child element of your ViewFlipper, and get rid of the Java code to try adding it to the ViewFlipper, and you will be set. Here are some projects demonstrating the use of a ViewFlipper: https://github.com/commonsguy/cw-android/tree/master/Fancy/Flipper1ht... -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android Training in NYC:http://marakana.com/training/android/ -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android Training...At Your Office:http://commonsware.com/training -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training...At Your Office: http://commonsware.com/training -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at