public class InfoClient extends RealmObject implements Parcelable { @PrimaryKey @SerializedName("id") private String id; @SerializedName("phone") private String phone; @SerializedName("dop_phone") private String dopPhone; @SerializedName("email") private String email; @SerializedName("name") private String name; @SerializedName("city") private String city; @SerializedName("address") private String address; @SerializedName("user_type") private String userType; public InfoClient() { } public InfoClient(@NonNull String id,@NonNull String phone,@NonNull String dopPhone, @NonNull String email,@NonNull String name,@NonNull String city, @NonNull String address,@NonNull String userType) { this.id = id; this.phone = phone; this.dopPhone = dopPhone; this.email = email; this.name = name; this.city = city; this.address = address; this.userType = userType; } public InfoClient(Parcel in) { id = in.readString(); phone = in.readString(); dopPhone = in.readString(); email = in.readString(); name = in.readString(); city = in.readString(); address = in.readString(); userType = in.readString(); } @NonNull public String getId() { return id; } public void setId(@NonNull String id) { this.id = id; } @NonNull public String getPhone() { return phone; } public void setPhone(@NonNull String phone) { this.phone = phone; } @NonNull public String getDopPhone() { return dopPhone; } public void setDopPhone(@NonNull String dopPhone) { this.dopPhone = dopPhone; } @NonNull public String getEmail() { return email; } public void setEmail(@NonNull String email) { this.email = email; } @NonNull public String getName() { return name; } public void setName(@NonNull String name) { this.name = name; } @NonNull public String getCity() { return city; } public void setCity(@NonNull String city) { this.city = city; } @NonNull public String getAddress() { return address; } public void setAddress(@NonNull String address) { this.address = address; } @NonNull public String getUserType() { return userType; } public void setUserType(@NonNull String userType) { this.userType = userType; } public static final Creator<InfoClient> CREATOR = new Creator<InfoClient>() { @NonNull @Override public InfoClient createFromParcel(Parcel in) { return new InfoClient(in); } @NonNull @Override public InfoClient[] newArray(int size) { return new InfoClient[size]; } }; @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(id); dest.writeString(phone); dest.writeString(dopPhone); dest.writeString(email); dest.writeString(name); dest.writeString(city); dest.writeString(address); dest.writeString(userType); } 

}

 ApiInterface apiInterface = ApiClient.getClient().create(ApiInterface.class); Call<AuthResponse> call = apiInterface.auth(number,password); call.enqueue(new Callback<AuthResponse>() { @Override public void onResponse(Call<AuthResponse> call, Response<AuthResponse> response) { AuthResponse authorization = response.body(); DataAuth dataAuth = authorization.getData().get(0); boolean success = dataAuth.isSuccess(); final InfoClient infoClient = dataAuth.getInfoClients(); Realm realm = Realm.getDefaultInstance(); realm.beginTransaction(); realm.deleteAll(); realm.copyToRealm(infoClient); realm.commitTransaction(); if (success) { loadingView.hideLoading(); session.setLoggedin(true); Intent intent = new Intent(getActivity(), MarketMobileActivity.class); intent.putExtra("infoClient",infoClient); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); getActivity().finish(); } else { Toast.makeText(getActivity(), "error", Toast.LENGTH_LONG).show(); eTxtUsername.setText(""); eTxtPassword.setText(""); } } 

enter error

 FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start activity ComponentInfo 
  • There can be many reasons for this. In your error, then there is a detailed info - YuriySPb
  • On which line is the error and what is written in it below - pavlofff
  • When authorizing, the client data received from the server must be recorded in the InfoClient class. The next activation should take the data not from the server but from the InfoClient class. - Mr.Baga
  • I think the problem here is' Realm realm = Realm.getDefaultInstance (); realm.beginTransaction (); realm.deleteAll (); realm.copyToRealm (infoClient); realm.commitTransaction (); ' - Mr.Baga Nov.

0