我将数据从一个类发送到FragmentActivity,如下所示:
public class OpenReportAction extends Action {
private WorkActivity listener;
public OpenReportAction(Activity listener) throws BadListenerException {
if (!(listener instanceof WorkActivity)) {
throw new BadListenerException("Listener must be context of WorkActivity");
}
this.listener = (WorkActivity) listener;
}
@Override
public void execute(List<Report> reports, Questions question) {
Intent replyIntent = new Intent(listener, ReplyActivity.class);
replyIntent.putExtra("id", listener.getWork().getID());
replyIntent.putExtra("questions", question);
replyIntent.putParcelableArrayListExtra("reports", (ArrayList<Report>) reports);
listener.openReportOk(question);
listener.startActivity(replyIntent);
}
public interface ReportCreatedCallback {
void openReportOk(Questions question);
void openReportError(WorkActionError cause);
}
}
我得到的数据是这样的:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
setContentView(R.layout.reply_activity);
getData(getIntent());
setFragment();
}
private void getData(Intent data) {
ID = data.getLongExtra("id", 0);
questions = data.getParcelableExtra("questions");
reports = data.getParcelableArrayListExtra("reports");
}
但是在FragmentActivity(ReplyActivity)里面,额外的东西总是空的。我怎么能得到它?
答案 0 :(得分:0)
确保&#34;报告&#34;额外不是一个大的对象。 大型物体无法通过意图。 提示:如果是这样的话,你会看到类似的日志:&#34; JAVA BINDER FAILURE&#34;