diff --git a/build/sdk.atree b/build/sdk.atree index e87d8412a..69e0a50b9 100644 --- a/build/sdk.atree +++ b/build/sdk.atree @@ -91,6 +91,7 @@ development/samples/LunarLander samples/${PLATFORM_NAME}/LunarLande development/samples/NotePad samples/${PLATFORM_NAME}/NotePad development/samples/ApiDemos samples/${PLATFORM_NAME}/ApiDemos development/samples/BackupRestore samples/${PLATFORM_NAME}/BackupRestore +development/samples/NotePad samples/${PLATFORM_NAME}/HeavyWeight development/samples/SampleSyncAdapter samples/${PLATFORM_NAME}/SampleSyncAdapter development/samples/SkeletonApp samples/${PLATFORM_NAME}/SkeletonApp development/samples/Snake samples/${PLATFORM_NAME}/Snake diff --git a/samples/HeavyWeight/Android.mk b/samples/HeavyWeight/Android.mk new file mode 100644 index 000000000..c85626c7d --- /dev/null +++ b/samples/HeavyWeight/Android.mk @@ -0,0 +1,16 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_MODULE_TAGS := samples + +# Only compile source java files in this apk. +LOCAL_SRC_FILES := $(call all-java-files-under, src) + +LOCAL_PACKAGE_NAME := HeavyWeight + +LOCAL_SDK_VERSION := current + +include $(BUILD_PACKAGE) + +# Use the following include to make our test apk. +include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/samples/HeavyWeight/AndroidManifest.xml b/samples/HeavyWeight/AndroidManifest.xml new file mode 100644 index 000000000..c69befcc0 --- /dev/null +++ b/samples/HeavyWeight/AndroidManifest.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + diff --git a/samples/HeavyWeight/res/layout/heavy_weight.xml b/samples/HeavyWeight/res/layout/heavy_weight.xml new file mode 100644 index 000000000..345d75ef5 --- /dev/null +++ b/samples/HeavyWeight/res/layout/heavy_weight.xml @@ -0,0 +1,34 @@ + + + + + + + + + + diff --git a/samples/HeavyWeight/res/values/strings.xml b/samples/HeavyWeight/res/values/strings.xml new file mode 100644 index 000000000..88bc4138a --- /dev/null +++ b/samples/HeavyWeight/res/values/strings.xml @@ -0,0 +1,22 @@ + + + + + + A heavy-weight application will not be killed until explicitly stopped. + Stop + + diff --git a/samples/HeavyWeight/src/com/example/android/heavyweight/HeavyWeight.java b/samples/HeavyWeight/src/com/example/android/heavyweight/HeavyWeight.java new file mode 100644 index 000000000..f6024e990 --- /dev/null +++ b/samples/HeavyWeight/src/com/example/android/heavyweight/HeavyWeight.java @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2010 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. + */ + +package com.example.android.heavyweight; + +import android.app.Activity; +import android.os.Bundle; +import android.view.View; +import android.view.View.OnClickListener; +import android.widget.Button; + +/** + * Basic "heavy-weight" application, which will not be killed by Android + * while it is in the background. + */ +public class HeavyWeight extends Activity { + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.heavy_weight); + + Button button = (Button)findViewById(R.id.stop); + button.setOnClickListener(mStopListener); + } + + private OnClickListener mStopListener = new OnClickListener() { + public void onClick(View v) { + finish(); + } + }; +} + diff --git a/samples/HelloActivity/src/com/example/android/helloactivity/HelloActivity.java b/samples/HelloActivity/src/com/example/android/helloactivity/HelloActivity.java index 62bf5caa0..a5a5c96f1 100644 --- a/samples/HelloActivity/src/com/example/android/helloactivity/HelloActivity.java +++ b/samples/HelloActivity/src/com/example/android/helloactivity/HelloActivity.java @@ -24,9 +24,6 @@ import android.os.Bundle; * A minimal "Hello, World!" application. */ public class HelloActivity extends Activity { - public HelloActivity() { - } - /** * Called with the activity is first created. */