teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

説明を追加しました。

2020/08/26 07:25

投稿

android_app_tw
android_app_tw

スコア4

title CHANGED
File without changes
body CHANGED
@@ -1,5 +1,7 @@
1
- 現在、Android Studioで、入力フォームアプリを開発しています。
1
+ 現在、Android Studioで、年齢と名前を入力するアプリを開発しています。
2
- 入力フォームに入力されたテキストを、アプリを閉じても維持したいと考えています。
2
+ 入力フォームに入力された年齢と名前を、アプリを閉じて、その後アプリを再起動させた際に、閉じる前に入力したテキストを表示させたままにしたいと考えています。
3
+ ボタンを押して、テキストを保存するところまでできたのですが、その後の処理の仕方がいまいちわかりません。
4
+ どのような形でも良いので、その後のプログラムを教えていただけると幸いです。
3
5
  今できているプログラムは、こちらです。
4
6
  MainActivity
5
7
  package com.example.sample1;
@@ -50,5 +52,53 @@
50
52
  }
51
53
  }
52
54
 
55
+ Activity_main
56
+ <TextView
57
+ android:paddingTop="5dp"
58
+ android:paddingLeft="5dp"
59
+ android:id="@+id/text3"
60
+ android:layout_width="match_parent"
61
+ android:layout_height="wrap_content"
62
+ app:layout_constraintLeft_toLeftOf="parent"
63
+ app:layout_constraintRight_toRightOf="parent"
64
+ app:layout_constraintTop_toBottomOf="@+id/edit_text"
65
+ android:text="年齢"
66
+ />
67
+ <EditText
68
+ android:id="@+id/edit_text2"
69
+ android:layout_width="match_parent"
70
+ android:layout_height="40dp"
71
+ app:layout_constraintLeft_toLeftOf="parent"
72
+ app:layout_constraintRight_toRightOf="parent"
73
+ app:layout_constraintTop_toBottomOf="@+id/text3"
74
+ android:inputType="number"
75
+ android:background="@drawable/edittext_flame"
76
+ android:hint="20"
77
+ android:paddingLeft="5dp"
78
+ />
79
+ <TextView
80
+ android:paddingTop="5dp"
81
+ android:paddingLeft="5dp"
82
+ android:id="@+id/text4"
83
+ android:layout_width="match_parent"
84
+ android:layout_height="wrap_content"
85
+ app:layout_constraintLeft_toLeftOf="parent"
86
+ app:layout_constraintRight_toRightOf="parent"
87
+ app:layout_constraintTop_toBottomOf="@+id/edit_text2"
88
+ android:text="氏名"
89
+ />
90
+ <EditText
91
+ android:id="@+id/edit_text3"
92
+ android:layout_width="match_parent"
93
+ android:layout_height="40dp"
94
+ app:layout_constraintLeft_toLeftOf="parent"
95
+ app:layout_constraintRight_toRightOf="parent"
96
+ app:layout_constraintTop_toBottomOf="@+id/text4"
97
+ android:inputType="text"
98
+ android:background="@drawable/edittext_flame"
99
+ android:hint="山田太郎"
100
+ android:paddingLeft="5dp"
101
+ />
102
+
53
103
  何か解決方法があればぜひ教えていただきたいです。
54
104
  また、追加するプログラムはできる限りすべて載せていただければ幸いです。