I am making a Education Questionnaire App.
As far as layouts are concerned, there are 10 layouts:
1 Introduction Page
2 Main Selection
3 Chapter Selection
4 Completion page
5 Question Layout 1
6 Question Layout 2
7 Question Layout 3
8 Question Layout 4
9 Explanation Layout 1
10 Explanation Layout 2
I have already made these 10 XML layouts. (The whole layout changes, so fragment not possible)
Now comes the question of connecting them with Java.
Flowchart
After the Chapter Selection Page, the user answers 14 questions(Question Layout 1 to 4)with view data changed.
Ideally, I want the back button to be used throughout the chapter so the stack will consist of 14 Activities per Chapter (1 question per screen/activity).
I need to confirm which is the best way to go about this.
Option 1
In total there are 120 chapters, so should I create 14 X 120 activities.(Sounds tiresome) Will it affect app usage speed?
Option 2
Restrict the back button to one per chapter (i.e. make one activity per chapter). Then I'll have to make 120 activities only.
In this case, in 1 activity, the 4 Question layouts will change view data 14 times (approx) with button clicks. How can I achieve this?
Search Results
I have found similar questions here but they talk about either using same layouts for each activity (Eg In Android, can I have different Activities use the same XML file?) or different view data per activity (Eg. Use single xml layout for multiple activities with different datas).
A similar question (Using multiple layouts in single activity) was asked but the answers were not implementable.
Question
My question is : Which is the better option? In case Option 2, please give me a sample. I am using Android Studio 3.0
Related
I am new to android tablet design.
This is the home page with its various parts numbered
I wanted to know the best possible design approach. Most sites related to android 4 describe basic use of fragments.
Here i have
1 which is fixed and would be available for all the future pages.
2 and 6 consists of sliding images.on click i want to show the images in 5
3 is the application name tab.Fixed for all pages
7 consists of tabs
4 consists of sub menu populated when a tab is clicked in 7
5 is where i want to show whatever is clicked.
My question is for such a layout, where should i use fragments and how many.which is the best possible approach.
Say since 1,3,6,2 are constant .. cant i use a separate XML and include it in the pages.
7 are the tabs. On click of a tab 4 is populated which further populates 5
Should i use fragments for these.
There are many portions in your design. The best designing style is "make it simple and avoid complexity. You always found some apps which are displaying too many content those apps are not user friendly . Just think which portion of your app is used more and more time and put it in the best position of your design .
Try to minimize the number of tabs . You can put lots of tabs on 7 and also make it scroll-able but its little bit boring to use a tab under scroll . In single activity you can not use multiple xml file with out fragment . Hare is my personal comment :" i think it would be more beautiful if you put number "7" under of over "3" and according to my consideration number "4" is less necessary , "2" and "6" is confusing "
you can see this link : Design
Thank You
I have the following requirement:
-----> Showing Five elements of different color and Allow user to select the correct one.
-----> Like that I want to show 16 Kinds(Means 16*5 = 80 elements on 16 Activities)in Random.
===> For that I have created 16 activities and corresponding 16 XML files, and used them Randomly.
&&
First I'l show 5 colors and let the user select one(Say Green), If it is correct, I'l let him select one from another set of 5 colors(This time red)....& so on...Like that I have to make him choose 16 Colors Randomly.And repeat this 16 random colors until he press Back button.That' the exact flow
By the End of the Day, I am in Small Dilemma that, May be there , will be some kind of Logic that winds up the work bit smoothly By reducing the code.
If yes ,Tell me the Logic .
I have all the 80 different elements , to show them in 16 activities, 5 per Activity.
If the elements are the same type, you can have one Activity instead of 16 and choose what to show when creating Activity(or even use Fragments for that).
Any way, you have to be more specific in your question if you want to get complete answer.
Rather than creating 16 different activities, You can create a single activity and 16 different layouts. You can change the layout of activity dynamically and I think it would be good, avoid creating so many activity if there is really no need of it.
I'm working on an app where basically i have X different activities but everyone has a layout equals to the rest. To let you understand better let me do an example:
Suppose i have a game where you have to guess 10 words each level, and I have 5 levels, basically I have in every view 10 question.
So is better to have 5 different activities or only one activity and 5 layouts, one for every level ?
Looking around on the web i did not find a good answer, someone told that Android is based on activity, so 10 different ones is the way to go, but was only a guessing, nothing technical.
Don't make 10 Activities. Don't make 5 layouts. All questions look the same except for the text, right? Don't Repeat Yourself.
Simplify your life reuse the same Activity and Layout for every single question.
When you start the activity, you can pass in data using the .putExtra() methods. Use that to pass in the things that change, like the question text, the correct answer, and the current level.
I would do 1 layout and then program the levels onto it.
Doing a brick breaker game, or tetris, or puzzle game wouldnt want you to have a million diff activity options, but more like 1 layout and 1 activity will populate accordingly.
Usually you can do something like
[home] -> {play, options, exit}
[play] -> {new game, level select}
[options] -> ....derp...
[exit] -> ....derp...
[newgame] --> start activityA where level = 1
[level select] -> click a link which will start activityA with a level = selected.
1 activity which will spawn your information safe and nicely... far far better imo.
I have written code for creating a question viewer where there are 20 questions, each with 4 radio button options. There are two buttons prev and next. Now I want a small fragment on the left which shows me all question numbers and if i answer a question it changes the colour on the button on the fragment. Also if i click that button it takes me to that question. I have created methods for retrieving the questions from a sqlite file. How do I convert this to include the fragment. I have installed the compatibility package. But how do I proceed.
It turned out to be quite easy in the end. I just had to make two different fragments for the question numbers on the left, and the questions on the right, Move my business logic to the fragment, extend Fragment Activity instead of Activity and inflate the fragment on landscape orientation. :)
I have a series of 6 lists of related data. Really, they are the same set of data split out by a status flag into 6 different "Queues". In my android application I have a dashboard pattern for my main menu, which has an option for the queues. The tab strip is too small to have 6 options on it, so I would either have to have a horizontal scroll view around my tabhost (which I can't seem to get to work easily), or I need to find another way. From what I've seen, if I need that many tabs, I should be looking at a dashboard design pattern. Is it acceptable to have a nested dashboard? What is the best practice here?