Android :: OpenGL Lifecycle Ends With A Crash
Feb 7, 2010
I am having difficulties with the lifecycle of the opengl context. While rendering my scene and the user hits the back button, home button or another application opens in front of my application, my app is still running in the background.
So when my application comes to the foreground later on (user relaunches it or the app that was opened on top of it finishes), my application crashes and leaves me nothing but a GL stack trace which i can't properly decipher.
For rendering i use the GLSurfaceView and therefore delegate the onPause and onResume. The crash happens on the first call to glDrawElements(..).
I have tried to reload my resource (geometry/textures etc.) on onSurfaceChanged but with or without reloading... The problem persists.
This behavior can be observed on all AVD versions of the emulator as well as on the G1.
Here is the gl stacktrace i get.
CODE:.............
View 3 Replies
Nov 8, 2009
I'm writing my opengl native game. Menu is using android api, game field using native lib ( c++ and opengl ). All in one activity ( different views ). If I press Back or Home button ( without overriting onKeyDown() ) all is fine: game just quit to desktop and when I again running, it saving its state. But I was needed to overrite Back and Menu button:
CODE:...............
Than I quit throught Home button and again run it. Sometimes all is fine, but sometimes I see only my menu, and black screen where the opengl must be. What's the problem? Also I was trying to overrite Home button, but seems it's impossible..
View 2 Replies
View Related
Oct 8, 2010
Once again I'm trying to get into openGL, but as usual I choke when passing around vertices/vertixes/whatever and every little detail can lead to disaster (wrong format, initialization not properly set up, where memory are saved, etc.).
My main goal is to use openGL for 2D graphics to speed up performance compared to regular cpu drawing.
Anyways, my openGL Renderer looks like this code...
With an IndexOutOfBoundsException, but I'm sure there are more problems with the code.
View 1 Replies
View Related
Jul 5, 2010
I've made some edits to my application but I'm pretty sure it crashing is linked to my updating my Nexus One. I've included the error as well as all code I think is relevant.
CODE:..................
View 3 Replies
View Related
Feb 25, 2009
Single Threaded OpenGL game ! (check bottom, you can download and use the helper class) Lighting disabled ! Depth Buffer disabled ! Culling enabled ! Textures disabled !
Just 176 integers (x,y values only) making 88 vertexes along with 132 index numbers making "44 triangles only"
Framerates I get is
with GL_BLENDING disabled - 145 fps approx only! enabled - 110 fps approx only!
I have the screenshot of exact code in the draw function here.. just 2 damn lines ! I have hidden only the comments.. click here to see it http://prasna991.googlepages.com/drawframe.png
variable details in the 2 lines of code =========================== ipts = 176 elements (only x and y for each vertex) totallinetriangles * 3 = 176 lineindexes = 132 elements - type "short"
Here is the screenshot of output drawing and how it will look like http://prasna991.googlepages.com/screen.png
OpenGL single threaded Initialization Helper ================================ Here is my OpenGL helper class.. makes the OpenGL initialization for newbies a cakewalk http://prasna991.googlepages.com/OpenGLHelperclass.txt
I tested by rendering on the touch event only.. frame rate drops only when u touch and drag and here I have just tested by tapping and releasing gently on the emulator and on the device
Is this the device limitations ? So graphics is actually a lot lot lot slower than on iPhone ?
View 8 Replies
View Related
Jul 24, 2010
I would like to be able to use the OpenGL API from both Java and C (via NDK).
In Java, there is a GL object passed, which has all GL methods on it.
In C, you just talk to the native library.
In a single onDrawFrame callback (for which Java is passed a GL), can I use methods on the GL object, and also call NDK methods which access the openGL library?
In other words, is the GL object just a wrapper for the same instance of the native library?
View 3 Replies
View Related
Apr 5, 2010
In my application I have several activities, the main screen has 4 buttons that each start a different activity. So one of them is a search activity, once it searches it shows you a result activity. This result activity can be reached from other activities, so in general something like this:
Main activity -> Search activity -> Result activity
Main acitivty -> someother activity -> Result activity
Now, if I have reached this result activity and press back once or twice, and after that press the Home key it will show the Home screen. But if I want to get back to my application by holding the Home button and clicking on my app it will always go back to the Result activity, no matter which activity was the last one I was using. And if I press again back it will take me back to the Home screen.
If I try it again it will take me again to the Result activity. The only way to avoid this is to start the application by clicking on the app's icon. And this takes me to the last activity I was using and it remembers the state so if I press back again it doesn't take me to the Home screen, instead to the activity before it. To illustrate this:
Main activity -> Search activity -> result activity --back--> Search activity --Home Button--> Home Screen --Hold Home and select the app --> Result activity --back--> Home Screen
--Click application icon--> Search activity --back--> Main activity
Another thing that happens is that if I press the Home button while on the Result activity, and start the app by clicking the icon, it will take me to the activity prior the the Result one.
View 2 Replies
View Related
Sep 10, 2010
There's a decent amount of information out there on the Activity lifecycle. But I'm surprised how difficult it is to find a comprehensive description of the rendering lifecycle. By that I mean the order and rules by which a tree of nested activities, views, and drawables get to be sized and drawn to the screen, and the points at which a developer can modify rendering behavior.
View 1 Replies
View Related
May 12, 2010
I use the gallery view extensively as a full screen pagination mechanism. It works really well for me without having to create a brand new control.
I would like to add a little elasticity at the ends (much like the iPhone homescreen). How could I go about doing this? Any hint as to which method I would need to override/modify?
View 8 Replies
View Related
Oct 5, 2010
In the Android Application Fundamentals it says that after the call to the onStart()-method of the activity lifecycle either the callback method Resume() or onStop() is called. In case of an "normal" Start of an activity the system calls onCreate(), onStart(), onResume().But does somebody know an example where onStart() - onStop() are executed one after another?
View 2 Replies
View Related
Feb 6, 2010
I want to do an animation with several image-files, and for this the AnimationDrawable works very well. However, I need to know when the animation starts and when it ends (i.e add a listener like the Animation.AnimationListener). After having searched for answers, I'm having a bad feeling the AnimationDrawable does not support listeners..Does anyone know how to do frame-by-frame image animation on Android?
View 4 Replies
View Related
Jul 3, 2009
I created an application which is displaying camera preview. When the application terminates I noticed that some processes are still running. Also if I try to run the original camera application it displays an error (obviously due to the active process which belongs to the custom application).
Does anyone know how to release all resources when application ends?
View 5 Replies
View Related
Mar 19, 2010
I have an already built application and I want to add a feature that has to be started when a call ends.
How can I achieve that?
I thought that declaring in my manifest something like this
CODE:............
Could be enough, but what kind of intent I have to put on the filter?
Looking in the documentation I found only the intents that detects when a call is started.
View 2 Replies
View Related
Jun 24, 2010
It happens that the user click on enter where i dont want to include it as a part of my input the string can end with 3 times so just replacing one wont do the job
My solution was:
CODE:........
Or just to point there without the new but i want later to dump the garbage. Or at least to dump values to the gc now ....
View 5 Replies
View Related
Sep 29, 2010
Im tring to simulate a slideup animation.The idea is to slideup and slidedown the tablelayout with the id searchForm when pressing the button so that i can use the extra space for a list. I managed to slideup the searchForm and the button and the list seems to be visible but after this i cant click the button, here's the code responsible for the slideup animatio:
CODE:.......................
Here's the xml that has the view elements:
CODE:.................
View 1 Replies
View Related
Jul 14, 2009
I just ran into a situation where it looks like a static variable reference is persisted across activity sessions. I didn't expect that because I thought that when an activity exits, it's de-referenced and garbage collected. I am wondering if anyone can shed some (more) light on when the VM eliminates object references for Activities and Services and in particular when static variables get reset to default values?
View 7 Replies
View Related
Jul 8, 2010
I am trying to create a Servicefor my application which will negotiate Bluetooth connections and data. I want this service's lifecycle to start and end with the Application, but still be able to have specific Activities listen for events that occur within this service (in addition an Activty should be able to call specific methods of the Service to write data or query connection state).
I started by creating AIDL interfaces for my callbacks and service, but I can't figure out exactly what I'm doing.
How is the best way to go about this? EDIT: To be clear, I do not specifically need (or want) more than one process for my application. Right now I don't have more than one; I'm just using AIDL because it is the only way I know of for a Service to communicate with an Activity.
View 1 Replies
View Related
Apr 20, 2010
I have creating application with 3 activities, where A - list of categories, B - list of items, C - single item. Data displayed in B and C is parsed from online XML. But, if I go trough A -> B1 -> C, then back to A and then back to B1 I would like to have it's data cached somewhere so I wouldn't have to request XML again.I'm new to Android and Java programming, I've googled a lot and still can't find (or simply do not have an idea where to look) a way to do what I want.Would storing all received data in main activity A (HashMaps? ContentProviders?) and then passing to B and C (if they get same request that was before) be a good idea?
View 3 Replies
View Related
Apr 19, 2010
I slapped together a simple test application that has a button, and makes a noise when the user clicks on it.
Here are it's method:
CODE:..................
My question is, why is onCreate acting like it's in a while loop? I can click on the button whenever, and it makes the sound. I might think it was just a property of listeners, but the Button object wasn't a member variable. I thought that Android would just go through onCreate onse, and proceed onto the next lifecycle method. Also, I know that my current way of seeing if the sound is playing is crap...I'll get to that later.
View 1 Replies
View Related
Aug 7, 2009
http://developer.android.com/reference/android/app/Activity.html
The Activity Lifecycle could have implementation and or design bug: One case is to initialize a big image in onCreate(), try to reuse the image during the whole lifecycle, and then recycle the image in onDestroy(). Test showed that onCreate() is called every time one navigate away from the activity and back again, but onDestroy() is not called at all. This behavour causes memory leaking for the big image (size 960*1920). After 6+ times away and back to activity, the system runs out of memory and has to kill the process.
One workaround is to initialize the big image in onResume() and recycle in onPause(), but that's not so good reuse.
Could it be better to change the process (as shown in the diagram) a little bit such as: Call onDestroy() first when a process is killed?
View 3 Replies
View Related
Aug 3, 2010
I have an application that consist of several Activities. When the application starts, some alarms are scheduled using AlarmManager and some services are started:
AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
a.setInexactRepeating(...)....
I would like to know any way to guarantee every service is stopped and every alarm is unscheduled when the user exits the application. The problem is that the user can leave the application from different Activities, and I don't like the idea of overriding the onDestroy method in every Activity. Is there any known Intent I can receive when the application ends? I've also found that an Android application can have a class that extends from Application, with a onTerminate method:
public class MyApplication extends Application {
@Override public void onTerminate() {
... } }
But the documentation is very clear: "never depend on this method being called; in many cases an unneeded application process will simply be killed by the kernel without executing any application code".
View 1 Replies
View Related
Mar 4, 2010
I have a problem with the activity lifecycle specifically on Nexus One (2.1 running on emulator works fine). If I just create a simple empty Activity with no special launchModes that logs the calls on the onStart and onStop methods, this is what I see: - launch app: onStart called; - home button: onStop NOT called; - launch app: onStart NOT called; - home button: onStop NOT called: and so on. Sometimes if I press the back button then the onStop is not called, but the when i launch the activity again the onStart is called and right after the onStop is called. Similar results with different launchModes. What is going on? Can anyone confirm this?
i found an android issue for the problem here: http://code.google.com/p/android/issues/detail?id=6094 and a similar thread here http://groups.google.com/group/android-developers/browse_thread/threa.
View 24 Replies
View Related
Feb 28, 2009
I'm looking for a way to resume my activity (which makes phone call) after call ends by user. Currently after user ends a call, it always returns to the phone's native call-log screen instead of the activity that originated the call. Is there any way to prevent or customize this?
View 3 Replies
View Related
Jul 26, 2010
I am using a progress bar in android, so that till my data is loaded, user is getting a proper feedback of what is going on.
The code for the bar is below:
CODE:............
The setSelected() method is inserting data into an array list, and then creating an array adapter and then using a list view to show those items. so when I put the setSelected() method in progress bar, it shows the loading circle, but once loading is done. Nothing is displayed in listview. But if I take out progress bar code (thread and run method), and simply call setSelected() method, the listview successfully declares the data. so far it concludes that the progress bar code is doing some thing...so wanted to know am I missing something to add in or take out from the code. I need to the show progress bar as I am reading data from online source and it takes time , which may make user uncomfortable.
View 1 Replies
View Related
Aug 23, 2010
On placing images(back and forward images) at two end of my gallery view ,i have gallery to list menus to scroll horizontally,and this gallery is in RelativeLayout how can i get the images at two ends of gallery without scrolling.
View 2 Replies
View Related
Oct 27, 2010
If I change one imageview's source to another (and thus changing the image) but then have more changes occur within the method and such. How do I force it to refresh to show the changes before the method ends? (As waiting for the method to end to show the changed images is not good for my purposes at all)
View 1 Replies
View Related
Jul 12, 2010
I have a custom view on which I need to call a method from my activity after the view has been measured in onMeasure. I would like to know exactly when onMeasure is called in the View layout process. It looks like onMeasure is called after my activity´s onCreate, onStart, and onResume. I could override onMeasure and maintain a variable that contains whether the view has been measured or not. However it would be nice to know if there is a rule that relates onMeasure to the activity lifecycle?
View 4 Replies
View Related
Sep 15, 2010
I'm binding to a local Service (that is, not using IPC and AIDL) from several activities. I want to ensure that I'm not holding references to this service from activities that the user isn't using. My options are: 1.) to bind to the service in onCreate() and unbind in onDestroy(). 2.) bind in onStart() and unbind in onStop(). 3.) bind in onResume() and unbind in `onPause(). Or some combination of these. Which is the best-practice way of binding and unbinding to a local service? Do I not need to be concerned with holding local connections from stopped activities? Additionally, once bound to this particular service I am retrieving a Cursor which is attached to my ListActivity via a CursorAdapter. The data retrieved by the Cursor may have changed while the Activity was out of view so I want to requery it when the Activity is shown again. If I bind in onCreate() I can requery in onRestart(). If I bind in onResume() each time the data will be fresh because I'll query it in the Service's connected callback.
View 1 Replies
View Related
Oct 4, 2010
I'm having a couple of problems with an alarm app I am developing.
The first thing that I think is a bit weird is that when an alarm goes of and wakes the phone up. These things happend.
oncreate
onresume
onpause
onresume
Why are they run in that order? The last two should not be called? And this is what's causes me big trouble, because when i press home or back on the phone, onPause is run, which I want to call finish() from. And that part works as it should, but that does not work when the phone wakes upp from sleep bacause of the onPause call...
View 2 Replies
View Related
Feb 6, 2010
I've an App which performs a potentially large download in background thread. When the orientation changes or the keyboard is opened the App lifecycle system invokes the start/stop/pause/resume etc calls - is there any strategy available to resume the download rather than just set a flag so the new onCreate() knows it was interrupted and has to start it again?
View 2 Replies
View Related