Help transfering from app inventor to intellij Idea

Hi,

I have created a simple app on app inventor that makes use of TinyDB.

I store a series of values (fixed values), which I can select using a spinner.

the values pull in a series of fixed values.

I can then modify these values and save them to a working set, the working set of values load up at default.

I want to convert my app into code  and I am ploding along slowly.

Can anyone help point things out please.



How it works:-

1. select option with spinner
2. the option pulls in fixed data, which varies for each selection of the spinner.
3. these values can be modified and saved for a working set of values. the orignal values still remain in tact and can be recalled if someone makes a mistake and they can start with the default values.

Example:-

Tinydb app inventor:-

procedure series 1,2,3,4

series 1:- (these are fixed values and dont change)

apptag                   value 1
headertag              value 2
titletag                    value 3

series 2:- (these are fixed values and dont change)

apptag                   value 1A
headertag              value 2A
titletag                    value 3A

series 3:- (these are fixed values and dont change)

apptag                   value 1B
headertag              value 2B
titletag                    value 3B

series 4:- (these are fixed values and dont change)

apptag                   value 1C
headertag              value 2C
titletag                    value 3C

series working set:-

apptag                    as selected
headertag               as selected
titletag                    as selected


the best I have managed is that before I save to the working set, outside of app inventor, I can select my different values, once selected I can not go back without ressetting my data in applications manager.

However, I need to be able to pull in the default values at will and not reset the app to go back.

what I have done:-

spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

           public void onItemSelected(AdapterView<?> arg0, View arg1,
                                      int arg2, long arg3) {

               int index = arg0.getSelectedItemPosition();
               // storing string resources into Array
               spinner = getResources().getStringArray(R.array.spinner_array);

               Toast.makeText(getBaseContext(), "You have selected : " +spinner[index],
                       Toast.LENGTH_SHORT).show();


I have done this using if (index === 0){

apptag.setText(settings.getString("app_tag", "value1")); } else{

and so on for all the possabilities,  the problem being the command setText......  only updates if there are no entries already saved, hence I can select on first use and then cant select anymore without resetting.


I  want the code to be clean and smart and understanderable.

I think the best way would be to have files with all the options in theres about 20 options per series and 20 series, so there is quite a few to go at.

Call the files  so they are read and go the editTex id  and saved  ready to be used by the app, but if I want to i can go and select another set of presets and run them.

Please be gentle new to hard code, all tutorials you can recommend or methods i can try for this implimenattion with  maybe a litle guide on what each bit does I would be greatful, the shared preferences and other tutorials have got me this far but it is in room for some serious improvement.

Thanks
Wayne

2 comments

can anyone point me in the right direction as where to start please.

Thanks
Wayne

0

Hi still dont have a solution to the above so that:-


all the strings for each group are stored in a seperate file and pulled into the app as required.

This would make it easier to add more files at a later date relatively easily, can anyone please point me in the right direction.

If you need more info or closer look at the code then please get in touch.

Kind Regards


Wayne
(learning by trial and error as not many good examples to follow)

0

Please sign in to leave a comment.