我正在调试我的应用程序,由于某种原因,它无法将应用程序加载到我的智能手机。
我不知道为什么会这样。它表明没有发起任何骚扰和成功,但没有任何反应。
这是活动
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);
}
}
这是清单
<?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>
最佳答案
这是因为您的Android清单中没有声明任何启动的活动。
在您的android清单中进行以下更改,它将起作用。
<activity android:name=". Main2Activity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
关于android - 为什么该应用程序无法在我的手机上运行?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/38160269/