1

I'm debugging my app and for some reason it does not load the app to my smartphone. i have no idea why it happenes. it shows that there are no earrors and succsessfull launched, but nothing happenes.

This is the activity

public class TabHostMain extends TabActivity {

TabHost tabHost;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_tab_host_main);


    tabHost = getTabHost();

    TabHost.TabSpec ts1 = tabHost.newTabSpec("main");
    ts1.setIndicator("Main");
    ts1.setContent(new Intent(this, Main.class));
    tabHost.addTab(ts1);

    TabHost.TabSpec ts2 = tabHost.newTabSpec("GPS");
    ts2.setIndicator("GPS");
    ts2.setContent(new Intent(this, GPS.class));
    tabHost.addTab(ts2);


    TabHost.TabSpec ts3 = tabHost.newTabSpec("Info");
    ts3.setIndicator("Info");
    ts3.setContent(new Intent(this, Info.class));
    tabHost.addTab(ts3);

}

}

this is the manifest

   <?xml version="1.0" encoding="utf-8"?>

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".Main" />
    <activity android:name=".GPS" />
    <activity android:name=".Info" />
    <activity android:name=".TabHostMain"/>
    <activity android:name=".Main2Activity"></activity>

</application>

Bolandian Eran
  • 211
  • 1
  • 4
  • 21

2 Answers2

1

This is because there is no launched activity declared in your Android Manifest.

Make the following change in your android manifest and it will work.

<activity android:name=". Main2Activity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
 </activity>
Arpit Ratan
  • 2,976
  • 1
  • 12
  • 20
1

The reason this is happening is because you don't have any launcher and main activity declared in your manifest file, add this intent tag to one of the activites in the manifest file and it will work, you should do something like this :

<activity android:name=".Main">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

Read more about these intent filters here.

Community
  • 1
  • 1
Ashish Ranjan
  • 5,523
  • 2
  • 18
  • 39