public void putAllDetails(User user) { SharedPreferences.Editor spEditor = sharedPreferences.edit(); spEditor.putString("username", user.getUsername()); spEditor.putString("name", user.getName()); spEditor.putString("password", user.getPassword()); spEditor.putString("age", user.getAge()); spEditor.putString("email", user.getEmail()); spEditor.putString("phone", user.getPhone()); spEditor.putString("position", user.getPosition()); spEditor.putString("experience", user.getExperience()); spEditor.putString("curloc", user.getCurloc()); spEditor.putString("desloc", user.getDesloc()); spEditor.putString("imageuri", user.getImageUri()); spEditor.putString("com1name", user.getCom1name()); spEditor.putString("com1pos", user.getCom1pos()); spEditor.putString("com1from", user.getCom1from()); spEditor.putString("com1to", user.getCom1to()); spEditor.putString("com1resp", user.getCom1resp()); spEditor.putString("com2name", user.getCom2name()); spEditor.putString("com2pos", user.getCom2pos()); spEditor.putString("com2from", user.getCom2from()); spEditor.putString("com2to", user.getCom2to()); spEditor.putString("com2resp", user.getCom2resp()); spEditor.putString("com3name", user.getCom3name()); spEditor.putString("com3pos", user.getCom3pos()); spEditor.putString("com3from", user.getCom3from()); spEditor.putString("com3to", user.getCom3to()); spEditor.putString("com3resp", user.getCom3resp()); spEditor.apply(); }
protected String doInBackground(String... argss) { List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("registration_id", registrationId)); params.add(new BasicNameValuePair("auth_username", u.getUsername())); params.add(new BasicNameValuePair("auth_type", u.getType())); params.add(new BasicNameValuePair("auth_phone", u.getPhone())); JSONObject json = jParser.makeHttpRequest(url_add_gcm_user, "GET", params); try { success = json.getInt(Tags.TAG_SUCCESS); msgAdd = json.getString(Tags.TAG_MESSAGE); // had to pass activity to constructor in order to show toast inside async task parent.runOnUiThread( new Runnable() { public void run() { Toast.makeText(parent.getBaseContext(), msgAdd, Toast.LENGTH_SHORT).show(); } }); } catch (JSONException e) { e.printStackTrace(); } return null; }
public void storePersonal(User user) { SharedPreferences.Editor spEditor = sharedPreferences.edit(); spEditor.putString("username", user.getUsername()); spEditor.putString("name", user.getName()); spEditor.putString("password", user.getPassword()); spEditor.putString("age", user.getAge()); spEditor.putString("email", user.getEmail()); spEditor.putString("phone", user.getPhone()); spEditor.apply(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_user_profile); // Get UI references TextView tvUsername = (TextView) findViewById(R.id.usernameTextView); etCity = (EditText) findViewById(R.id.cityTextView); etPhone = (EditText) findViewById(R.id.phoneTextView); etEmail = (EditText) findViewById(R.id.emailTextView); editButton = (Button) findViewById(R.id.editButton); saveButton = (Button) findViewById(R.id.saveProfileButton); // Retrieve data from other activities Intent intent = getIntent(); username = intent.getStringExtra(EXTRA_USERNAME); friendUsername = intent.getStringExtra("FRIENDUSERNAME"); profileState = (int) getIntent().getIntExtra(EXTRA_STATE, OWNER_STATE); // First check if showing friend's profile // If not, show current logged-in user's profile if (friendUsername != null) { Cache cache = new Cache(this, username); User cacheFriend = cache.getUser(friendUsername); // Set text fields tvUsername.setText(cacheFriend.getUsername()); etCity.setText(cacheFriend.getCity()); etPhone.setText(cacheFriend.getPhone()); etEmail.setText(cacheFriend.getEmail()); } else if (username != null) { User user = urc.getUser(username); // Set text fields tvUsername.setText(username); etCity.setText(user.getCity()); etPhone.setText(user.getPhone()); etEmail.setText(user.getEmail()); } upc.setViewMode(profileState, etCity, etPhone, etEmail, editButton, saveButton); }
/** * callback from elastic search to populate the view with the user. * * @param user to populate in the fields. */ public void populateFields(User user) { EditText editUserName = (EditText) findViewById(R.id.editUserName); EditText editUserEmail = (EditText) findViewById(R.id.editUserEmail); EditText editUserAddress1 = (EditText) findViewById(R.id.editUserAddress1); EditText editUserAddress2 = (EditText) findViewById(R.id.editUserAddress2); EditText editUserCity = (EditText) findViewById(R.id.editUserCity); EditText editUserPhone = (EditText) findViewById(R.id.editUserPhone); EditText editUserPostalCode = (EditText) findViewById(R.id.editUserPostalCode); editUserName.setText(user.getName()); editUserEmail.setText(user.getEmail()); editUserAddress1.setText(user.getAddress1()); editUserAddress2.setText(user.getAddress2()); editUserCity.setText(user.getCity()); editUserPhone.setText(user.getPhone()); editUserPostalCode.setText(user.getPostal()); showProgress(false); }
private static void currentUserInfo() { System.out.println("Name: " + currentUser.getName()); System.out.println("Library #: " + currentUser.getLibraryNumber()); System.out.println("Email: " + currentUser.getEmail()); System.out.println("Phone: " + currentUser.getPhone()); }