Android Apps not working in emulator

Posted by Mohit Deshpande on Stack Overflow See other posts from Stack Overflow or by Mohit Deshpande
Published on 2010-05-05T21:49:23Z Indexed on 2010/05/06 0:58 UTC
Read the original article Hit count: 448

Filed under:
|
|

None of my apps work in the emulator. I am running Ubuntu 9.10 and everytime I try to access my UI, the app crashes. All I get is an "Sorry! The application ... has stopped unexpectedly". For EVERY app this happens.

package com.mohit.helloandroid;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;

public class HelloAndroid extends TabActivity {

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        Resources res = getResources();     //Resource object to get drawables
        TabHost tabHost = getTabHost();     //The activity tabhost
        TabHost.TabSpec spec;           //Reusable tab spec 
        Intent intent;

        intent = new Intent().setClass(this, HelloAndroid.class);

        spec = tabHost.newTabSpec("artists").setIndicator("Artists", res
            .getDrawable(R.drawable.tab_artists))
                .setContent(intent);
        tabHost.addTab(spec);
    }
}

I don't know how this code could possibly throw a message like that.

© Stack Overflow or respective owner

Related posts about android

Related posts about java