java - 如何在改造中将用户重定向到他们的活动
问题描述
我有一个用户类型,即用户和主管..登录时我希望用户去使用健康数据活动和主管去仪表板活动。
这是我的登录代码。
公共无效登录用户(字符串电子邮件,字符串密码){
Call<ResponseBody> call = RetrofitClient
.getInstance()
.getApi().login(email, password);
final ProgressDialog progressDialog = new ProgressDialog(this);
progressDialog.setMessage("Authenticating please wait...");
progressDialog.show();
call.enqueue(new Callback<ResponseBody>() {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
Intent intent = new Intent(LoginActivity.this, UserHealthDataActivity.class);
startActivity(intent);
Toast.makeText(LoginActivity.this, "Login successfully!", Toast.LENGTH_SHORT).show();
loginRequest = new LoginRequest(email, password);
String loginRequestJson = gson.toJson(loginRequest);
PH.get().setObjectAsJsonString(getApplicationContext(), "LOGGED_IN_USER", loginRequestJson); //save the login details to shared preference
}
@Override
public void onFailure(Call<ResponseBody> call, Throwable t) {
Toast.makeText(LoginActivity.this, t.getMessage(), Toast.LENGTH_SHORT).show();
System.out.println("throwing ..." + t);
loadingBar.dismiss();
}
});
}
}
解决方案
推荐阅读
- ssrs-2012 - SSRS 报告显示两个单独的日期条目。需要日期然后与该日期相关的所有详细信息
- python - 属性设置器方法在类创建时不起作用
- java - Google Calendar API JAVA Update 事件突然无法正常工作
- sql-server - Sql time(7) 字段未从节点 js 存储在数据库中
- python - Jupyter Notebook 运行服务器列表 - ValueError: No JSON object could be decoded
- ssl - 为什么一个 curl 可以做 https 而另一个不能
- python - Django 将时间值和用户值传递给 forms.py
- java - Java中BFS的结果不一致
- java - 无法创建 Maven 项目 Eclipse
- java - 如何在 java/oracle ADF 中从整数转换为 oracle.jbo.domain.Number