ヌル値を返します。私は除いて、行の配列内のすべての値を取得することができるよレトロフィットは、私はAndroidのネットワーキングに新たなんだ
{
"columns":{ <some data here> },
"rows":[
{
"timestamp":"28/08/2016 14:11:46",
"name":"Mohammed Sohail",
"phoneno.":8142629002,
"event-name":"Roadies",
"branch":"IT",
"year":3
},
{
"timestamp":"28/08/2016 14:13:03",
"name":"Shaik Asaduddin",
"phoneno.":8143026049,
"event-name":"Ted talk",
"branch":"IT",
"year":3
}
}
:私は、これは、JSONデータのサンプルであるphonone
のために、なぜ私は取得していますNULL値を把握することができませんよ"PHONENOは、" それは私にここ
は私のクラスで、null値を与える
登録クラス:
public class Registration {
private Columns columns;
private List<Row> rows = null;
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
public Columns getColumns() {
return columns;
}
public void setColumns(Columns columns) {
this.columns = columns;
}
public List<Row> getRows() {
return rows;
}
public void setRows(List<Row> rows) {
this.rows = rows;
}
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}
}
行クラス:
public class Row {
private String timestamp;
private String name;
private String phoneno;
private String eventName;
private String branch;
private String year;
public String getTimestamp() {
return timestamp;
}
public void setTimestamp(String timestamp) {
this.timestamp = timestamp;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhoneno() {
return phoneno;
}
public void setPhoneno(String phoneno) {
this.phoneno = phoneno;
}
public String getEventName() {
return eventName;
}
public void setEventName(String eventName) {
this.eventName = eventName;
}
public String getBranch() {
return branch;
}
public void setBranch(String branch) {
this.branch = branch;
}
public String getYear() {
return year;
}
public void setYear(String year) {
this.year = year;
}
}
、ここでは、私は多分、テキストビューの
public class RegistrationAdapter extends RecyclerView.Adapter<RegistrationAdapter.RegistrationViewHolder> {
private List<Row> rows;
private Context context;
private int rowLayout;
public RegistrationAdapter(List<Row> rows) {
this.rows=rows;
}
@Override
public RegistrationAdapter.RegistrationViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.registration_item_view, parent, false);
return new RegistrationViewHolder(view);
}
@Override
public void onBindViewHolder(RegistrationViewHolder holder, int position) {
holder.studentName.setText(rows.get(position).getName());
holder.studentPhone.setText(String.valueOf(rows.get(position).getPhoneno()));
holder.studentBranch.setText(rows.get(position).getBranch());
holder.studentYear.setText(rows.get(position).getYear());
}
@Override
public int getItemCount() {
return rows.size();
}
public class RegistrationViewHolder extends RecyclerView.ViewHolder {
LinearLayout studentLayout;
TextView studentName;
TextView studentPhone;
TextView studentBranch;
TextView studentYear;
public RegistrationViewHolder(View itemView) {
super(itemView);
studentLayout=(LinearLayout)itemView.findViewById(R.id.studentLayout);
studentName=(TextView)itemView.findViewById(R.id.studentName);
studentPhone=(TextView)itemView.findViewById(R.id.studentPhoneNumber);
studentBranch=(TextView)itemView.findViewById(R.id.studentBranch);
studentYear=(TextView)itemView.findViewById(R.id.studentYear);
}
}
public RegistrationAdapter(List<Row> rows, int rowLayout,Context context) {
this.rows = rows;
this.rowLayout = rowLayout;
this.context = context;
}
}
あなたのPOJO – Blackbelt
のフィールドを@Exposeする必要がありますが、私は使用せず、残りの値を取得することができるよ@公開し、それは義務ですか? –
あなたのJSONデータを確認してください。 "phoneno"にドット(。)が表示されていますが、これは誤植ですか?そうでない場合は、それが問題を引き起こしているかどうかを確認することができます。 –