【发布时间】:2013-12-04 07:26:17
【问题描述】:
我已在广播接收器类中检索到呼叫日志数据(号码、类型、日期、持续时间)。现在我想将该数据设置到活动类的列表视图中。我无法了解如何通过这些之间的意图发送数据两个活动并设置为列表视图。
在活动类中调用的代码:
String number = cursor.getString(cursor.getColumnIndex("address")); // check for null
String date = cursor.getString(cursor.getColumnIndex("date")); // convert to date its long
String message_text = cursor.getString(cursor.getColumnIndex("body"));
String type = cursor.getString(cursor.getColumnIndex("type")); // check type and get names
// send email from here
sendSMSEmail(number, date, message_text, type);
}
}
cursor.close();
String finalData=number+"\n"+date+"\n"+message_text+"\n"+type;
我也通过了 Intent
Intent i=new Intent();
i.putExtra(number,number);
i.putExtra(date, date);
i.putExtra(message_text, message_text);
i.putExtra(type,type);
context.sendBroadcast(i);
【问题讨论】:
-
你在
BroadcastReciver中调用了新活动吗? -
放一些你的示例工作代码
-
不,我不知道在 broadcastReceiver 类中调用新活动。我是 android 新手,请你帮我做。
-
我已经编辑了我的代码
标签: android android-intent android-activity broadcastreceiver