Finish adding Makefiles for the Notepad tutorial.
Add the missing makefiles for the non-solution versions of the tutorial code. Required providing missing imports in Notepadv2. Also standardized white spaces using Source > Correct Indentation in Eclipse and a few manual changes. This was done to minimize differences such as: diff -r Notepadv1 Notepadv1Solution diff -r Notepadv1Solution/src/com/android/demo/notepad1/ Notepadv2/src/com/android/demo/notepad2/ Change-Id: Ie8b10efd61f2200b3c741ea500a6924710ab54ed
This commit is contained in:
31
tutorials/NotepadCodeLab/Notepadv2/Android.mk
Normal file
31
tutorials/NotepadCodeLab/Notepadv2/Android.mk
Normal file
@@ -0,0 +1,31 @@
|
||||
#
|
||||
# Copyright (C) 2009 The Android Open Source Project
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
# Only build apk if this package is added to CUSTOM_MODLUES in buildspec.mk
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
|
||||
# Only compile source java files in this apk.
|
||||
LOCAL_SRC_FILES := $(call all-java-files-under, src)
|
||||
|
||||
LOCAL_PACKAGE_NAME := Notepadv2
|
||||
|
||||
# Make the app build against the current SDK
|
||||
LOCAL_SDK_VERSION := current
|
||||
|
||||
include $(BUILD_PACKAGE)
|
||||
@@ -20,9 +20,11 @@ import android.app.ListActivity;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.os.Bundle;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ContextMenu.ContextMenuInfo;
|
||||
import android.widget.ListView;
|
||||
import android.widget.SimpleCursorAdapter;
|
||||
|
||||
|
||||
@@ -43,13 +43,13 @@ public class NotesDbAdapter {
|
||||
private static final String TAG = "NotesDbAdapter";
|
||||
private DatabaseHelper mDbHelper;
|
||||
private SQLiteDatabase mDb;
|
||||
|
||||
|
||||
/**
|
||||
* Database creation sql statement
|
||||
*/
|
||||
private static final String DATABASE_CREATE =
|
||||
"create table notes (_id integer primary key autoincrement, "
|
||||
+ "title text not null, body text not null);";
|
||||
"create table notes (_id integer primary key autoincrement, "
|
||||
+ "title text not null, body text not null);";
|
||||
|
||||
private static final String DATABASE_NAME = "data";
|
||||
private static final String DATABASE_TABLE = "notes";
|
||||
@@ -102,7 +102,7 @@ public class NotesDbAdapter {
|
||||
mDb = mDbHelper.getWritableDatabase();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public void close() {
|
||||
mDbHelper.close();
|
||||
}
|
||||
@@ -158,9 +158,9 @@ public class NotesDbAdapter {
|
||||
|
||||
Cursor mCursor =
|
||||
|
||||
mDb.query(true, DATABASE_TABLE, new String[] {KEY_ROWID,
|
||||
KEY_TITLE, KEY_BODY}, KEY_ROWID + "=" + rowId, null,
|
||||
null, null, null, null);
|
||||
mDb.query(true, DATABASE_TABLE, new String[] {KEY_ROWID,
|
||||
KEY_TITLE, KEY_BODY}, KEY_ROWID + "=" + rowId, null,
|
||||
null, null, null, null);
|
||||
if (mCursor != null) {
|
||||
mCursor.moveToFirst();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user