启动apk前,如何先启动自己的activity

tiandyoin 2014-04-08 09:35:09
最近想给一个apk加个插件,先调用起自己写的插件,再由插件去调用APK的主程序,
我是这样写的,不知哪里有问题,总是调用不起来,一直黑屏,求大神指点



import com.tencent.pao.BreezeGame;
public class MyActivity extends Activity

{
Intent intent = new Intent();
intent.setClass(com.xiaoyao.register.MyActivity.this, com.tencent.pao.BreezeGame.class);
//intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
MyActivity.this.startActivity(intent);

//com.xiaoyao.register.MyActivity.this.finish();
}




<application
android:allowBackup="true"
android:label="@string/app_name">
<activity
android:label="@string/app_name"
android:name="com.xiaoyao.register.MyActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:theme="@*android:style/Theme.NoTitleBar.Fullscreen"
android:label="@string/app_name"
android:name="com.tencent.pao.BreezeGame"
android:launchMode="singleTop"
android:screenOrientation="sensorLandscape"
android:configChanges="locale|mcc|mnc|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|layoutDirection|fontScale"
android:alwaysRetainTaskState="true" >
<intent-filter>
<data android:scheme="wx15f5f4874ca259f4" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
...全文
132 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
tiandyoin 2014-04-09
  • 打赏
  • 举报
回复
这样就没有交互了,需求要交互,弹出自己的界面,用户按一下按钮,然后再启动别的activity
Birds2018 2014-04-09
  • 打赏
  • 举报
回复
你写个 长期运行在后台的 service可以做到,service在后台启动一个apk程序

80,350

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧