[英]android how to start the main activity when I am on another activity
I am on signin
activity and if the user click a button I want to start the main activity. 我正在signin
活动,如果用户点击按钮,我想开始主要活动。 this is the mainfest for the main activity welcome
这是主要活动welcome
的主要活动
<activity
android:name=".Welcome"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
I tried like this 我试过这样的
Intent welcomeIntent =new Intent("android.intent.action.MAIN");
startActivity(welcomeIntent);
but i got a screen saying complete acting using
with many choese , what is the solution pelase? 但我有一个屏幕说complete acting using
与许多choese一起complete acting using
,什么是解决方案pelase?
Change your intent to directly launch your class 改变你的意图直接启动你的课程
Intent welcomeIntent = new Intent(context, Welcome.class);
startActivity(welcomeIntent);
If you're in an activity replace context
with this
如果您正在使用this
活动替换context
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.