Two page form question - saving data from first page

by doubleminus » Mon, 15 Jun 2009 04:32:13 GMT

Sponsored Links
 This is a general architectural question.

I want to offer a user a simple two page form. The first page will
have a few Spinners for the user to select options from. The second
page will have a series of EditTexts for the user to fill in. After
the second page, the user clicks a button to generate a text file
based on the values they have input.

My question is: What is the best way to handle preserving the data
from the spinners on the first page of the form, in order to place
them into the text file?

I feel like the "architecture" should be something like this:
1. User selects Spinner values on first page and clicks button to move
to next page of form..
2. Spinner values are placed in database
3. User fills in EditTexts on second page. Clicks button to generate
text file.
4. Database is queried for Spinner values, which are added to newly
created text file, then EditText values are added

Does this strategy make sense? Does anyone have advice on a better way
of handling the gathering of two pages of form input then using it to
create a text file?

The user would need to be able to flip back and forth between the form
pages as needed.


Two page form question - saving data from first page

by gjs » Mon, 15 Jun 2009 22:22:23 GMT

 Hi there,

You may need to save your data from the spinners earlier using the
various Listeners in order to cater for other events - eg press Home/
Back button, keyboard open/cose, phone rings etc - other than just
when user 'clicks button to move to next page'.

You can also save the data from spinners etc into application
Preference objects, these can also be used to persist (read & write)
data across app invocations.



Sponsored Links

Two page form question - saving data from first page

by doubleminus » Mon, 15 Jun 2009 22:53:51 GMT

 Ah. So I'll likely be using a listener of some sort or a app
Preference object - and not writing to the database?  Good to know.  I
hadn't thought of the obvious issues you've brought up (user moving
away from application then coming back).  The data does not need to be
preserved beyond the generation of the text file...but definitely does
need to persist until that file is created.


Two page form question - saving data from first page

by Doug » Wed, 17 Jun 2009 01:36:07 GMT

 Remember that your activity class has methods that are automatically
called when it is dropped and restored. All you need to do is
implement them.

On the original question of being able to pass page 1 data to page
2... just add a click listener to your 'next' button, in there create
the intent to display p2, and add the values you want to pass as
intent extras. Page 2 can then pull the values out of the intent at
its leisure.



Other Threads

1. ContentProvider's DB file access right problem when its android:multiprocess=true

According to Android Dev Guide (
TW/guide/topics/manifest/provider-element.html), it says that    if
android:multiprocess is set to "true", the system can create an
instance in every process where there's a client that wants to
interact with it, thus avoiding the overhead of interprocess

But...  since the multiple ContentProvider instances are running in
different process space, how do they access the DB file that was
created in different process space or user ID?

I've checked browser & in its packages/apps/Browser/
AndroidManifest.xml:  android:multiprocess="true"
-rw-r--r-- app_12   app_12        512 1903-02-27 13:29 webviewCache.db-
-rw-rw---- app_12   app_12       5120 1903-02-27 13:29 browser.db
-rw-rw---- app_12   app_12       6144 1903-02-27 13:29 webviewCache.db
-rw-rw---- app_12   app_12      14336 1903-02-27 13:29 webview.db

Does any one know why???


2. removing item from ListView


i want to remove the first line from my ListView. I use the
example from Mark Murphy.

I have a ImageView and two TextViews in one List-row.

My adapter class:
class MyAdapter extends ArrayAdapter<String>
        Activity context;

        MyAdapter(Activity context)
                super(context, R.layout.row, description);  //description is a
list of Strings and is showed in one TextView. The image and the other
TextView depends on other objects.

I try:

String delete = (((MyAdapter)lv.getAdapter()).getItem(0));

But it only remove the description, but not the whole row!?

Thanks in advance,


3. OOT | vynil itu apa ya?

4. conditional build

5. Android bring-up

6. android on imx 51

7. path to "custom debug keystore"