我想从该BroadcastReceiver
onReceive
方法加载一个活动。我有 2 个活动,一个是主要的,第二个是我创建的。我想从中加载第二个活动,onReceive
但它正在加载主要活动,我不知道为什么..
这是意图onReceive()
:
Intent i = new Intent(context, BTNotifierWarning.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
这是 BTNotifierWarning 类:
package com.btnotifier;
import android.app.Activity;
import android.os.Bundle;
public class BTNotifierWarning extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.warning);
// TODO Auto-generated method stub
}
}
这是警告 xml 布局:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context=".BTNotifierWarning" >
为什么会这样?
谢谢!