Android/kotlin/画面遷移
提供: 初心者エンジニアの簡易メモ
画面遷移
import android.content.Intent val intent = Intent(this@MainActivity, SubActivity::class.java) startActivity(intent)
AndroidManifest.xmlにSubActivityを追加
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="jp.co.example.project1"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".SubActivity" android:label="@string/title_activity" android:parentActivityName=".MainActivity"> </activity>