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.
Related
What type of component is used in samsung s health main window for items (like in attached photo)? I want similar functionality. Main think is that i want to define N number of buttons. And then display it to users. Usually there will be 2 or 3 choises. So, what is best component for this task? I must add some text and maybe an picture.
I would like to modify every Button's property, but I can't target them all. I can target only one at a time. I tried to use the Any Component menu's Any Button block, but still, I can target only one Button. I can't perform modifications manually (block by block), because I'm working with many buttons (254, to be exact). I tried putting every Button in a list, but dragging 254 blocks (one-by-one) takes too much time. Any solutions?
One good way to effectively change several properties of components ( of the same type. i.e Buttons), is to use a for-each loop then incorporating it with the any-button.property.
To use a for-each loop, you must first populate a list of components, however, buttons cannot be directly added to lists (structure limitations..), but fret not! there is a way to bypass this, which is to first create an empty list, named buttonsList (or whatever you like, labeled clearly), then to populate the list at screen initialization, with all buttons (to automate the process, this must be done manually at least once
After populating the list with all buttons, you'll then be able to change all properties using the for each loop.
initiate global-buttonsList : create empty list;
when screen1.initialize
do add item to 'buttonsList'
add all buttons here
Button1
Button2
Button#...etc.
At trigger event
for each - 'buttons/component name' in - Global 'buttonsList'
set anyButton.property (e.g, text?)
of component - 'buttons/component name'
to - "property change"
(i.e: text- Hello World!)
This should get the job done. Nevertheless, like #Taifun mentioned...that's a lot of buttons, and if there's one thing appInventor is really good at, it's crashing, so restructuring of the app would be great if possible.
Just change the "Horizontal Arrangements" with your buttons (sorry only manually)
then change "Any-component" with the property for the button (color,text-color...)
and target them with the numbers from the Loop (for each number)
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'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.
Okay here, I was told to make a golf score card app, but I'm stuck as how I implement the scoring per holes.
In golf, each hole has its own scoring and the ones I'm making the app for has as much as 27 holes per game.
I don't know whether I should make the 27 Activities for the 27 Holes
or
Use one Activity and ViewFlip with 27 different identical layouts for the whole thing.
Now I just want to know which is the best idea in tackling this problem
I don't know whether I should make the 27 Activities for the 27 Holes or Use one Activity and ViewFlip with 27 different identical layouts for the whole thing.
The layout for each hole is the same(I assume) so make a single activity with that layout and when it's time to go to the next hole score just update the data in that layout. Even if the layouts for different holes are a little different you still should use a single layout that you update(and of course modify it dynamically).
Don't use a ViewFlipper if you plan to flip between 27 identical layouts.