「Android/kotlin/画面遷移」の版間の差分
提供: 初心者エンジニアの簡易メモ
(ページの作成:「==画面遷移== import android.content.Intent val intent = Intent(this@MainActivity, SubActivity::class.java) startActivity(intent)」) |
(→画面遷移) |
||
(同じ利用者による、間の1版が非表示) | |||
行3: | 行3: | ||
val intent = Intent(this@MainActivity, SubActivity::class.java) | val intent = Intent(this@MainActivity, SubActivity::class.java) | ||
startActivity(intent) | startActivity(intent) | ||
+ | |||
+ | AndroidManifest.xmlにSubActivityを追加 | ||
+ | <pre> | ||
+ | <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> | ||
+ | </pre> |
2020年8月6日 (木) 12:23時点における最新版
画面遷移
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>