当前位置:编程学习 > wap >>

关于PendingIntent 的页面跳转问题??

下面的是接收系统DDMS那里发送广播的类SmsReceiver ,,
还有模拟器主运行类是MainActivity类==AA.java类【一个普通的页面】=====
运行程序后模拟器显示的是MainActivity页面,然后我到DDMS里去发送短信==为什么这里没跳到AA页面??
===================================================-===============
public class SmsReceiver extends BroadcastReceiver {

@Override
public void onReceive(Context ctx, Intent intent){
     sendNotify(ctx, intent); //调用下面的方法==
}
void sendNotify(Context ctx, Intent intent) {
NotificationManager nm = (NotificationManager) ctx 
.getSystemService(Context.NOTIFICATION_SERVICE);
//NotificationManager是状态栏通知的管理类,负责发通知、清楚通知等。
Notification.Builder builder = new Notification.Builder(ctx);

builder.setContentText("content text");
builder.setSmallIcon(R.drawable.ic_launcher);
builder.setTicker("tickerText");

Intent in = new Intent(ctx, AA.class);//??==为什么我发送消息后没跳转到AA页面===
// 延迟的intent ---
// 打开界面
PendingIntent pi = PendingIntent.getActivity(ctx, 0, in, PendingIntent.FLAG_UPDATE_CURRENT);
builder.setContentIntent(pi);
Notification nf = builder.build();
nm.notify(0, nf);
  }
} broadcastreceiver 通知 PendingIntent Notification NotificationManager
补充:移动开发 ,  Android
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,