I add the buttons dynamically to an activity, but They are lost When I click back button or when I move to the parent Activity. How to retain them??
Asked
Active
Viewed 43 times
-1
-
can you leverage cookies? http://developer.android.com/reference/org/apache/http/cookie/SetCookie.html just an idea. – Frank Tudor Apr 03 '14 at 02:57
-
Take a look at SharedPreferences for saving states. – Dan Harms Apr 03 '14 at 03:08
-
there is no interaction with server. only on device activity I updated but when I move away from activity, the buttons are lost. – Kiran Kumar Kyasa Apr 03 '14 at 03:09
1 Answers
0
When you press back button the activity is destroyed. SO when you open it again it will be freshly created with default state. If you want to persists the buttons you can save the state to either SharedPreferences or global variables in application class.

Mayur
- 46
- 1
- 7