i've solved
<<resources>
<string name="app_name">gdfg</string>
<string name="action_settings">Settings</string>
<string name="str1">Alice</string>
<string name="str2">empty</string>
<string name="str3">empty</string>
<string name="str4">empty</string>
<string name="str5">Jane</string>
<string name="str6">Beth</string>
>
public class MainActivity extends Activity {
TextView Textview1;
TextView Textview2;
int str[] = {R.string.str1,R.string.str2,R.string.str3,R.string.str4,R.string.str5,R.string.str6};
int CurrentText = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Textview1 = (TextView)findViewById(R.id.textview1);
Textview2 = (TextView)findViewById(R.id.textView2);
Button button = (Button)findViewById(R.id.button);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Textview1.setText(str[CurrentText]);
String cntrl = (String) getText(str[CurrentText]);
if(cntrl.equals("empty")){
handlerTimer.postDelayed(taskUpdateStuffOnDialog, 1000);
}else{
CurrentText++;
}
}
});
}
//Handler definiton...
private Handler handlerTimer = new Handler();
private Runnable taskUpdateStuffOnDialog = new Runnable() {
public void run() {
CurrentText++;
String cre = (String) getText(str[CurrentText]);
Textview1.setText(cre);
if(cre.equals("empty")){
handlerTimer.postDelayed(this, 1000);
}else{
//Çalışmayı durdurmak için de aşağıdaki kod kullanılabilir:
CurrentText++;
handlerTimer.removeCallbacks(taskUpdateStuffOnDialog);
}
}
};