this simple threading is not working cann't find the errors help please...
i want to show my splash.xml for 6 sec and then activity_main.xml but it not showing the activity_main.xml ......
What I have tried:
my splash.java code:
package com.example.ne;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class splash extends Activity{
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
Thread timer = new Thread()
{
public void run(){
try{
sleep(6000);
} catch(InterruptedException e){
e.printStackTrace();
}finally{
Intent open =new Intent("com.example.ne.MAINACTIVITY");
startActivity(open);
}
}
};
timer.start();
}
}
and mainactivity.java code:
package com.example.ne;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class MainActivity extends Activity {
int counter;
Button add,sub;
TextView display;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
counter=0;
add=(Button) findViewById(R.id.bAdd);
sub=(Button)findViewById(R.id.bSub);
display=(TextView)findViewById(R.id.tvdisplay);
add.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
counter++;
display.setText("Your total is" + counter);
}
});
sub.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
counter--;
display.setText("Your total is" + counter);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
and manifest.xml code:
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
package="com.example.ne"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk>
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application>
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity>
android:name="com.example.ne.splash"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN">
<category android:name="android.intent.category.LAUNCHER">
<application>
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity>
android:name=".MainActivity" android:label="@string/app_name" >
<intent-filter>
<action android:name="com.example.ne.MAINACTIVITY">
<category android:name="android.intent.category.DEFAULT">