Back to project page droidnotes.
The source code is released under:
GNU General Public License
If you think the Android project droidnotes listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.example.droidnotes.app; /*from w w w . j a va2 s . co m*/ import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.ImageButton; public class InsertNoteActivity extends Activity { Integer id; EditText mNoteEdit; ImageButton mButtonSave; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_insert_note); try { initClassData(); setupUI(); setupCallbacks(); } catch (Exception e) { e.printStackTrace(); } } protected void initClassData() { mNoteEdit = (EditText) findViewById(R.id.note_edit); mButtonSave = (ImageButton) findViewById(R.id.button_save); id = getIntent().getIntExtra(DNHelper.MESSAGE_NOTE_ID, -1); } protected void setupUI() { if (id != -1) { String note = DNHelper.queryNote(this, id); mNoteEdit.setText(note); mNoteEdit.setSelection(note.length()); } } protected void setupCallbacks() { mButtonSave.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onButtonSaveClick(); } }); } protected void onButtonSaveClick() { String note = mNoteEdit.getText().toString(); DNHelper.insertNote(this, id, note); finish(); } }