Leider hat die App im Emulator aufgehört
Dies ist mein Hauptaktivitätsprogramm. Wenn ich diesen Code ausführe, zeigt der Emulator, dass die App leider stopprd hat. Bitte poste eine Lösung dafür. Vielen Dank im Voraus. Ich habe den Fehler für viele Anwendungen. Diese Antwort wird mir also helfen für alle verbleibenden Probleme zu überwinden ........
package com.example.tab;
import android.app.Activity;
import android.content.res.Resources;
import android.net.http.AndroidHttpClient;
import android.os.Bundle;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;
public class MainActivity extends Activity {
private TabSpec tspec;
private TabHost tabHost;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.activity_main);
tabHost=(TabHost)findViewById(R.id.my_tabhost);
tabHost.setup();
Resources res=getResources();
tspec=tabHost.newTabSpec("Tab1");
tspec.setContent(R.id.clock);
tspec.setIndicator("Clock");
tabHost.addTab(tspec);
tspec=tabHost.newTabSpec("Tab2");
tspec.setContent(R.id.calendar);
tspec.setIndicator("Calendar");
tabHost.addTab(tspec);
tspec=tabHost.newTabSpec("Tab3");
tspec.setContent(R.id.date);
tspec.setIndicator("Date");
tabHost.addTab(tspec);
}
Dies ist meine Manifest-Datei:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.tab"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="12"
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.tab.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>