改造改变json值并显示

时间:2017-03-14 07:37:59

标签: android android-studio retrofit

我是android的新手。如果{“性别”:1}为女性且{“性别”:2}为男性,我想在字符串中更改此值 这是我的代码 提前致谢

模型类

update AM1 from  DB.AM_7541 AM1,
 ( sel  distinct TRIM(SB.LCDBDN) NEID, 
        trim( leading '0' from sb.lcdmno) LCDMNO,
        AM.Netw_equip 
   from DB1.PLTL SB
   inner join DB.AM_7541 AM
   on  trim( leading '0' from sb.lcdmno)=AM.accs_meth_num
   where (SB.LOAD_DATE, sb.lcdmno, sb.lcdbdn) in
    (
      sel max(load_date),lcdmno,lcdbdn from DB1.PLTL 
      where lcdmno not like ' ' 
        and lcdmno is not null  
      group by lcdmno, lcdbdn
    )
   and SB.LCDBDN not like ''
 ) der
set Netw_equip=der.NEID
where AM1.accs_meth_num=der.lcdmno

界面

public class people{
@SerializedName("gender")
@Expose
private Integer gender;
public Integer getGender() {
    return gender;
}

 public void setGender(Integer gender) {
    this.gender = gender;
       }
    }

来自改造的回应

public interface ApiInterface{
   @GET("person/{person_id}")
   Call<People> getPeopleDetails(@Path("person_id") int personId,
                              @Query("api_key") String apikey);
      }

1 个答案:

答案 0 :(得分:0)

没什么新的

if("1".equals(String.valueOf(peopleResponse.getGender())){  
 v.gender.setText("female"));
} else {  
  v.gender.setText("male"));
}