summaryrefslogtreecommitdiff
path: root/tutorials/NotepadCodeLab/Notepadv3/src/com/android/demo/notepad3/NoteEdit.java
diff options
context:
space:
mode:
authorTom O'Neill <tomo@google.com>2009-12-10 17:21:48 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2009-12-10 17:21:48 -0800
commit44e994e1d47deab75c19d8684e4da8398b448044 (patch)
tree45f4c1fa50652ea4e98503b68dd9bc464af4ede3 /tutorials/NotepadCodeLab/Notepadv3/src/com/android/demo/notepad3/NoteEdit.java
parent764ff7513a47da76a59fee7c5f299afb7662aac6 (diff)
parent036832adba9d953f8d34ece1bd5b049f02437928 (diff)
am 036832ad: Merge change Ic944ab1e into eclair-mr2
Merge commit '036832adba9d953f8d34ece1bd5b049f02437928' into eclair-mr2-plus-aosp * commit '036832adba9d953f8d34ece1bd5b049f02437928': Extract and check in NotepadCodeLab.zip for change tracking
Diffstat (limited to 'tutorials/NotepadCodeLab/Notepadv3/src/com/android/demo/notepad3/NoteEdit.java')
-rwxr-xr-xtutorials/NotepadCodeLab/Notepadv3/src/com/android/demo/notepad3/NoteEdit.java76
1 files changed, 76 insertions, 0 deletions
diff --git a/tutorials/NotepadCodeLab/Notepadv3/src/com/android/demo/notepad3/NoteEdit.java b/tutorials/NotepadCodeLab/Notepadv3/src/com/android/demo/notepad3/NoteEdit.java
new file mode 100755
index 000000000..af3a2340d
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv3/src/com/android/demo/notepad3/NoteEdit.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2008 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.demo.notepad3;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+
+public class NoteEdit extends Activity {
+
+ private EditText mTitleText;
+ private EditText mBodyText;
+ private Long mRowId;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.note_edit);
+
+ mTitleText = (EditText) findViewById(R.id.title);
+ mBodyText = (EditText) findViewById(R.id.body);
+
+ Button confirmButton = (Button) findViewById(R.id.confirm);
+
+ mRowId = null;
+ Bundle extras = getIntent().getExtras();
+ if (extras != null) {
+ String title = extras.getString(NotesDbAdapter.KEY_TITLE);
+ String body = extras.getString(NotesDbAdapter.KEY_BODY);
+ mRowId = extras.getLong(NotesDbAdapter.KEY_ROWID);
+
+ if (title != null) {
+ mTitleText.setText(title);
+ }
+ if (body != null) {
+ mBodyText.setText(body);
+ }
+ }
+
+ confirmButton.setOnClickListener(new View.OnClickListener() {
+
+ public void onClick(View view) {
+ Bundle bundle = new Bundle();
+
+ bundle.putString(NotesDbAdapter.KEY_TITLE, mTitleText.getText().toString());
+ bundle.putString(NotesDbAdapter.KEY_BODY, mBodyText.getText().toString());
+ if (mRowId != null) {
+ bundle.putLong(NotesDbAdapter.KEY_ROWID, mRowId);
+ }
+
+ Intent mIntent = new Intent();
+ mIntent.putExtras(bundle);
+ setResult(RESULT_OK, mIntent);
+ finish();
+ }
+
+ });
+ }
+}