0

在访问对象成员之一的活动之间传递一个包裹后,该成员将保存一个来自文本视图内容的简单字符串,最终包含以下内容:

“ [ 04-11 20:47:31.347 84:0x78 I/AudioHardwareALSA ] 初始化 ALSA 播放设备 AndroidPlayback_Speaker_normal ”

这怎么可能?

休闲是冒犯的对象

public class user implements Parcelable {
    public static final Parcelable.Creator CREATOR = new UserCreator();
private String EMPTY_FIELD = "empty_field";
public String username;
public String firstname;
public String lastname;
public String id;
public String timezone; 
public String language;
public String profession;
public String age;
public String location;
public String bio ;
public String gender;
public String status;
public String sipuri;
public String imgurl;
public String urlprefix = "http://sip.netchosis.com/images/";
public String phone;
public String email;
public String auth;

public user(Parcel source) {
    username = source.readString();
    firstname = source.readString();
    lastname = source.readString();
    id = source.readString();
    timezone = source.readString();
    language = source.readString();
    profession = source.readString();
    age = source.readString();
    location = source.readString();
    bio = source.readString();
    gender = source.readString();
    status = source.readString();
    imgurl = source.readString();
    email = source.readString();
    phone = source.readString();
    auth = source.readString();

  try{
    sipuri = username.replaceAll("@", "-");
  }
  catch (NullPointerException e){
      sipuri = username +"-"+"nousername.com";

  }
    sipuri = sipuri+"@sip.netchosis.com";
}
public String getImgurl() {
    return imgurl;
}
public void setImgurl(String imgurl) {
    this.imgurl = urlprefix+ imgurl+".phone.jpg";
}
public String getStatus() {
    return status;
}
public void setStatus(String status) {
    this.status = status;
}
public user() {
    // TODO Auto-generated constructor stub
}
public String getAuth(){
    Log.d("getauth",auth);
    return auth;
}
public void setAuth(String Auth){
    Log.d("setauth:",Auth);
    this.auth = Auth;
    Log.d("this.auth", this.auth);
}
public String getUsername() {
    return username;
}
public void setUsername(String username) {
    this.username = username;
}
public String getAge() {
    return age;
}
public void setAge(String age) {
    this.age = age;
}
public String getLocation() {
    return location;
}
public void setLocation(String location) {
    this.location = location;
}
public String getBio() {

    return bio;
}
public void setBio(String bio) {
    this.bio = bio;
}
public void setEmail(String email){
    this.email = email;
}
public void setPhone(String phone){
    this.phone = phone;
}
public String getFirstname() {
    if (this.firstname != null){
        return firstname;
    }
    else {
        return "firname issue";
    }
}
public String getEmail () {
    return this.email;
}
public String getPhone(){

    return phone;
}
public String getsupuri(){
    return sipuri;
}
public void setFirstname(String firstname) {
    this.firstname = firstname;
}
public String getLastname() {
    if (this.lastname != null){
        return this.lastname;
    }
    else{
        return "lastname issue";
    }

}
public void setLastname(String lastname) {

    this.lastname = lastname;
}
public String getId() {
    return id;
}
public void setId(String id) {
    this.id = id;
}
public String getTimezone() {
    return timezone;
}
public void setTimezone(String timezone) {
    this.timezone = timezone;
}
public String getLanguage() {
    return language;
}
public String getGender() {
    return gender;
}
public void setGender(String gender) {
    this.gender = gender;
}
public void setLanguage(String language) {
    this.language = language;
}
public String getProfession() {
    return profession;
}
public void setProfession(String profession) {
    this.profession = profession;
}
@Override
public int describeContents() {
    // TODO Auto-generated method stub
    return 0;
}
@Override
public void writeToParcel(Parcel arg0, int arg1) {
    arg0.writeString(username);
    arg0.writeString(firstname);
    arg0.writeString(lastname);
    arg0.writeString(id);
    arg0.writeString(timezone);
    arg0.writeString(language);
    arg0.writeString(profession);
    arg0.writeString(age);
    arg0.writeString(location);
    arg0.writeString(bio);
    arg0.writeString(gender);
    arg0.writeString(status);
    arg0.writeString(imgurl);
    arg0.writeString(email);
    arg0.writeString(phone);
    arg0.writeString(auth);

}

}

这就是我访问“电话”变​​量的方式,这是问题所在

public class editprofile extends Activity  {
public final static String C_USER = "com.example.project2.CUSER";
private EditText firstname_box;
private EditText lastname_box;
private EditText username_box;
private EditText email_box;
private EditText phone_box;
private EditText profession_box;
private EditText bio_box;
private Spinner gender_box;
private CheckBox accept_calls;
private static user currentuser;
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Intent  intent = getIntent();
    Bundle cu = intent.getExtras();
    currentuser = cu.getParcelable(Getusers.CURRENT_USER);
    setCurrentuser(currentuser); // Really not sure why this needs to happen
    Log.d("EDITPROFILE CREATED", currentuser.getUsername());

    setContentView(R.layout.fragment_editprofile);

    populate_profile();
}

public void setCurrentuser(user currentuser) {this.currentuser = currentuser;}

protected void populate_profile(){
    firstname_box = (EditText) findViewById(R.id.fnamebox1);
    lastname_box = (EditText) findViewById(R.id.lnamebox);

    phone_box = (EditText) findViewById(R.id.phonebox);

    bio_box = (EditText) findViewById(R.id.bio1);
    email_box = (EditText) findViewById(R.id.email_box);
    gender_box = (Spinner) findViewById(R.id.Gender);


    try{
        firstname_box.setText(currentuser.getFirstname());

    }
    catch (NullPointerException e){
        firstname_box.setText(null);
    }

    lastname_box.setText(currentuser.getLastname());
    Log.d("phone_box", currentuser.getPhone().toString()); // This is where I get strange output 
    phone_box.setText(currentuser.getFirstname());
    bio_box.setText(currentuser.getBio());
    email_box.setText(currentuser.getEmail());
}

public void Save(View view){ // happends when save button is pressed
    firstname_box = (EditText) findViewById(R.id.fnamebox1);
    lastname_box = (EditText) findViewById(R.id.lnamebox);

    phone_box = (EditText) findViewById(R.id.phonebox);
    bio_box = (EditText) findViewById(R.id.bio1);
    gender_box = (Spinner) findViewById(R.id.Gender);

    currentuser.setGender(gender_box.getSelectedItem().toString());
    Log.d("gender check",currentuser.getGender());
    currentuser.setFirstname(firstname_box.getText().toString());
    currentuser.setLastname(lastname_box.getText().toString());
    currentuser.setPhone(phone_box.getText());


    update_user(currentuser);
}

// Need to figure out what to do about profession and intrests
public void update_user(user User){
    List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(10);
    nameValuePairs.add(new BasicNameValuePair("firstname",User.getFirstname()));
    nameValuePairs.add(new BasicNameValuePair("lastname",User.getLastname()));
    nameValuePairs.add(new BasicNameValuePair("phone",User.getPhone()));
4

0 回答 0