简体   繁体   English

android当我在另一个活动时如何启动主要活动

[英]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.

相关问题 广播调用另一个活动时,Android启动主要活动 - Android start main activity when another activity is called by broadcast (Android)如何在开始新活动并再次重新启动主活动listview活动时保存活动数据(Listview) - (Android) How to Save activity Data (Listview)when start new activity and restart again main activity listview activity 如何在Android中的另一个活动中启动活动? - How to start activity in another activity in android? 在开始主要活动时在后台开始另一个活动 - Start another activity in background on start of main activity 单击 main.xml 中定义的按钮时如何启动另一个活动 - How do I start another activity when a button defined in main.xml is clicked 我从主要活动开始了另一项活动,但该方法不起作用 - I have start another activity from main activity but the method not working 在Android活动测试中,如何完成我的主要活动开始的另一项活动? - From within an android activity test, how do I finish another activity that my main activity started? 在 Android 中的另一个活动中开始活动 - Start activity in another activity in Android 如何在不加载主活动的情况下启动另一个活动? - How start another activity without load main activity? 意图服务停止时如何在主要活动中启动功能? - How i start a function in main activity when intent service stop?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM