Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Session(Context cntx) {
- // TODO Auto-generated constructor stub
- prefs = PreferenceManager.getDefaultSharedPreferences(cntx);
- }
- public void setUserID(int userID) {
- prefs.edit().putInt("userID", userID).apply();
- }
- public int getID() {
- int userID;
- return userID = prefs.getInt("userID",0);
- }
- StringRequest stringRequest = new StringRequest(Request.Method.POST, server_url, new Response.Listener<String>() {
- @Override
- public void onResponse(String response) {
- builder.setTitle("Server Response");
- builder.setMessage("Response :"+response);
- session = new Session(getApplicationContext());
- int responseInt = Integer.parseInt(response.trim());
- session.setUserID(responseInt);
- Intent myIntent = new Intent(LoginActivity.this, navActivity.class);
- startActivity(myIntent);
- finish();
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_my_jars);
- session = new Session(getApplicationContext());
- userID = (EditText) findViewById(R.id.userID);
- builder = new AlertDialog.Builder(MyJars.this);
- userID.setText(session.getID());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement