使用sherlock操作栏时classNotFoundexception

时间:2012-06-29 12:09:11

标签: android classnotfoundexception

我一直在尝试在我的应用程序中使用sherlockActionBar,但是我尝试在ny设备或2.3模拟器上运行它时会遇到异常。

这是Tabs_ICS.java代码

    package com.karriapps.tehilim;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;

import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.ActionBar.Tab;
import com.actionbarsherlock.app.SherlockActivity;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;

public class Tabs_ICS extends SherlockActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.main_ics);

        ActionBar ab = getSupportActionBar();
        ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

        ActionBar.Tab mainTab = ab.newTab().setText(R.string.quick).setTabListener(new mListener(new QuickAccessIcs()));
        ab.addTab(mainTab, true);

        ActionBar.Tab booksTab = ab.newTab().setText(R.string.chap).setTabListener(new mListener(new Books_ICS()));
        ab.addTab(booksTab);

        ActionBar.Tab weekTab = ab.newTab().setText(R.string.week).setTabListener(new mListener(new Week_ICS()));
        ab.addTab(weekTab);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {

        MenuInflater in = getSupportMenuInflater();
        in.inflate(R.menu.main_menu, menu);

        return super.onCreateOptionsMenu(menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {

        startActivity(new Intent(Tabs_ICS.this, Preferences.class));

        return super.onOptionsItemSelected(item);
    }
}

class mListener implements ActionBar.TabListener
{
    private Fragment fragment;
    public mListener(Fragment fragment)
    {
        this.fragment = fragment;
    }

    @Override
    public void onTabSelected(Tab tab,
            FragmentTransaction ft) {
        ft.replace(R.id.fragment_container, fragment);
    }

    @Override
    public void onTabUnselected(Tab tab,
            FragmentTransaction ft) {

        ft.remove(fragment);
    }

    @Override
    public void onTabReselected(Tab tab,
            FragmentTransaction ft) {
    }

}

我在这里做错了什么? 提前谢谢

0 个答案:

没有答案