You declared i as a class member variable of your activty, you can access it anywhere in your activity.
protected void onSaveInstanceState(Bundle outState) {
outstate.putInt("Myint", i)
super.onSaveInstanceState(outState);
}
Update
public class MainActivity extends Activity {
private String[] wordList = { "SICK", "FUTURE", "PROBLEM", "DECEIVE", "SUFFER","FAITH", "PROTECT", "SUICIDE", "STEP", "WNJOY", "FAIL" };
private TextView tv;
private int current = 0;
private Handler handler = new Handler();
public void updateUI() {
current++;
if (current == wordList.length) current=0;
tv.setText(wordList[current]);
handler.postDelayed(new Runnable() {
@Override
public void run() {
updateUI();
}
}, 3000);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if(savedInstanceState!=null) current = savedInstanceState.getInt("current");
tv = (TextView) findViewById(R.id.tv);
updateUI();
}
protected void onSaveInstanceState(Bundle outState) {
outState.putInt("current", current);
super.onSaveInstanceState(outState);
}
@Override
public void onDestroy() {
super.onDestroy();
handler.removeCallbacksAndMessages(null);
}