Back to project page lffl-feed-reader.
The source code is released under:
GNU General Public License
If you think the Android project lffl-feed-reader listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.iven.lfflfeedreader.mainact; // ww w . j a v a 2s. co m import android.annotation.SuppressLint; import android.app.ActionBar; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentStatePagerAdapter; import android.support.v4.view.ViewPager; import android.view.MenuItem; import com.iven.lfflfeedreader.R; import com.iven.lfflfeedreader.domparser.RSSFeed; @SuppressLint("InlinedApi") public class ArticleActivity extends FragmentActivity { RSSFeed feed; int pos; private DescAdapter adapter; private ViewPager pager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.detail); ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); // Get the feed object and the position from the Intent feed = (RSSFeed) getIntent().getExtras().get("feed"); pos = getIntent().getExtras().getInt("pos"); // Initialize the views adapter = new DescAdapter(getSupportFragmentManager()); pager = (ViewPager) findViewById(R.id.pager); // Set Adapter to pager: pager.setAdapter(adapter); pager.setCurrentItem(pos); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: finish(); return true; } return super.onOptionsItemSelected(item); } public class DescAdapter extends FragmentStatePagerAdapter { public DescAdapter(FragmentManager fm) { super(fm); } @Override public int getCount() { return feed.getItemCount(); } @Override public Fragment getItem(int position) { ArticleFragment frag = new ArticleFragment(); Bundle bundle = new Bundle(); bundle.putSerializable("feed", feed); bundle.putInt("pos", position); frag.setArguments(bundle); return frag; } } }