Advice regarding optimizing app performance since this app consists of lots of views.

  • Replies:8
  • OpenNot stickiedUnanswered
  • Forum posts: 4

Nov 13, 2014 11:12:13 AM via Website

Hey guys, I'm an amateur at android development and this is my first app. I'm trying to make an app which you could basically think of like a book. It will consist of verses from a certain scripture one verse per screen, the screen will have the verse in it's original language "sanskrit", and these three things: 1.it's meaning in english, 2. and hindi, and 3. the word meaning of each of the sanskrit words in hindi and english. I want these three things inside a tabhost.

Now the scripture has like 500 verses divided into 18 chapters. Each verse is like 10 words long. So there will be like 500 different views (if that's the right word for it... what I mean is 500 "screens" if that makes any sense) What I've done till now is, I made a sliding drawer that would take you to one of the 18 chapters. Now choosing one of the chapters will take you to a fragment, in which there will be a viewflipper, and it will consist of the verses in that chapter and a title page for that chapter which will consist of links to each of the verses. (I've done everything upto here there's just one sample chapter and 2 sample verses and it works fine) Also in the actionbar there will be a dropdown menu kind of thing clicking on which will give a list of verse numbers, and you can navigate to any verse from there. (I haven't done that yet)

So the thing is, 500 verses, 500 "views" (if i'm using that correctly) I don't know if that will make the device slow or what. I wanted to know am I using the right tools for it? Like the sliding drawer, fragment, tabhost, viewflipper? And the way I've structured the app, what do you feel about that? Will doing it differently could make it faster? I haven't had any problem yet with 1 chapter and 2 verses, I'm going to try adding a bunch of sample chapter and verses and see how it affects the performance. Still I just wanted to know ahead of time if I'm making any huge mistake in using one of the tools that I'm using.

I'd really really really appreciate if someone would take his/her time and give some valuable advice. Thanks in advance.

EDIT: So initially I was planning to have minSdkVersion = "11" and targetSdkVersion = "21", but if that would be impossible due to the large number of verses, I might reconsider that. And I'm using Eclipse to code, and AVD (Android Virtual device) manager to test the app.

EDIT: Also, using maybe sqlite to get the verses (I've just heard a bit about it never used it), would that help?

— modified on Nov 13, 2014 6:17:26 PM

  • Forum posts: 118

Nov 13, 2014 11:40:54 AM via Website

Could you run the app with the 500 verses at the same time? I'd like to see what happens to help you further by looking into your logcat. To see if the app would allocate much space by loading all the verses at the same time and if the app would lag badly. Also please include in your reply which device you're using plus the technical specifications of it (includes Android version).

  • Forum posts: 4

Nov 13, 2014 12:09:14 PM via Website

So initially I was planning to have minSdkVersion = "11" and targetSdkVersion = "21", but if that would be impossible due to the large number of verses, I might reconsider that. And I'm using Eclipse to code, and AVD (Android Virtual device) manager to test the app. Thanks for your time!

  • Forum posts: 118

Nov 13, 2014 12:21:55 PM via Website

Kumar Animesh

So initially I was planning to have minSdkVersion = "11" and targetSdkVersion = "21", but if that would be impossible due to the large number of verses, I might reconsider that. And I'm using Eclipse to code, and AVD (Android Virtual device) manager to test the app. Thanks for your time!

Could create an AVD with API 11 and API 19? To speed AVDs up, check the use of GPU and as CPU an intel (in the dialog when creating an AVD). If you run the app on both AVDs, could you send me each of the logcats into different pastebins? (http://pastebin.com/ it's a tool, easy to paste large outcomes of logcats). That'd be really helpful.

  • Forum posts: 4

Nov 13, 2014 3:09:26 PM via Website

Kevin Berendsen

Kumar Animesh

So initially I was planning to have minSdkVersion = "11" and targetSdkVersion = "21", but if that would be impossible due to the large number of verses, I might reconsider that. And I'm using Eclipse to code, and AVD (Android Virtual device) manager to test the app. Thanks for your time!

Could create an AVD with API 11 and API 19? To speed AVDs up, check the use of GPU and as CPU an intel (in the dialog when creating an AVD). If you run the app on both AVDs, could you send me each of the logcats into different pastebins? (it's a tool, easy to paste large outcomes of logcats). That'd be really helpful.

So with only 1 chapter and 2 verses, it runs fine on the emulator, and here's the logcat output:

11-13 14:02:12.734: I/Choreographer(1649): Skipped 93 frames! The application may be doing too much work on its main thread.
11-13 14:02:53.463: W/EGL_emulation(1649): eglSurfaceAttrib not implemented
11-13 14:02:55.944: W/EGL_emulation(1649): eglSurfaceAttrib not implemented
11-13 14:02:56.493: D/dalvikvm(1649): GC_CONCURRENT freed 494K, 6% free 10830K/11444K, paused 11ms+43ms, total 244ms
11-13 14:02:56.613: I/Choreographer(1649): Skipped 65 frames! The application may be doing too much work on its main thread.

I'll add more verses and see how it goes.

65, 93 frames don't sound good. Do you think using sqlite could make any difference?

— modified on Nov 13, 2014 3:12:00 PM

  • Forum posts: 4

Nov 13, 2014 5:49:08 PM via Website

Kevin Berendsen

Below 100 frames is okay. Sqlite would make a large difference yeah. Sqlite would be faster.

Thanks man, really appreciate the help.

  • Forum posts: 118

Nov 13, 2014 6:57:44 PM via App

Tomorrow I will be spending major time to make a database handler using sqlite for android that includes the help of asynctask. I hope I will be able to upload it by the end of the afternoon (GMT+2). If havent uploaded yet by the end of the night, please send me a private message :)

  • Forum posts: 118

Nov 14, 2014 6:05:45 PM via Website

Take a look at the following two links:

http://satyan.github.io/sugar/
http://greendao-orm.com/

Both great libraries and easy to work with. You need zero SQL knowledge/experience for this, especially with the first link (Sugar ORM). Take a look at their documentation and usage to implement a fast way of storing, updating, removing and selecting values into/from a database. I checked both out myself and they work perfectly fine with the newest versions of Android.