diff --git a/app/src/main/java/com/example/cosmosclient/app/Cosmos.java b/app/src/main/java/com/example/cosmosclient/app/Cosmos.java index ede712b..d5c271d 100644 --- a/app/src/main/java/com/example/cosmosclient/app/Cosmos.java +++ b/app/src/main/java/com/example/cosmosclient/app/Cosmos.java @@ -5,6 +5,7 @@ import com.example.cosmosclient.entities.AreaInformation; import com.example.cosmosclient.entities.Group; import com.example.cosmosclient.entities.Location; +import android.content.SharedPreferences; import java.util.HashMap; @@ -19,10 +20,15 @@ //token処理 public void setToken(String token){ - this.token = token; + SharedPreferences prefData = getSharedPreferences("pref_data", MODE_PRIVATE); + SharedPreferences.Editor editor = prefData.edit(); + editor.putString("token", token); + editor.commit(); } public String getToken(){ + SharedPreferences prefData = getSharedPreferences("pref_data", MODE_PRIVATE); + String token = prefData.getString("token", ""); return token; } @@ -50,10 +56,15 @@ //uId処理 public void setuId(String uId){ - this.uId = uId; + SharedPreferences prefData = getSharedPreferences("pref_data", MODE_PRIVATE); + SharedPreferences.Editor editor = prefData.edit(); + editor.putString("uId", uId); + editor.commit(); } public String getuId(){ + SharedPreferences prefData = getSharedPreferences("pref_data", MODE_PRIVATE); + String uId = prefData.getString("uId", ""); return uId; }