Android Generally Just Breaks
<p>I have been playing around with an android application and just restarted to code it again, to see what I can remember off the top of my head. The problem is, I have completely broken the application and don't understand why.</p>

<p>The application will load for a little bit, and display some form of layout (which aren't any of the defined ones) and then crash.</p>

<p>Here are some bits of code, let me know if you need to see anything else:</p>

<p>The manifest:
    </p>

<pre><code>    &lt;uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="16" /&gt;

    &lt;application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme"&gt;

        &lt;activity android:name="org.mjth.online_sn.main" android:label="@string/app_name"&gt;
            &lt;intent-filter&gt;
                &lt;action android:name="android.intent.action.MAIN" /&gt;
                &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
            &lt;/intent-filter&gt;
        &lt;/activity&gt;

        &lt;activity android:name="org.mjth.online_sn.live" android:label="@string/app_name"&gt;&lt;/activity&gt;
        &lt;activity android:name="org.mjth.online_sn.login_form" android:label="@string/app_name"&gt;&lt;/activity&gt;

    &lt;/application&gt;

&lt;/manifest&gt;
</code></pre>

<p>Main.java</p>

<pre><code>import java.util.EmptyStackException;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.os.Bundle;

//Will do the default setup and checks
public class main extends Activity {

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

        //Locks screen orientation to portrait for now
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

        //Checks to see if we have valid authorisation keys and files
        SharedPreferences pref = getSharedPreferences("org.mjth.online_sn", MODE_PRIVATE);

        try{

            if(pref.getString("auth_id", "").equals("") == false){
                throw new EmptyStackException();
            }

            if(pref.getString("auth_pass", "").equals("") == false){
                throw new EmptyStackException();
            }

            if(pref.getString("lcl_first_name", "").equals("") == false){
                throw new EmptyStackException();
            }

            if(pref.getString("lcl_last_name", "").equals("") == false){
                throw new EmptyStackException();
            }

            if(pref.getString("lcl_expiry", "").equals("") == false){
                throw new EmptyStackException();
            }

            //TODO: Check if expiry is past todays date.

            //We passed all local checks, set view to live and double check on background
            Intent myIntent = new Intent(getApplicationContext(), live.class);
            startActivityForResult(myIntent, 0);
        }catch (EmptyStackException e){
            //No valid credentials were found.
            Intent myIntent = new Intent(getApplicationContext(), login_form.class);
            startActivityForResult(myIntent, 0);
        }


    }



}
</code></pre>

<p>login_form.java</p>

<pre><code>import org.mjth.online_sn.R;

import android.app.Activity;
import android.os.Bundle;

public class login_form extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.login_form);
    }
}
</code></pre>

<p>live.java</p>

<pre><code>import org.mjth.online_sn.R;

import android.app.Activity;
import android.os.Bundle;

public class live extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.live);
    }
}
</code></pre>

<p><strong>Update:</strong> When disabling the action intent code I get the following error:</p>

<pre><code>12-12 22:58:49.653: E/AndroidRuntime(1930): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.mjth.online_sn/org.mjth.online_sn.main}: java.lang.ClassNotFoundException: org.mjth.online_sn.main
12-12 22:58:49.653: E/AndroidRuntime(1930):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2024)
12-12 22:58:49.653: E/AndroidRuntime(1930):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
12-12 22:58:49.653: E/AndroidRuntime(1930):     at android.app.ActivityThread.access$600(ActivityThread.java:140)
12-12 22:58:49.653: E/AndroidRuntime(1930):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
12-12 22:58:49.653: E/AndroidRuntime(1930):     at android.os.Handler.dispatchMessage(Handler.java:99)
12-12 22:58:49.653: E/AndroidRuntime(1930):     at android.os.Looper.loop(Looper.java:137)
12-12 22:58:49.653: E/AndroidRuntime(1930):     at android.app.ActivityThread.main(ActivityThread.java:4898)
12-12 22:58:49.653: E/AndroidRuntime(1930):     at java.lang.reflect.Method.invokeNative(Native Method)
12-12 22:58:49.653: E/AndroidRuntime(1930):     at java.lang.reflect.Method.invoke(Method.java:511)
12-12 22:58:49.653: E/AndroidRuntime(1930):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
12-12 22:58:49.653: E/AndroidRuntime(1930):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
12-12 22:58:49.653: E/AndroidRuntime(1930):     at dalvik.system.NativeStart.main(Native Method)
12-12 22:58:49.653: E/AndroidRuntime(1930): Caused by: java.lang.ClassNotFoundException: org.mjth.online_sn.main
12-12 22:58:49.653: E/AndroidRuntime(1930):     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
12-12 22:58:49.653: E/AndroidRuntime(1930):     at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
12-12 22:58:49.653: E/AndroidRuntime(1930):     at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
12-12 22:58:49.653: E/AndroidRuntime(1930):     at android.app.Instrumentation.newActivity(Instrumentation.java:1057)
12-12 22:58:49.653: E/AndroidRuntime(1930):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2015)
12-12 22:58:49.653: E/AndroidRuntime(1930):     ... 11 more
</code></pre>
