@Override
protected String doInBackground(String... params) {
try{
JSONParser jParser = new JSONParser();
String url="http://twominenglish.com/api/getlatest?";
IdArray = jParser.getJSONFromUrl(url+"page="+pages);
mLatestList.clear();
for(int i=0;i<IdArray.length();i++){
if(IdArray.isNull(i))
{
Toast.makeText(mContext, "No Value", Toast.LENGTH_SHORT).show();
}
try{
JSONObject jObject;
mLtest=new Latest();
jObject=IdArray.getJSONObject(i);
mLtest.SetID(jObject.getString("ID"));
//mLtest.SetImageUrl(jObject.getString("ImageURL"));
String path="http://twominenglish.com"+jObject.getString("ImageURL");
mLtest.SetImageUrl(path);
mLtest.SetDescription(jObject.getString("Description"));
mLtest.SetTitle(jObject.getString("Title"));
mLatestList.add(mLtest);
mLtest=new Latest();
}catch(JSONException e){
e.printStackTrace();
}
}
}catch(Exception e){
e.printStackTrace();
}
任何人都可以帮助我。这是我的代码,我通过页面从服务器获取数据,例如在单击的下一个按钮上传递数字。当它不从服务器获取数据时,我如何显示消息没有数据..