2013-07-10 64 views
-3

我正在創建一個應用程序,listvView包含四個EdiTexts,並且每行都有一個按鈕,但是當我編輯editText並單擊後退按鈕以隱藏鍵盤,它會刪除所有的值! 這有點麻煩,我不能繼續發展它! 如果你有任何我想要的想法。 感謝您的時間,祝您有美好的一天。當我點擊後退按鈕時重新啓動應用程序

編輯: 我想,當我點擊後退按鈕,隱藏鍵盤沒有,清除所有的值,我會加入apk如果你想/需要^^,感謝您的快速回答。 有鏈接到應用程序:

https://docs.google.com/file/d/0BwyELfc-0SheZlo3cElfSzdERnc/edit?usp=sharing

對不起我的英文不好,後。

+0

你的問題是什麼,你想達到什麼目的? – Neoh

+0

我想,當我點擊後退按鈕,隱藏鍵盤沒有,清除所有的值,我會加入apk如果你想/需要^^,感謝您的快速答案。 – Ilisparrow

回答

0

簡單的方法是當您按回按鈕時存儲您的值。一個編輯文本的示例:

String temp1 = ""; 
EditText editText1 = (EditText)findViewById(R.id.editText1); 

Button button = (Button) findViewById(R.id.button1); 
button.setOnClickListener(new View.OnClickListener() { 
    @Override public void onClick(View v) { 
     editText1.setText(temp1); 
    } 
}); 



@Override 
public void onBackPressed() { 
    temp1 = editText1.getText.toString(); 
} 
相關問題