public class MainActivity extends ActionBarActivity {
String []Questions=
{"Question1",
"Question2",
"Question3",
"Question4",
"Question5"};
TextView Txt_view;
private int questionInterval = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Txt_view= (TextView)findViewById(R.id.Txt_view);
Timer timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
// TODO Auto-generated method stub
runOnUiThread(new Runnable() {
public void run() {
if(questionInterval == Questions.length) {
questionInterval = 0;
}
Txt_view.setText(""+Questions[questionInterval++]);
}
});
}
}, 1000, 1000);
}
}
No comments:
Post a Comment