SharedPreferences sp = context.getSharedPreferences("user", Context.MODE_PRIVATE);
sp.edit().putString("username",data1.getUsername())
.putString("userpass",data1.getPassword()).commit();
SharedPreferences sp = context.getSharedPreferences("user", Context.MODE_PRIVATE);
String username = sp.getString("username", "");
String userpass = sp.getString("userpass", "");