如果我是从receiver里面 启动activity 应该怎么做?
解决方案 »
- android中使用webview加载网页时,webview.stopLoading()为什么没有立即停止加载?
- 关于apktool反编译与编译问题。
- 模拟onTouchEvent事件
- ListPreference单项显示两行
- 如何修改Android系统属性
- android 触摸板颜色问题
- 关于对话框的问题
- 关于ViewFlipper的问题,在同一个页面有两个layout,当滑动到第二个view的时候吗,怎样监听返回键返回到上一个layout,而不关闭页面~
- Android删除最近使用过的程序?
- 问题: 我想去掉android应用程序显示的一些选项,应如何处理?
- 组播无法接收到数据
- 求教android下使用gluUnProject时候出的错
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.PACKAGE_REPLACED" />
<data android:scheme="package" android:path="com.monetware.android" />
</intent-filter>
</receiver>public class StartupIntentReceiver extends BroadcastReceiver { //爱先启动什么就什么 private static final String TAG = "StartupIntentReceiver";
@Override
public void onReceive(Context context, Intent intent) {
Log.info(TAG, "onReceive");
// Intent serviceIntent = new Intent(); //启动Service
// serviceIntent.setAction("com.monetware.android.services.AutoSyncService");
// context.startService(serviceIntent);
Intent intent2=new Intent(context,AndroidLoadingScreen.class); //启动第一个activity
intent2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent2);
}
}
Receiver,可以静态注册也可以动态注册广播,广播类型可以是自定义类型也可以是系统广播,
比如2楼所写的是通过开机启动广播启动Activity
Service,同理,Manifest.xml注册,通过广播等都可以启动楼主多看看吧...