Screen goes black then program crashes - android

I have a problem i have been hunting down for the last day and i cant seem to find what is wrong. I have been working on this app for about a month without too many problems. I started working on the main interface page and one button into it this problem rears its ugly head. The problem is the screen shows up and then disappears about 30 seconds later. After watching the error it has a particular method of things happening. First my bitmaps go, then the texts after about a second, then the screen is black for about 5 seconds, then i get my phone background then about 10 seconds later the my apps show up. I never get a force close message. Id rather understand what is causing the problem then having someone tell me to change something so i can prevent it from happening again. So i don't want to post my code just yet.
other tidbits:
all my graphics are using the canvas method
since i got a 30 second window i continued working on the framework of my project the problem still has the same timing after finishing a good portion of it
the graphics i used from the working portion of my code are the same in my nonworking
the screen has no functionality to it right now its just graphics
I get the feeling i cant avoid posting my code but please try to answer it without asking for it.

Thanks to Steve for letting me know about the logcat. After updating Eclipse it became much easier to read. The problem was, not enough garbage collecting. Ironically the code that seem to be giving me problems was not the problem it was just the straw that broke the camels hump.
I have chopped up my code enough to where it is workable but i still have a lot ahead of me to fix the issue 100%.

Related

App hangs for several seconds, how to diagnose what methods are causing it?

My app is hanging when returning from one activity back to a ListView activity. I know the ListView is slow and RecyclerView is a better replacement, however I don't think this would be causing complete UI freezing for multiple seconds (I see ListView lag however this hang is 100% unresponsiveness). The hanging is almost always persistent until you close and re-open the app, and ANR is almost always triggered.
I have messed around with TraceView and see a lot of Object.wait() calls taking up CPU time, but I don't know how to interpret that. Where can I go from here?
Edit (more info):
There is a lot going on from SQLite, image loading, rest calls and so on going on in the app and I've been running Strict Mode and fixing issues but nothing shows up in Strict Mode logs when this type of hang happens (which is very reproduceable)
Screenshot of systrace during hang

Very long startup time

I have a simple app, with nothing too fancy going on (essentially just a tab pager and a recycler view). However when I start up my app from the launcher I get an all white screen for ~3 seconds before my ui shows on screen. I have not had this issue with other apps before. Now I am wondering, how can I look into why it is taking so long?
Does Android Studio have anything to help see why my app takes so long to load?
The delay seems to be worse if starting from completely dead. If the program is in recent tasks the white screen only displays for about a quarter of a second or so.
Android Studio provides a couple of tools to help you track down performances. You'll be able to find out if you allocate too many objects on the main thread, or if your XML hierarchy is too complicated etc.

Android app, slow rotation

My android app takes about 3-5 seconds before it actually rotates. The whole activity is just too big to post here. Can anyone provide me some general suggestions that can make this better? Thanks all.

Android closes my game

I have a problem with my videogame in Android. It shuts down randomly without saying anything while I'm playing it for a while. Before, It didn't close but now somehow, is doing it.
After this, I optimized the code and got a great memory improvement but it keeps doing the same at the same frecuency, which makes me think that maybe is not a memory leak.
It is not an unhandled expcetion neither, because I have a try/catch capturing all the exceptions in my game loop.
So I was wondering what could trigger a force close in my Android videogame... what would you suggest?
Maybe is because the device becomes very hot.
Is it possible that in a long loop could decide to shut down because it is taking so long and without saying anything?
Those two are my main hipotesis right now. I don't have any clue what is going on.

AndEngine hangs

I'm developing a game using andengine. On my scene i have only 3 sprites moving in the same direction. So the problem is that it sometimes hangs after less than a second and sometimes not. Interface does not respond. Logcat shows no problems at all. It looks like it hangs somewhere inside andengine, but I can't figure it out. I just managed to track it down using step over in OnManagedUpdate method of Entity class on line
entities.get(i).onUpdate(pSecondsElapsed);
When i step over it just hangs and I can't step into it.
Did anybody face such problems? What it could be?
I found the bug - the sprites animation rate was generated randomly and sometimes it got negative value. I'm realy sorry for such a vague question, it's just the project is large enough to take a lot of time to isolate the problem code part.

Categories

Resources