问题是我存储了Facebook用户名电子邮件ID和个人资料图片并在下一个活动中检索数据但问题是当我重新启动应用程序代码工作正常时我登录数据为空。
String email = object.getString("email");
String id = object.getString("id");`
sessionManager.setfacebookid(object.getString("email").toString());
String imageurl = "https://graph.facebook.com/" + id + "/picture?type=large";
sessionManager.setfacebookimage("https://graph.facebook.com/" + id + "/picture?type=large".toString());
sessionManager.isUserLogin(); navHeader = navigationView.getHeaderView(0);
String facebookname = sessionManager.getfacebookname();
tvvwelcome2 = (TextView) navHeader.findViewById(R.id.tvwelcome2);
tvvwelcome2.setText(facebookname);
Log.e("facebooknamein text....", "" + facebookname);
String facebookid = sessionManager.getfacebookid();
tvemail2 = (TextView) navHeader.findViewById(R.id.headeremail2);
tvemail2.setText(facebookid);
Log.e("emailfbinnavigation", "" + facebookid);
String facedp = sessionManager.getfacebookdp();
imgbtn2 = (ImageView) navHeader.findViewById(R.id.profileheader2);
Picasso.with(this).load(facedp).into(imgbtn2);
Log.e("imageview in image", "" + facedp);
提前致谢
答案 0 :(得分:0)
尝试使用如下所述的SharedPreferences,
保存数据:
SharedPreferences prefs = getSharedPreferences("my_prefs", MODE_PRIVATE);
Editor editor = prefs.edit();
editor.putString("name", "Sahil");
editor.commit();
要检索数据:
SharedPreferences prefs = getSharedPreferences("my_prefs", MODE_PRIVATE);
String name= prefs.getString("name");