public class GeRen extends Activity {
private ArrayList s_list;
private TextView type,opendate,name,sex,enddate;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.geren);
initview();
//str为网络请求到的json字符串
String str=this.getIntent().getStringExtra("key");
Log.e("TAG2", str);
Gson gson = new Gson();
Datas d = gson.fromJson(str, Datas.class);
setS_list(d.getResult());
// for(int i=0;i<s_list.size();i++){
// type.setText(s_list.get(i).getType());
// opendate.setText(s_list.get(i).getOpendate());
// name.setText(s_list.get(i).getName());
// sex.setText(s_list.get(i).getSex());
// enddate.setText(s_list.get(i).getEnddate());
// }
}
private void initview() {
type=(TextView) findViewById(R.id.type);
opendate=(TextView) findViewById(R.id.opendate);
name=(TextView) findViewById(R.id.name);
sex=(TextView) findViewById(R.id.sex);
enddate=(TextView) findViewById(R.id.enddate);
}
}
为什么Datas d = gson.fromJson(str, Datas.class);为空 求大神解惑