工作我有一个使用谷歌地图一个应用,我想通过获取的AsyncTask JSON数据......和我的选项卡进行测试以获得持续的数据...的AsyncTask不在4.0.4
该的AsyncTask不工作,在这里执行...
有了一些搜索我到知道的AsyncTask不正确4.0.4工作,这样你们更好地使用可运行的,而不是的AsyncTask
现在,这里我不有任何runnable或处理器和所有的想法...
请帮助我如何以及在哪里以及如何使用我的AsyncTask来编写代码?
public class Map extends Activity {
GoogleMap mMap;
String duration,distance,url,s;
StringBuilder data = null;
InputStream is = null;
JSONObject jObj = null;
String json = "";
ProgressDialog pd;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.map);
int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getBaseContext());
//Toast.makeText(getApplicationContext(), "Cant connect to google play service", 10).show();
MapFragment fa = (MapFragment) getFragmentManager().findFragmentById(R.id.fragment1);
mMap = fa.getMap();
new dis().execute();
//Toast.makeText(getApplicationContext(), duration, 10).show();
}
public class dis extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... arg0) {
// TODO Auto-generated method stub
try{
Toast.makeText(getApplicationContext(), "jinal", 10).show();
}catch(Exception e){}
return null;
}
@Override
protected void onPostExecute(Void result) {
// TODO Auto-generated method stub
pd.dismiss();
Toast.makeText(getApplicationContext(), "jinal", 10).show();
super.onPostExecute(result);
}
@Override
protected void onPreExecute() {
// TODO Auto-generated method stub
super.onPreExecute();
pd = new ProgressDialog(Map.this);
pd.setTitle("Please Wait....");
pd.setMessage("Wait");
pd.setCancelable(false);
pd.show();
}
}
}
现在我只是implimenting简单的代码,但它不是给输出
我不知道你在哪里得到的想法或者正是你的“的AsyncTask不工作是什么意思适当的4.0.4" ,但如果你发布相关的代码,我们或许可以帮助你 – codeMagic 2015-02-06 17:42:02
发布你现在所拥有的 – Psypher 2015-02-06 17:42:54
的代码的AsyncTask http://stackoverflow.com/questions/12839384/asynctask-doinbackground-not-called-在Android平板电脑 – Jinal 2015-02-06 17:52:06