public class Talk extends Activity {
private ProgressDialog progDialog;
int typeBar;
TextView text1;
EditText edit;
Button respond;
private String name;
private String textAtView;
private String savedName;
public void onCreate (Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.dorothydialog);
text1 = (TextView)findViewById(R.id.dialog);
edit = (EditText)findViewById(R.id.repsond);
respond = (Button)findViewById(R.id.button01);
respond.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
text1.setText("Welcome! Enter your name!");
respond.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
name = edit.getText().toString();
text1.setText("Cool! your name is "+name);
}
});
}
});
}
好了,所以我想弄清楚如何我會保存此活動的狀態。這只是我的代碼中的一小段代碼,向你們展示一個例子。所以我想保存狀態,當活動被破壞時,用戶會回到他們離開的地方。
第二件事,我想在每個按鈕單擊之間顯示一個快速的5秒進度對話框微調器。
[此鏈接](http://developer.android.com/reference/android/app/Activity.html#ActivityLifecycle)解釋了Application/Activity生命週期及其回調方法,以及[this link](http://developer.android.com/reference/android/app/Activity.html#SavingPersistentState)解釋了保存持久狀態。第二件事,你真的想要每個按鈕點擊之間的5秒進度對話框微調嗎?或者你寧願有5秒的時間用戶輸入被暫停? –