@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_timeline); mTwitter = TwitterUtils.getTwitterInstance(getApplicationContext()); SimpleTweetData data = (SimpleTweetData) getIntent().getSerializableExtra(TwitterUtils.INTENT_TAG_TWEETDATA); if (data == null) { showToast(getString(R.string.error_normal)); finish(); } if (data != null) userScreenName = data.getUserScreenName(); ActionBar actionBar = getActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setSubtitle("@" + userScreenName); } ListView listView = (ListView) findViewById(R.id.timeline_list_view); footerView = getLayoutInflater().inflate(R.layout.listview_footer, null); listView.addFooterView(footerView); adapter = new HaikuTweetAdapter(this); listView.setAdapter(adapter); final Button tailButton = (Button) footerView.findViewById(R.id.tail_button); tailButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { new TimelineAsyncTaskOfTail(adapter).execute(); } }); headerButton = (Button) findViewById(R.id.button_update); headerButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { new TimelineAsyncTask(adapter).execute(); } }); listView.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (id == -1) return; final HaikuStatus status = (HaikuStatus) parent.getAdapter().getItem(position); showDialog(status); } }); canCreateHaiku = SettingUtils.canCreateHaiku(this); new TimelineAsyncTask(adapter).execute(); }