Wednesday, 6 December 2017

java - Saving the state of the application

I have an application that does this :
When the
application starts,one row with 3 editTexts is created by
calling a method called newproduct().The first of them is
focused and this triggers the creation of another row of those 3 edittexts.So,when the
last row is focused,another row is created dynamically.
Every columns is
inside a different linear layout and gets added to a new
ArrayList();
,one for everyone of the 3 columns.The values
that get entered are then put inside a String[],again,3 of them
for every column.



My questions now are the
following :
1.How can i save this on screen orientation changes? When i change
the orientation,the values remain but only in two of the rows because those 2 rows are
created at onCreate( newproduct method called,creates the first
row, and then focused,so it creates another row).How can i tell my application to create
more then 2 rows and keep the values ?



2.How can
i make my application keep everything,the number of rows and their values and the whole
UI layout when the user either exits the app or the app crashes.What i want here is when
he enters the app again to see the state in which the app was left the last
time.



Thanks in advance and have a nice day
!

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print ...