如何从推送通知中返回值并将其显示在TextView
内。我在我的课程中尝试了这个,BroadcastReceiver
@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
Bundle extras = intent.getExtras();
String jsonData = extras.getString("com.parse.Data");
JSONObject jsonObject;
try {
jsonObject = new JSONObject(jsonData);
String title = jsonObject.getString("title");
String mesg = jsonObject.getString("message");
Intent intent2open = new Intent(context, DealWithNotice.class);
intent2open.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
String name = "KEY";
String value = title;
intent2open.putExtra(name, value);
Log.d("Value", value);
context.startActivity(intent2open);
}catch(JSONException e){
e.printStackTrace();
}
我很乐意将这件事搞得一团糟