簡體   English   中英

android當我在另一個活動時如何啟動主要活動

[英]android how to start the main activity when I am on another activity

我正在signin活動,如果用戶點擊按鈕,我想開始主要活動。 這是主要活動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>

我試過這樣的

Intent welcomeIntent =new Intent("android.intent.action.MAIN");
        startActivity(welcomeIntent);

但我有一個屏幕說complete acting using與許多choese一起complete acting using ,什么是解決方案pelase?

改變你的意圖直接啟動你的課程

Intent welcomeIntent = new Intent(context, Welcome.class);
startActivity(welcomeIntent);

如果您正在使用this活動替換context

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM