我有这个源代码:

package com.ciubotariu.stiaticav1;

/*
 * Copyright (C) 2011 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.util.Random;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.app.SherlockListFragment;


public class MainActivity extends SherlockFragmentActivity {
    static final int NUM_ITEMS = 550;

    MyAdapter mAdapter;

    ViewPager mPager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);


        //requestWindowFeature(Window.FEATURE_NO_TITLE);
       // getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
               // WindowManager.LayoutParams.FLAG_FULLSCREEN);
        //getSupportActionBar().setDisplayShowTitleEnabled(false);
        //getSupportActionBar().setDisplayShowHomeEnabled(false);
      //  setContentView(R.layout.fragment_pager);

        mAdapter = new MyAdapter(getSupportFragmentManager());

        mPager = (ViewPager)findViewById(R.id.pager);
        mPager.setAdapter(mAdapter);

        // Watch for button clicks.
        Button button = (Button)findViewById(R.id.goto_first);
//        button.getBackground().setColorFilter(0xFF0174DF, PorterDuff.Mode.MULTIPLY);
        button.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                mPager.setCurrentItem(0);
            }
        });
        button = (Button)findViewById(R.id.goto_last);
        button.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                 mPager.setCurrentItem(NUM_ITEMS-1);
            }
        });

        button = (Button)findViewById(R.id.goto_random);
        button.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {

                Random r = new Random();
                int i1=r.nextInt(529)+20;
                mPager.setCurrentItem(i1);
            }
        });

        button = (Button)findViewById(R.id.goto_about);
        button.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {

             Toast.makeText(MainActivity.this, "Ciuboariu Florin, Ianuarie 2013", Toast.LENGTH_SHORT).show();
            }
        });
    }

    public static class MyAdapter extends FragmentPagerAdapter {
        public MyAdapter(FragmentManager fm) {
            super(fm);
        }

        @Override
        public int getCount() {
            return NUM_ITEMS;
        }

        @Override
        public Fragment getItem(int position) {
            return ArrayListFragment.newInstance(position);
        }
    }

    public static class ArrayListFragment extends SherlockListFragment {
        int mNum;

        /**
         * Create a new instance of CountingFragment, providing "num"
         * as an argument.
         */
        static ArrayListFragment newInstance(int num) {
            ArrayListFragment f = new ArrayListFragment();

            // Supply num input as an argument.
            Bundle args = new Bundle();
            args.putInt("num", num);
            f.setArguments(args);

            return f;
        }

        /**
         * When creating, retrieve this instance's number from its arguments.
         */

        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
//            Random r = new Random();
//          int i1=r.nextInt(70-1)+1;
//            mNum = i1;
            mNum = getArguments() != null ? getArguments().getInt("num") : 1;
        }

        /**
         * The Fragment's UI is just a simple text view showing its
         * instance number.
         */

        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                Bundle savedInstanceState) {
            //View v = inflater.inflate(R.layout.fragment_pager_list, container, false);
            //View tv = v.findViewById(R.id.text2);
           // switch(mNum){
            //IMENSE HERE- deleted
            //}
           // return v;

            View v = inflater.inflate(R.layout.fragment_pager_list, container, false);
            View tv = v.findViewById(R.id.text2);
            ((TextView)tv).setText("Fragment #" + mNum);
            return v;
        }


        @Override
       public void onActivityCreated(Bundle savedInstanceState) {
           super.onActivityCreated(savedInstanceState);

      }


        @Override
        public void onListItemClick(ListView l, View v, int position, long id) {
            Log.i("FragmentList", "Item clicked: " + id);
        }
    }
}

我得到那些错误:
05-31 19:36:43.219: W/dalvikvm(11094): Unable to resolve superclass of Lcom/ciubotariu/stiaticav1/MainActivity; (537)
05-31 19:36:43.219: W/dalvikvm(11094): Link of class 'Lcom/ciubotariu/stiaticav1/MainActivity;' failed
05-31 19:36:43.219: W/dalvikvm(11094): threadid=1: thread exiting with uncaught exception (group=0x40018560)
05-31 19:36:43.229: E/AndroidRuntime(11094): FATAL EXCEPTION: main
05-31 19:36:43.229: E/AndroidRuntime(11094): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.ciubotariu.stiaticav1/com.ciubotariu.stiaticav1.MainActivity}: java.lang.ClassNotFoundException: com.ciubotariu.stiaticav1.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.ciubotariu.stiaticav1-1.apk]
05-31 19:36:43.229: E/AndroidRuntime(11094):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1575)
05-31 19:36:43.229: E/AndroidRuntime(11094):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1669)
05-31 19:36:43.229: E/AndroidRuntime(11094):    at android.app.ActivityThread.access$1500(ActivityThread.java:117)
05-31 19:36:43.229: E/AndroidRuntime(11094):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
05-31 19:36:43.229: E/AndroidRuntime(11094):    at android.os.Handler.dispatchMessage(Handler.java:99)
05-31 19:36:43.229: E/AndroidRuntime(11094):    at android.os.Looper.loop(Looper.java:130)
05-31 19:36:43.229: E/AndroidRuntime(11094):    at android.app.ActivityThread.main(ActivityThread.java:3737)
05-31 19:36:43.229: E/AndroidRuntime(11094):    at java.lang.reflect.Method.invokeNative(Native Method)
05-31 19:36:43.229: E/AndroidRuntime(11094):    at java.lang.reflect.Method.invoke(Method.java:507)
05-31 19:36:43.229: E/AndroidRuntime(11094):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:894)
05-31 19:36:43.229: E/AndroidRuntime(11094):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:652)
05-31 19:36:43.229: E/AndroidRuntime(11094):    at dalvik.system.NativeStart.main(Native Method)
05-31 19:36:43.229: E/AndroidRuntime(11094): Caused by: java.lang.ClassNotFoundException: com.ciubotariu.stiaticav1.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.ciubotariu.stiaticav1-1.apk]
05-31 19:36:43.229: E/AndroidRuntime(11094):    at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
05-31 19:36:43.229: E/AndroidRuntime(11094):    at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
05-31 19:36:43.229: E/AndroidRuntime(11094):    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
05-31 19:36:43.229: E/AndroidRuntime(11094):    at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
05-31 19:36:43.229: E/AndroidRuntime(11094):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1567)
05-31 19:36:43.229: E/AndroidRuntime(11094):    ... 11 more
05-31 19:36:43.239: E/AndroidRuntime(11094): [Blue Error Handler] Make Debugging Report file for main
05-31 19:36:43.239: E/AndroidRuntime(11094): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.ciubotariu.stiaticav1/com.ciubotariu.stiaticav1.MainActivity}: java.lang.ClassNotFoundException: com.ciubotariu.stiaticav1.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.ciubotariu.stiaticav1-1.apk]
05-31 19:36:43.239: E/AndroidRuntime(11094):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1575)
05-31 19:36:43.239: E/AndroidRuntime(11094):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1669)
05-31 19:36:43.239: E/AndroidRuntime(11094):    at android.app.ActivityThread.access$1500(ActivityThread.java:117)
05-31 19:36:43.239: E/AndroidRuntime(11094):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
05-31 19:36:43.239: E/AndroidRuntime(11094):    at android.os.Handler.dispatchMessage(Handler.java:99)
05-31 19:36:43.239: E/AndroidRuntime(11094):    at android.os.Looper.loop(Looper.java:130)
05-31 19:36:43.239: E/AndroidRuntime(11094):    at android.app.ActivityThread.main(ActivityThread.java:3737)
05-31 19:36:43.239: E/AndroidRuntime(11094):    at java.lang.reflect.Method.invokeNative(Native Method)
05-31 19:36:43.239: E/AndroidRuntime(11094):    at java.lang.reflect.Method.invoke(Method.java:507)
05-31 19:36:43.239: E/AndroidRuntime(11094):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:894)
05-31 19:36:43.239: E/AndroidRuntime(11094):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:652)
05-31 19:36:43.239: E/AndroidRuntime(11094):    at dalvik.system.NativeStart.main(Native Method)
05-31 19:36:43.239: E/AndroidRuntime(11094): Caused by: java.lang.ClassNotFoundException: com.ciubotariu.stiaticav1.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.ciubotariu.stiaticav1-1.apk]
05-31 19:36:43.239: E/AndroidRuntime(11094):    at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
05-31 19:36:43.239: E/AndroidRuntime(11094):    at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
05-31 19:36:43.239: E/AndroidRuntime(11094):    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
05-31 19:36:43.239: E/AndroidRuntime(11094):    at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
05-31 19:36:43.239: E/AndroidRuntime(11094):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1567)
05-31 19:36:43.239: E/AndroidRuntime(11094):    ... 11 more

它在启动时崩溃。

最佳答案

您可能忘记了在AndroidManifest.xml文件中声明MainActivity。

07-24 09:32