[英]loading one activity whilst having multiple activities
So i am creating an application right now on Android studio. 因此,我现在正在Android Studio上创建一个应用程序。 I have two activities which are my 'Main activity' and also my 'second activity' I have finished with my 'Main activity' and i am now creating my second. 我有两个活动,分别是我的“主要活动”和“第二个活动”,我已经完成了“主要活动”,现在正在创建第二个活动。 I haven't yet created an action which will let me go from my first activity to my second. 我尚未创建可让我从第一次活动转到第二次活动的动作。 However i wish to only load my second activity to check how it looks. 但是,我只想加载第二项活动以检查其外观。
I am using a samsung phone to load it because i dont know too much about this emulator stuff, so i went with the option of using my samsung phone. 我正在使用三星手机来加载它,因为我对这个模拟器的东西不太了解,所以我选择了使用三星手机。 Is there a way of loading just my second activity without it loading my first? 有没有办法只加载我的第二个活动而不加载我的第一个活动?
Thank you :) 谢谢 :)
You should edit the AndroidManifest
: 您应该编辑AndroidManifest
:
Remove these lines from the MainActivity
从MainActivity
删除这些行
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Then add your new SecondActivity
if you have already added in manifest then edit it to look like this : 然后,如果您已经添加了清单,则添加新的SecondActivity
然后将其编辑为如下所示:
<activity
android:name=".SecondActivity"
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
This will make the SecondActivity
as launcher activity (started on click of an icon in app list). 这会将SecondActivity
作为启动程序活动(从单击应用程序列表中的图标开始)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.