我在.MainActivity
类中设置了这样的通知:
Intent downloadUpdateIntent = new Intent(mContext, updateAppDialogFragment.class);
PendingIntent downloadAppPendingIntent = PendingIntent.getActivity(mContext,0,downloadUpdateIntent,0);
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(mContext)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle("Update Available")
.setContentText("A new version of this app is available.")
.setDefaults(Notification.DEFAULT_ALL)
.setPriority(Notification.PRIORITY_HIGH)
.addAction(0,"Update",downloadAppPendingIntent);
NotificationManager notificationManager = (NotificationManager) getSystemService(mContext.NOTIFICATION_SERVICE);
notificationManager.notify(1, mBuilder.build());
我需要做的是,当我单击update
按钮时,它应该显示updateAppDialogFragment
来显示更新进度。当我通常使用此类时,我需要进行这样的调用updateAppDialogFragment.newInstance()
。但是在这里,我不明白如何做到这一点。有人帮忙吗?
我对意图有非常基本的了解。实际上,我需要知道的是使用意图来调用方法。