Skip to content

Commit 0bbf2fa

Browse files
committed
update demo
1 parent 93a5b66 commit 0bbf2fa

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

PluginHelloWorld/src/main/AndroidManifest.xml

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
android:icon="@mipmap/custom_plugin_icon"
88
android:label="@string/app_name"
99
android:theme="@style/Theme.AppCompat.Light" >
10+
11+
<meta-data android:name="hello_meta" android:value="hello_meta_1234" ></meta-data>
1012
<activity
1113
android:name=".WelcomeActivity"
1214
android:label="@string/app_name" >

PluginHelloWorld/src/main/java/com/example/pluginhelloworld/WelcomeActivity.java

+10
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import android.app.Activity;
44
import android.content.Intent;
5+
import android.content.pm.ApplicationInfo;
6+
import android.content.pm.PackageManager;
57
import android.os.Bundle;
68
import android.support.v7.app.AppCompatActivity;
79
import android.util.Log;
@@ -21,6 +23,14 @@ public class WelcomeActivity extends AppCompatActivity {
2123
protected void onCreate(Bundle savedInstanceState) {
2224
super.onCreate(savedInstanceState);
2325

26+
try {
27+
ApplicationInfo info = getPackageManager().getApplicationInfo("com.example.pluginhelloworld", PackageManager.GET_META_DATA);
28+
String hellowMeta = (String)info.metaData.get("hello_meta");
29+
Toast.makeText(this, hellowMeta, Toast.LENGTH_SHORT).show();
30+
} catch (PackageManager.NameNotFoundException e) {
31+
e.printStackTrace();
32+
}
33+
2434
Log.e("xxx1", "activity_welcome ID= " + R.layout.activity_welcome);
2535
Log.e("xxx2", getResources().getResourceEntryName(R.layout.activity_welcome));
2636
Log.e("xxx3", getResources().getString(R.string.app_name));
305 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)