-1
我正在Android Studio中創建一個博客應用程序。 我希望當有人停止在edittext
寫他的博客時,他寫的內容將被保存爲草稿。然後當他再次開始寫作時,他會繼續寫他正在寫的東西。 PS:我不知道你懂不懂。我的英語很爛:對檢測用戶何時停止在EditText中寫入以保存內容
我正在Android Studio中創建一個博客應用程序。 我希望當有人停止在edittext
寫他的博客時,他寫的內容將被保存爲草稿。然後當他再次開始寫作時,他會繼續寫他正在寫的東西。 PS:我不知道你懂不懂。我的英語很爛:對檢測用戶何時停止在EditText中寫入以保存內容
當然可以,你需要在用戶停止寫作,檢測,使用:
editText.addTextChangedListener
檢查這個例子:
EditText editText = (EditText) findViewById(R.id.editText);
editText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged (CharSequence s,int start, int count,
int after){
}
@Override
public void onTextChanged (final CharSequence s, int start, int before,
int count){
handler.removeCallbacks(input_finish_checker);
}
@Override
public void afterTextChanged (final Editable s){
if (s.length() > 0) {
last_text_edit = System.currentTimeMillis();
handler.postDelayed(input_finish_checker, delay);
} else {
}
}
}
謝謝先生! :) –
歡迎堆棧溢出!請參考[tour](https://stackoverflow.com/tour)並閱讀[如何提問](https://stackoverflow.com/help/how-to-ask)。 – litelite
你到現在爲止嘗試過什麼?你能分享嗎?這也將是一個個人意見的基礎。 – Soumya