I am just starting android development so please bear with me.
My issue is that when I run my app in the emulator, after my splash screen, the next screen that pops up is from a completely different app than the one I am working in. Both screens conflicting are named the same (main.xml) so that may have something to do with it but they are in completely different folders and workspaces. I have been trying to experiment with my code to stop the screen after my splash screen from showing up completely so I could have a better idea of where the problem is occurring but have been unsuccessful.
Does anyone have any idea what might be going wrong or where I should at least start to look to solve this problem?
files in eclipse: https://i.stack.imgur.com/wAKG1.jpg
Main Activity class:
package com.mwmnj.criticmatch;
import android.app.Activity;
import android.os.Bundle;
public class CriticMatchActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
main.xml:
<?xml version="1.0" encoding="utf-8" ?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:padding="20dp"
android:weightSum="1">
<TextView android:textAppearance="?android:attr/textAppearanceLarge"
android:id="@+id/textView1" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Hello!"
android:layout_gravity="center" />
<TextView android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/textView2" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="criticmatch">android:layout_gravity="center"></TextView>
<Button android:text="Proceed" android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/button1"
android:layout_marginTop="50dp" />
</LinearLayout>
Splash class:
package com.mwmnj.criticmatch;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class Splash extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
Thread timer = new Thread(){
public void run(){
try{
sleep(5000);
} catch (InterruptedException e){
e.printStackTrace();
}finally{
Intent openStartingPoint = new Intent("matt.meyer.criticmatch.MENU");
startActivity(openStartingPoint);
}
}
};
timer.start();
}
}
splash.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/crbackground"
>
</LinearLayout>
androidmanifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mwmnj.criticmatch"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".Splash"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".CriticMatchActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="com.mwmnj.criticmatch.CRITICMATCHACTIVITY"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
Your problem is here:
That’s pointing to some other app, as far as I can tell. Try this:
Using the action name should work, too, as long as it matches the name in the AndroidManifest.xml: