如果我点击了确认对话框里的确认 然后怎样能跳转到下一个xml页面呢??
如果我点击了确认对话框里的确认 然后怎样能跳转到下一个xml页面呢??
如果我点击了确认对话框里的确认 然后怎样能跳转到下一个xml页面呢??
2016-09-18
private void sendNotification() { Intent intent = new Intent(this, two.class);//修改Intent跳转的页面 PendingIntent pendintent = PendingIntent.getActivity(MainActivity.this, 0, intent, 0); NotificationCompat.Builder builder = new NotificationCompat.Builder(this); builder.setSmallIcon(R.mipmap.ic_launcher); builder.setTicker("我是通知"); builder.setWhen(System.currentTimeMillis()); builder.setContentText("短信一条"); builder.setContentTitle("通知栏"); builder.setContentIntent(pendintent); builder.setDefaults(Notification.DEFAULT_SOUND); Notification notification = builder.build(); notification_manager.notify(notification_id, notification); }
别忘记在mainfest中声明跳转的页面
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); builder.setMessage("确认跳转到副页面?"); builder.setTitle("提示"); builder.setPositiveButton("确认", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { //像这样就可以了 Intent intent = new Intent(MainActivity.this, Main2Activity.class); startActivity(intent); } }); builder.setNegativeButton("取消", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.create().show();
举报