Simple loop works in Java but not "Android" -
I am getting a simple loop that runs in Java and is okay to work on Android.
I created a test view and just set up to run a test when I run it, then I get a number appearing in the box and that does not change at the second number.
I tried to do it with loops but I never got a title bar then a black screen and an accident
There are no errors in Eclipse and it is without any errors Moves and moves without
If your second thinking is thinking about the loop then it looks like a break, so that you can see the numbers look slower and work in plain java.
Just and FYI I am learning Java for 2 weeks after watching the videos on YouTube. I have made some Android apps that do stuffs, but the loop can not get loop well in the Android.
Thanks for any help for the new boy.
public class MainActivity ActionBarActivity (text view display; int counter; int min = 1; int max = 5; int counter 2; @ override protected form zero (bundle saved instenstate) {super .Net (savedinstenstate); setContentView (R.layout.activity_main); Display = (TextView) findViewById (R.id.textView1); while (counter & lt; 10) {random R = new random (int); Int rn = R.nextInt (max - min + 1) + minute; string rando = integer .trustring (rn); display.setText (rando); while (counter 2 and lieutenant; 5000) {Counter 2++;} Counter ++;}} @ Override Public Boolean On Crate Option Menu (menu menu) {// Increase menu; It adds item to action bar if it exists GetMenuInflater (). .menu Main, menu); Back to true;} @ Override public boolean on option etam select (menu item) {// handles action bar item here Click Action bar will automatically click on the Home / Up button, so long As time i // Original in AndroidManifest.xml Specify the activity. Int id = item.getItemId (); If (id == R.id.action_settings) {return true; } Return Super.Options item selected (item); Android uses an Event-Direct UI model that includes LifeSycle;)}
Event Methods such as Create (), On Pause (), Various Key / Button Methods and so on. They need to complete their work and return to some milliseconds .
Now to perform tasks that work - repetitive updates are included - you either have a main / UI thread, one of several mechanisms that is wrapped, or adds additional events, such as by timer .
Note that you can not touch the UI from any thread other than the UI thread, so when your background method determines that it wants to change something in the UI, it's actual update in the UIO thread Operation should run, such as using runOnUiThread () or a handler.
Comments
Post a Comment