Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to run the example of ViewPager on Android developer site?
    primarykey
    data
    text
    <p>When I try to run the example with <a href="https://developer.android.com/reference/android/support/v4/view/ViewPager.html" rel="nofollow noreferrer">https://developer.android.com/reference/android/support/v4/view/ViewPager.html</a> on Eclipse,the emulator was display a error dialog . <br>Here is the LogCat:<br> <img src="https://i.stack.imgur.com/WreUj.png" alt="enter image description here"></p> <p>I just don't know why it can't run.I build the project and copy the example code in Eclipse,I also set the Android API level with 11.And it seem all is ok. <br><br> When I double click the last but one line of the LogCat:<br></p> <pre><code>at com.lanz.xbp2v4.ActionBarTabsPage.onCreate.java:37 </code></pre> <p>it redirect to the code which included in onCreate method :<br></p> <pre><code>bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); </code></pre> <p><br>So I think it may something wrong in this part of code,hope that someone can help me!XD</p> <p>the code in onCreate method:</p> <pre><code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mViewPager = new ViewPager(this); mViewPager.setId(R.id.pager); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(mViewPager); // Full Screen getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); final ActionBar bar = getActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE); mTabsAdapter = new TabsAdapter(this, mViewPager); mTabsAdapter.addTab(bar.newTab().setText("Simple").setTabListener((TabListener) this), IndexTab.class, null); mTabsAdapter.addTab(bar.newTab().setText("List").setTabListener((TabListener) this), Tab2.class, null); mTabsAdapter.addTab(bar.newTab().setText("Cursor").setTabListener((TabListener) this), Tab3.class, null); if (savedInstanceState != null) { bar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0)); } } </code></pre> <hr> <p>I has fixed the problem above,but it still can't work.At this time I run the example app,the LogCat show:<br> <img src="https://i.stack.imgur.com/2CDGm.png" alt="enter image description here"></p> <p>it redirect to the code which included in <code>getItem()</code> method :<br></p> <pre><code> @Override public Fragment getItem(int position) { TabInfo info = mTabs.get(position); Fragment fragment=Fragment.instantiate(mContext, info.clss.getName(), info.args); return fragment; } </code></pre> <p>Is anyone can run the example code with <a href="http://developer.android.com/reference/android/support/v4/view/ViewPager.html" rel="nofollow noreferrer">Android developer ViewPager</a>?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload