提交 0c4c6829 编写于 作者: 杜庆泉's avatar 杜庆泉

android 新增应用包名根目录下提供activity的示例

上级 ea8fd0fc
...@@ -16,5 +16,14 @@ ...@@ -16,5 +16,14 @@
android:name="android.support.FILE_PROVIDER_PATHS" android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/filepaths" /> android:resource="@xml/filepaths" />
</provider> </provider>
<activity android:name="uni.UNI70BE9D0.RootPackageActivity"
android:launchMode="singleTask"
android:exported="true">
<intent-filter>
<action android:name="uni.UNI70BE9D0.RootPackageActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application> </application>
</manifest> </manifest>
...@@ -184,6 +184,21 @@ class ActivityFinishListener extends OnClickListener{ ...@@ -184,6 +184,21 @@ class ActivityFinishListener extends OnClickListener{
} }
} }
class RootActivityStartListener extends OnClickListener{
host:Activity
constructor(activity:Activity){
super()
this.host = activity
}
override onClick(v?: View):void{
let intent = Intent("uni.UNI70BE9D0.RootPackageActivity")
host.startActivity(intent)
}
}
/** /**
* 自定义异步线程 * 自定义异步线程
*/ */
...@@ -262,6 +277,8 @@ class DemoActivity extends Activity{ ...@@ -262,6 +277,8 @@ class DemoActivity extends Activity{
let btn_finish_activity = this.findViewById<Button>(R.id.btn_finish_activity); let btn_finish_activity = this.findViewById<Button>(R.id.btn_finish_activity);
btn_finish_activity.setOnClickListener(new ActivityFinishListener(this)); btn_finish_activity.setOnClickListener(new ActivityFinishListener(this));
let btn_start_root_activity = this.findViewById<Button>(R.id.btn_start_root_activity);
btn_start_root_activity.setOnClickListener(new RootActivityStartListener(this));
let recyclerView = this.findViewById<RecyclerView>(R.id.recycler_view) let recyclerView = this.findViewById<RecyclerView>(R.id.recycler_view)
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<Button android:layout_width="match_parent" android:layout_height="wrap_content" android:text="注册屏幕状态广播监听" android:id="@+id/btn_start_screen_listen"/> <Button android:layout_width="match_parent" android:layout_height="wrap_content" android:text="注册屏幕状态广播监听" android:id="@+id/btn_start_screen_listen"/>
<Button android:layout_width="match_parent" android:layout_height="wrap_content" android:text="开启异步任务" android:id="@+id/btn_start_thread"/> <Button android:layout_width="match_parent" android:layout_height="wrap_content" android:text="开启异步任务" android:id="@+id/btn_start_thread"/>
<Button android:layout_width="match_parent" android:layout_height="wrap_content" android:text="关闭当前activity" android:id="@+id/btn_finish_activity"/> <Button android:layout_width="match_parent" android:layout_height="wrap_content" android:text="关闭当前activity" android:id="@+id/btn_finish_activity"/>
<Button android:layout_width="match_parent" android:layout_height="wrap_content" android:text="打开应用根目录activity" android:id="@+id/btn_start_root_activity"/>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册