Make a Highscore Screen in App Inventor - android

I want to add a Highscore Screen to my Quiz App. I've already created a Highscore Screen with a start value, which contains the score the user has reached in the last round, the category-name and the difficulty.
I split this start value into 2 variables:
The first contains only the score and the other one the category and the difficulty. Now all in all I have 3 categories and 2 difficultys for each of them. Now I want to keep the top 10 Highscores of each category and difficulty. Like this:
Category 1 Difficulty 1
Category 1 Difficulty 2
Category 2 Difficulty 1
Category 2 Difficulty 2
Category 3 Difficulty 1
Category 3 Difficulty 2
As you can see, I will have 6 different Highscore lists.
Now my question:
How can I save all of the 6 lists in my TinyDB and reload the data again?

for each of the lists use its own tag for TinyDB
to save one of the lists, use the TinyDB.StoreValue block, to get it again in Screen.Initialize use the TinyDB.GetValue block, see also the docu and remember: on first run TinyDB is empty, see an example here how to handle that.
and: do the tutorials to get familiar with the basic concepts of App Inventor.

Related

How to handle a large number of activities in android studio

Iam a student and Iam developing an app for my college for downloading previous year question papers,my college has 14 departments and for each department 8 semesters and in each semester minimum 10 subjects are there so 14*2*8= 1120 java files and XML files I have to create if I keep on intenting from one activity to another it will take a huge time.how handle this huge activities.my app structure would be
Select department(14) >> Select sem(8)>> select subject(10)
Is there any methods like nestedif or something else to reduce the activity files.if there are any methods please do help me to complete the project.thanks in advance
No, you don't need that many activities. You need to write abstract activities that take parameters and displays different data based on those. At most I see 4 activities here- department selector, semester selector, subject selector, and the actual subject activity. And arguably some of those should be fragments instead, although that's more personal choice.

Reducing or Managing class in Android

I am creating a project with 2 SPINNER , When dropdown list of "spinner 1" is clicked it displays 8 Engineering branches and on clicking dropdown list of "spinner 2" Semesters (1st to 8th) are displayed.
If we click any one branch & semester (say Branch - IT, Semester - 3rd) it takes us to new activity with LISTVIEW of Subjects of that semester (here 3rd), If we click any subject it shows the detailed syllabus of the subject.
For performing the above task i will have to create atleast 9*8=72 classes - using INTENT (9 branches & 8 semesters... for entering the subjects of all braches of all semesters). It will to too difficult to manage so many classes and will also take too much time.
My question is:- Is there any way to reduce number of classes?

How to represent user application settings in Android

Iam working on an android application and have trouble making a decision for the architecture saving application data.
Following case:
In the app the user has the possibility to create new general objects and give them properties he want. To support this, i want to give them a list with favorites before creating the input form, for example a car. It has color, weight, speed, horsepower etc.
So the user can choose a often picked object (for example the car) and will get the appropriate fields for the form he has to fill (color, weigth ...).
This list should be smart. The more you pick an item, the higher it appears in the list. And this presets have to be editable in preferences.
And thats the point. Should I implement my idea with the preferences framework from android (save it to xml as different preferences types and simply load due preferencebuilder) or should i create own xml objects and save it to self created user file location?
My second question: if i use the preference framework method .... is this made good for dynamically add entries at runtime? the ressources are in the res folder, but what if there are individual user entries? will they also be saved in the program folder or is there a special user data folder where the files (maybe encrypted) are in?
Thank you
Storing such complex data in SharedPreferences is tricky. What I mean is assuming user created 4 objects and each has 8 properties. You would store 4*8 values in sharedprefs and map them too.
What can be done is maintain an array list of objects created by user. Consecutive to that list maintain counter array list and keep swapping both lists internally as per number of times user has clicked the object. example:
List Name List Counter
ObjA 5
ObjB 3
ObjC 1
ObjD 1
Store these two lists in Shared Prefs.
Now, for the object's properties part (2 possibility arises) :
Maintain a mySQL DB and a table for each object's name. You can store values of each column in it IF you need to store every instance created of the object by user. (every time user clicks the object just show him/her the column names of table and store the values entered)
Example :
ObjA Table :
Color speed horsepower rpm
________________________________
red 20mph 100 3000
black 80mph 500 8000
Consecutively, if you don't want to store every instance value, you can make another sharedPrefs with object as key and an Arraylist of properties as value.

How to present non-uniform data

I am working on a relatively simple android application: there's an sqlite database, and the user is presented with a list of the titles, and upon clicking on an item, the entire details of that record are displayed. But the problem is that the data is not uniform; some rows have only a couple of lines of text, some rows have a line of text and then an audio file, some rows have two or more audio files plus some text. How should I present this data, and more importantly, how do I store this data?
P.S. I want the audio to play at their respective places.
ii've solved the issue. the data is stored using two tables. example:
table 1:
id title
--- -----
1 blah
2 blahblah2
3 blah3
table 2 [details]:
id text img aud
--- ---- --- ---
1 jsgsg img11 aud11
1 segs img12 aud12
1 jbcj img13 aud13
2 nvnh img21 aud21
2 kjbj img22 aud22
3 jhbb img31 aud31
and the data is presented in inflatable listview containing one textview, one imageview and one audio button, the visibility of each depending on the value in the database(view invisible if value is null). one list each for all items with the same id.

Android - Database designing for Mapping or pics?

I need your help in designing my database.
I have 2 spinners; each one has 10 values.
Each value from the first spinner is related with the 10 values from the other.
In other words, its like a map paths so when you are on the 1st place, your options are 9 from the other spinner, and each option has a specific picture for it, if you see what I mean.
And option 2 (from first spinner) has 9 options (from second spinner) etc..
So there will be almost a 100 pictures.
I was thinking of 10 tables..... each option from the first spinner has the 9 from the other
Now I need your help on how I am gonna design my database.
Any ideas related to the subject would be great.
You want one table, not ten.
Table: SpinnerMapping
Spinner1 INTEGER NOT NULL CHECK(Spinner1 BETWEEN 1 AND 10)
Spinner2 INTEGER NOT NULL CHECK(Spinner2 BETWEEN 1 AND 10)
Picture ...image type... NOT NULL
PRIMARY KEY(Spinner1, Spinner2)

Categories

Resources