Android 对于PendingContent类型,未定义方法putExtra(String,String)
是否可以在PendingEvent中使用putExtra方法您必须在初始化Android 对于PendingContent类型,未定义方法putExtra(String,String),android,Android,是否可以在PendingEvent中使用putExtra方法您必须在初始化PendingEvent对象时传递intent。您可以调用intent对象上的putExtra(string,string)方法,如下所示 PendingIntent pendingIntent; Intent intent = new Intent(); intent.setClass(mContext,activity2.class); **intent.putExtra("string
PendingEvent
对象时传递intent
。您可以调用intent
对象上的putExtra(string,string)
方法,如下所示
PendingIntent pendingIntent;
Intent intent = new Intent();
intent.setClass(mContext,activity2.class);
**intent.putExtra("string","string");** // call putExtra with intent
pendingIntent = PendingIntent.getActivity(mContext, 0, intent, 0); // here we are passing intent object. you can also call getBR or GetService , but you will always passing intent in the method.
您必须在初始化
pendingent
对象时传递intent
。您可以调用intent
对象上的putExtra(string,string)
方法,如下所示
PendingIntent pendingIntent;
Intent intent = new Intent();
intent.setClass(mContext,activity2.class);
**intent.putExtra("string","string");** // call putExtra with intent
pendingIntent = PendingIntent.getActivity(mContext, 0, intent, 0); // here we are passing intent object. you can also call getBR or GetService , but you will always passing intent in the method.
我认为您需要使用
putExtra
来创建pendingent
我认为您需要使用putExtra
来创建pendingent是的,这是可能的
首先使用意图
。将Extars
值放入其中。
将该意图调用到您的pendingent
。简单的解决方案
希望你明白我的意思。让我知道。是的,这是可能的
首先使用意图
。将Extars
值放入其中。
将该意图调用到您的pendingent
。简单的解决方案
希望你明白我的意思。让我知道。是的,您可以使用Intent和pendingent作为:
Intent alarmintent = new Intent(getApplicationContext(),Activity2.class);
alarmintent.putExtra("title", "Title of our Notification");
alarmintent.putExtra("note", "Description of our Notification");
PendingIntent sender = PendingIntent.getBroadcast(this, ID, alarmintent,PendingIntent.FLAG_UPDATE_CURRENT | Intent.FILL_IN_DATA);
我用它来设置设备中的警报。希望这将对您有所帮助。是的,您可以使用Intent和pendingent作为:
Intent alarmintent = new Intent(getApplicationContext(),Activity2.class);
alarmintent.putExtra("title", "Title of our Notification");
alarmintent.putExtra("note", "Description of our Notification");
PendingIntent sender = PendingIntent.getBroadcast(this, ID, alarmintent,PendingIntent.FLAG_UPDATE_CURRENT | Intent.FILL_IN_DATA);
我用它来设置设备中的警报。希望这能对您有所帮助。以下是代码:通过使用意图、putextra和PendingEvent-----
IntentnotificationIntent=新意图(上下文,AllContacts.class);
Calendar c=Calendar.getInstance();
字符串sDate=c.get(Calendar.YEAR)+“-”+(c.get(Calendar.MONTH)+1)+“-”+c.get(Calendar.DAY\u OF\u MONTH);
通知意图。putExtra(“searcheddob”,sDate);
pendingentcontentIntent=pendingent.getActivity(context,0,notificationIntent,0) 下面是代码:通过使用意图、putextra和pendingEvent-----
IntentnotificationIntent=新意图(上下文,AllContacts.class);
Calendar c=Calendar.getInstance();
字符串sDate=c.get(Calendar.YEAR)+“-”+(c.get(Calendar.MONTH)+1)+“-”+c.get(Calendar.DAY\u OF\u MONTH);
通知意图。putExtra(“searcheddob”,sDate);
pendingentcontentIntent=pendingent.getActivity(context,0,notificationIntent,0)