user1245916
user1245916

Reputation: 41

Too many views in activity

I have an activity with more then 200 diffident views and layouts. Some of the views are images and some are texts or buttons. The visibility of the views changes from time to time, and so some of the textView contents, but nothing more.

The problem is with devices with big screens when the activity is out of focus and gets deleted from the stuck (see here under "Saving activity state" section). Unfortunately, to restore it with onRestoreInstanceState() , is a real mess.

I was wondering maybe I should not use Views but implement it in a different way in order to save memory? Maybe just bitmap images on a Canvas or something else?

Any suggestion tricks, tips will be appreciated.

Upvotes: 3

Views: 812

Answers (2)

kumar_android
kumar_android

Reputation: 2263

you can use any number of views as layout, you saying that it will change depends on time,

use setVisibility(View.Visible)
setVisibility(View.GONE)
setVisibility(View.INVISIBLE)   

Upvotes: 0

Taras
Taras

Reputation: 2576

I suggest you to use Fragments, if you have a lot of views and layouts in one activity.

Upvotes: 5

Related Questions