Best way to open a large layout in android

kassioplonka

New Member
I'm making a revision app for myself and anyone of my friends who wants it for my up-coming physics exam. Thought it might be a good idea to do, make the information stick moreIt's not a complicated app, it consists of a basic menu, and then 8 sub-activities that are launched from this menu.The problem in question lies in how big these layouts are; they're massive. They have loads of writing and about 10 hdpi images being loaded in a ScrollView fashion, and the problem i'm having is I cannot find a reliable way to open layouts without the app crashing..So far, i've tried:
  • Opening the layouts by\[code\]Intent i = new Intent("com.physicsrevision.ONEPOINTONE");startActivity(i);\[/code\]
  • Launching them in a UiThread\[code\]runOnUiThread(new Runnable() { @Override public void run() { // Intent code startActivity(i); }}\[/code\]
The problem with this method though it works sometimes it's not reliable.. 25% of the time the app crashes :/Also, from this, I occasionally get called from wrong thread exception. Don't suppose anyone knows how to fix this error for me?
  • Launching them in a regular thread
    • Didn't work due to the need to be run off a Ui Thread
Then from the activity itself, i've tried on it's own\[code\] setContentView(R.layout.onepointone);\[/code\]and running them from inside a thread... I don't want to re-build my entire application assigning ID's to each view, this will take the biscuit. I just need a way to open the application either by displaying a loading dialog (which I know how to do) and then the activity shows up, something that works every time.. regardless really of the time it takes.. It doesn't have to be efficient, my exams will be over in two months, it's temporary.. I'm not sure what else I need to do.. Do I need to add onDestroy methods to manage the layout after the app is closed or something? Any help on this, or any basic structure I can use will be greatly appreciated :)
 
Back
Top