【发布时间】:2015-07-15 04:23:09
【问题描述】:
在 twitterfragment 类中我有
List<twitter4j.Status> statuses = twitter.getUserTimeline(user);
Intent intent = new Intent(getActivity(), twitter_timeline.class);
intent.putExtra(twitter_timeline.STATUS_LIST, statuses);// this line giving error if I pass status
在 twitter_timeline 类中,我想获取我从 twitter 片段中发送的雕像。
public class twitter_timeline extends Activity {
public static List<twitter4j.Status> STATUS_LIST;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_twitter_timeline);
setTitle("Timeline");
List<twitter4j.Status> statuses = (Status) this.getIntent().getStringArrayExtra(STATUS_LIST); // this line not resolving even if I cast it to status type
}
这里的意图期望在函数 getIntent.getStringArrayExtra(...) 中获取 StringArray,但我已经从我的片段中发送了 Twitter 状态。
【问题讨论】:
-
使用来自绿色机器人的 EventBus。 github.com/greenrobot/EventBus
-
明明你的status不是字符串数组,那为什么还要调用getStringArray呢?
-
显示我希望语句的工作方式
标签: java android android-fragments android-activity twitter4j