๊ด€๋ฆฌ ๋ฉ”๋‰ด

JiYoung Dev ๐Ÿ–ฅ

[Android] android studio ๋กœ๋”ฉ ํ™”๋ฉด ์„ค์ • (2023.07.26) ๋ณธ๋ฌธ

full stack/์•ˆ๋“œ๋กœ์ด๋“œ

[Android] android studio ๋กœ๋”ฉ ํ™”๋ฉด ์„ค์ • (2023.07.26)

Shinjio 2023. 7. 26. 09:52

Handler ์‚ฌ์šฉ

 

package com.sjy.fragment

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.os.Handler

class IntroActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_intro)

        val handler = Handler()
        //postDelayed(๋ญ˜ํ• ๊ฑด์ง€(action), ๋”œ๋ ˆ์ด์‹œ๊ฐ„(ms))
        handler.postDelayed({
            //Intro ํ™”๋ฉด์ด ๋ณด์ด๊ณ  3์ดˆ ๋’ค์— MainActivity๋กœ ์ „ํ™˜ (Intent ์‚ฌ์šฉ)
            var intent = Intent(this, MainActivity::class.java)
            startActivity(intent)
        }, 3000)
    }
}

 

 

manifest์—์„œ ์ฒซ ํ™”๋ฉด์œผ๋กœ introActivity๊ฐ€ ๋ณด์ด๋„๋ก ์„ค์ •

 

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.Fragment"
        android:usesCleartextTraffic="true"
        tools:targetApi="31">
        <activity
            android:name=".IntroActivity"
            android:exported="true" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        </activity>
        <activity
            android:name=".MainActivity"
            android:exported="false"><!--exported ๋ฐ”๋กœ ์‹คํ–‰ ์†์„ฑ-->
        </activity>
    </application>

</manifest>