-1

This is my splash screen activity im trying to display a particular image for a period of time and when it is supposed to go to the second class it gives me an error as no classdeffounderror

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layoutt1);
mSplashThread = new Thread() {
        @Override
        public void run() {

            try {
                while (shouldContinue) {

                    synchronized (this) {
                        // Wait given period of time or exit on touch
                        wait(5000);
                        shouldContinue = false;

                    }
                }
            } catch (InterruptedException ex) {
            } finally {
                finish();

                // Run next activity
                Intent intent = new Intent(getApplicationContext(),MainActivity.class);
                startActivity(intent);
                shouldContinue = false;

                // stop();
            }

        }
    };

    mSplashThread.start();

}

My logcat shows

06-10 14:38:00.450: E/AndroidRuntime(5853): java.lang.NoClassDefFoundError: com.bara.fol.MainActivity

Could not find class 'com.bara.fol.MainActivity', referenced from method com.bara.fol.Main$1.run

and this is my manifest.xml present inside the application tag.

    <activity
        android:name=".Main"
        android:label="@string/title_activity_main" >
        <intent-filter
            android:label="@string/app_name"
            >
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".MainActivity" ></activity>
jayeshkv
  • 2,180
  • 4
  • 24
  • 42

5 Answers5

2

First of all you are using finish before start intent, it should be written after startintent call and as you said you are using a library follow these steps and clean your project:

project right click properties-> Java BuildPath select Library and add external .jar the follow these step.

Go to Project->Properties->Java Build Path than select Order and export tab. Set external .jar library checked and up it into top of the list. And clean and rebuild.

skygeek
  • 1,548
  • 11
  • 24
0

Try Following code for splash screen...It's work for me

new Handler().postDelayed(new Runnable() 

        {
            @Override
            public void run() 
            {
                final Intent mainIntent = new Intent(StartActivity.this, SecondActivity.class);
                StartActivity.this.startActivity(mainIntent);
                StartActivity.this.finish();
            }
        }, 1000);
No_Rulz
  • 2,679
  • 1
  • 20
  • 33
Vasu
  • 886
  • 2
  • 11
  • 28
0

Paste your external jar in libs directory and then give path from your libs directory right click on project-->properties-->java build path-->add external jar's-->select your libs directory

No_Rulz
  • 2,679
  • 1
  • 20
  • 33
-1

I think you did not declare the Activity in the manifest.xml.

-1

In the manifest, you have declared ".Main" instead of ".MainActivity"

npace
  • 4,218
  • 1
  • 25
  • 35