【发布时间】:2012-08-07 05:49:07
【问题描述】:
我在片段活动中运行 setText 命令来尝试在父活动中设置 textView 的文本,但它不起作用。有什么想法吗?
TextView text = (TextView) getView().findViewById(R.id.status);
text.setText("Text from a fragment");
我在 Eclipse 中没有收到错误,但在运行时出现空指针异常。当然它发生在我设置文本的那一行。关于如何做到这一点的任何想法?
【问题讨论】:
标签: java android android-fragments android-fragmentactivity