我在Manifest里注册了个receiver,每当受到短信就执行Translation这个继承BroadcastReceiver的类,然后让他跳到Activity 1,activty 1执行完到Activity 2.问题是当再次有短信时如何让他再次到Activity 1

解决方案 »

  1.   

    可以通过Notification跳转到Activity1 再在Activity1中跳到Activity2public class Translation extends BroadcastReceiver{ Notification niti;
    NotificationManager no;
    @Override
    public void onReceive(Context context, Intent intent) {
    // TODO Auto-generated method stub
    no=(NotificationManager) context.getSystemService(Service.NOTIFICATION_SERVICE);
    niti=new Notification();
    if(intent.getAction().equals("android.provider.Telephony.SMS_RECEIVED")){
    Intent inten=new Intent(context,Activity1.class);
    PendingIntent appIntent=PendingIntent.getActivity(context, 0, inten, 0);
    niti.icon=R.drawable.icon;
    niti.tickerText="转到activity1";
    niti.setLatestEventInfo(context, "跳转", "转到activity1", appIntent);
    no.notify(0, niti);
    }
    }
    }