Android Open Source - SimpleTwitterClient User

From Project

Back to project page SimpleTwitterClient.


The source code is released under:

Copyright (c) 2014 Keithen Hayenga Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the So...

If you think the Android project SimpleTwitterClient listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.codepath.apps.basictwitter.models;
/*  w  ww. j  a  v  a  2s  . c  o m*/
import org.json.JSONException;
import org.json.JSONObject;

public class User {
  private String name;
  private long uid;
  private String screenName;
  private String profileImageUrl;

  public static User fromJSON(JSONObject jsonObject) {
    User user = new User();
    // Extract values from JSON to populate member variables.
    try { = jsonObject.getString("name");
      user.uid = jsonObject.getLong("id");
      user.screenName = jsonObject.getString("screen_name");
      user.profileImageUrl = jsonObject.getString("profile_image_url");
    } catch (JSONException e) {
      return null;
    return user;

  public String getName() {
    return name;

  public long getUid() {
    return uid;

  public String getScreenName() {
    return screenName;

  public String getProfileImageUrl() {
    return profileImageUrl;


Java Source Code List