Okay, I was able to figure out a timer earlier, but now I’m having another problem
So, when I call this function called “getNextQuote();” the first time in onCreate() it updates and gets a random quote and displays it perfectly, however, when I try again, in onResume(), it doesn’t refresh for some reason.
public void getNextQuote(){
TextView tv = (TextView) findViewById(R.id.quote);//Text To be edited
Random QuoteNum = new Random();
int Quote = QuoteNum.nextInt(50);
android.util.Log.i("DebugB",""+Quote);
String q = myString[Quote];//find which string is corresponding to the number
tv.setText(q);//Set the Text
android.util.Log.i("DebugC",q);
}
anything obvious I’m missing???
In the log the new quotes are coming out like there supposed to, but they just arn’t getting drawn to the actual emulator screen.
try this:
}
This counts test0, test1, test2,… 🙂 Just put your code into that runOnUiThread. When I tried your code, I got an error (because of the thread). Also check, if your interval is short enough. Just try 1000 msec. 🙂
UPDATE:
Maybe this is a better aproach by reusing the Runnable (don’t really know) 🙂