2013-02-20 50 views
0
  EditText hi = (EditText) findViewById(R.id.editText1); 
     String hi2 = hi.toString(); 

     editor.putString("user_email", hi2); 
    editor.commit(); 

上面的代碼在我上點擊作品和編譯罰款,但是當我進入我的設置我得到的值是通的EditText爲字符串

[email protected] 

有誰知道正確的語法,對我來說,將用戶輸入框中的值傳遞給我的前綴。

如果我使用

editor.putString("user_email","[email protected]"); 

那麼它的作品,因爲它是一個完整的字符串。

回答

0
  EditText hi = (EditText) findViewById(R.id.editText1); 
     String hi2 = hi.getEditableText().toString(); 

     editor.putString("user_email", hi2); //put into the email settings the value from the user input 
     editor.commit(); 

我錯過了getEditableText() 深夜編碼:(