大马资讯论坛 - 马来西亚中文资讯平台

标题: [解决] Android ActionBar.Tab is not applicable for the arguments new Runnable [打印本页]

作者: 资讯王    时间: 2014-6-24 21:54
标题: [解决] Android ActionBar.Tab is not applicable for the arguments new Runnable
The method setTabListener(ActionBar.TabListener) in the type ActionBar.Tab is not applicable for the arguments (new Runnable(){})

Async onPostExecute 错误error
添加 setTabListener(new ActionBar.TabListener() 就能解决以上的error

  1. // For each of the sections in the app, add a tab to the action bar.
  2. for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) {
  3.         // Create a tab with text corresponding to the page title defined by
  4. // the adapter. Also specify this Activity object, which implements
  5. // the TabListener interface, as the callback (listener) for when
  6. // this tab is selected.
  7. actionBar.addTab(actionBar.newTab()
  8.         .setText(mSectionsPagerAdapter.getPageTitle(i))
  9.         .setTabListener(new ActionBar.TabListener() {
  10.                        
  11.                 @Override
  12.                 public void onTabSelected(ActionBar.Tab tab,
  13.                                 FragmentTransaction fragmentTransaction) {
  14.                         // When the given tab is selected, switch to the corresponding page in
  15.                         // the ViewPager.
  16.                         mViewPager.setCurrentItem(tab.getPosition());
  17.                 }
  18.                 @Override
  19.                 public void onTabUnselected(ActionBar.Tab tab,
  20.                                 FragmentTransaction fragmentTransaction) {
  21.                 }
  22.                 @Override
  23.                 public void onTabReselected(ActionBar.Tab tab,
  24.                                 FragmentTransaction fragmentTransaction) {
  25.                 }
  26.         }));
  27. }
复制代码





欢迎光临 大马资讯论坛 - 马来西亚中文资讯平台 (http://freeinfo.com.my/) Powered by Discuz! X3.3