diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/Android.mk | 1 | ||||
-rw-r--r-- | apps/client/Android.mk | 37 | ||||
-rw-r--r-- | apps/client/AndroidManifest.xml | 36 | ||||
-rw-r--r-- | apps/client/src/com/example/android/platform_library/client/Client.java | 43 |
4 files changed, 117 insertions, 0 deletions
diff --git a/apps/Android.mk b/apps/Android.mk new file mode 100644 index 0000000..5053e7d --- /dev/null +++ b/apps/Android.mk @@ -0,0 +1 @@ +include $(call all-subdir-makefiles) diff --git a/apps/client/Android.mk b/apps/client/Android.mk new file mode 100644 index 0000000..ac4058a --- /dev/null +++ b/apps/client/Android.mk @@ -0,0 +1,37 @@ +# +# Copyright (C) 2008 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. +# + +# This makefile is an example of writing an application that will link against +# a custom shared library included with an Android system. + +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_MODULE_TAGS := user + +# This is the target being built. +LOCAL_PACKAGE_NAME := PlatformLibraryClient + +# Only compile source java files in this apk. +LOCAL_SRC_FILES := $(call all-java-files-under, src) + +# Link against the current Android SDK. +LOCAL_SDK_VERSION := current + +# Also link against our own custom library. +LOCAL_JAVA_LIBRARIES := com.example.android.platform_library + +include $(BUILD_PACKAGE) diff --git a/apps/client/AndroidManifest.xml b/apps/client/AndroidManifest.xml new file mode 100644 index 0000000..be0d9a1 --- /dev/null +++ b/apps/client/AndroidManifest.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2008 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. +--> + +<!-- This is an example of writing a client application for a custom + platform library. --> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.example.android.platform_library.client"> + + <application android:label="Platform Lib Client"> + + <!-- This tells the system about the custom library used by the + application, so that it can be properly loaded and linked + to the app when the app is initialized. --> + <uses-library android:name="com.example.android.platform_library" /> + + <activity android:name="Client"> + <intent-filter> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> + </intent-filter> + </activity> + </application> +</manifest> diff --git a/apps/client/src/com/example/android/platform_library/client/Client.java b/apps/client/src/com/example/android/platform_library/client/Client.java new file mode 100644 index 0000000..8722c72 --- /dev/null +++ b/apps/client/src/com/example/android/platform_library/client/Client.java @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2007 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.platform_library.client; + +import com.example.android.platform_library.PlatformLibrary; + +import android.app.Activity; +import android.os.Bundle; +import android.widget.TextView; + +/** + * Use a custom platform library. + */ +public class Client extends Activity { + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // Call an API on the library. + PlatformLibrary pl = new PlatformLibrary(); + int res = pl.getInt(false); + + // We'll just make our own view to show the result. + TextView tv = new TextView(this); + tv.setText("Got from lib: " + res); + setContentView(tv); + } +} + |