Android 我的json标记有什么问题?

Android 我的json标记有什么问题?,android,json,google-maps,Android,Json,Google Maps,我想让我的马克笔出现。显然,我必须编码 但是,我从未尝试使用更新的json对象作为标记的坐标。我正在用我的知识来建立这个活动,但所有显示的都是地图。我没有任何错误 public class MapsActivity extends FragmentActivity implements OnMapReadyCallback { private GoogleMap mMap; JSONParser jsonparser = new JSONParser(); @Override protec

我想让我的马克笔出现。显然,我必须编码 但是,我从未尝试使用更新的json对象作为标记的坐标。我正在用我的知识来建立这个活动,但所有显示的都是地图。我没有任何错误

public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {

private GoogleMap mMap;

JSONParser jsonparser = new JSONParser();

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_maps);
    // Obtain the SupportMapFragment and get notified when the map is ready to be used.
    SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
            .findFragmentById(map);
    mapFragment.getMapAsync(this);
//调用检索数据

new Retrievedata().execute();


}


/**
 * Manipulates the map once available.
 * This callback is triggered when the map is ready to be used.
 * This is where we can add markers or lines, add listeners or move the camera. In this case,
 * we just add a marker near Sydney, Australia.
 * If Google Play services is not installed on the device, the user will be prompted to install
 * it inside the SupportMapFragment. This method will only be triggered once the user has
 * installed Google Play services and returned to the app.
 */
@Override
public void onMapReady( GoogleMap googleMap) {
    mMap = googleMap;

    Marker marker;



    class Retrievedata extends AsyncTask<Void, Double, Void> {


        @Override
        protected Void doInBackground(Void... params) {

            try {

                while (!isCancelled()) {

                    jobj = jsonparser.makeHttpRequest("http://api.wheretheiss.at/v1/satellites/25544");

                    Double lat = jobj.getDouble("latitude");
                    Double longit = jobj.getDouble("longitude");

                    // this will cause onProgressUpdate to be called with lat & long
                    publishProgress(lat, longit);

                    // it's okay to sleep within the background thread
                    Thread.sleep(1500);

                }

            } catch (InterruptedException e) {
                Log.w("RetrieveData", "thread was interrupted", e);
            } catch (JSONException e) {
                Log.e("RetrieveData", "parse error", e);
            }

            return null;
        }

        @Override
        public void onProgressUpdate(Double... values) {

            Marker marker;
            marker = mMap.addMarker(new MarkerOptions()
                    .position(new LatLng(values[0], values[1]))
                    .title("ISS")
                    .snippet(""));
        }
    }


}
protected void onResume(){
    super.onResume();



}

protected void onDestroy(){

    super.onDestroy();



}
newretrievedata().execute();
}
/**
*一旦可用,就可以操纵贴图。
*当映射准备好使用时,将触发此回调。
*这是我们可以添加标记或线条、添加侦听器或移动摄影机的地方。在这种情况下,,
*我们只是在澳大利亚悉尼附近加了一个标记。
*如果设备上未安装Google Play服务,系统将提示用户安装
*它位于SupportMapFragment中。此方法仅在用户完成后触发
*已安装Google Play服务并返回应用程序。
*/
@凌驾
4月1日公开作废(谷歌地图谷歌地图){
mMap=谷歌地图;
标记;
类Retrievedata扩展了异步任务{
@凌驾
受保护的Void doInBackground(Void…参数){
试一试{
而(!isCancelled()){
jobj=jsonparser.makeHttpRequest(“http://api.wheretheiss.at/v1/satellites/25544");
双纬度=jobj.getDouble(“纬度”);
Double longit=jobj.getDouble(“经度”);
//这将导致使用lat和long调用onProgressUpdate
出版进度(lat、longit);
//可以在后台线程中睡觉
睡眠(1500);
}
}捕捉(中断异常e){
w(“检索数据”,“线程被中断”,e);
}捕获(JSONException e){
Log.e(“检索数据”,“解析错误”,e);
}
返回null;
}
@凌驾
public void onProgressUpdate(双…值){
标记;
marker=mMap.addMarker(新MarkerOptions()
.位置(新车床(值[0],值[1]))
.名称(“ISS”)
.段(“”);
}
}
}
受保护的void onResume(){
super.onResume();
}
受保护的空onDestroy(){
super.ondestory();
}

}

似乎您没有创建
Retrievedata
对象(没有启动
AsyncTask
)。我尝试添加此新的Retrievedata().execute();因此,请添加完整的source.protectedvoid onCreate(Bundle savedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.activity_maps);//获取SupportMapFragment并在地图准备好使用时收到通知。SupportMapFragment mapFragment=(SupportMapFragment)getSupportFragmentManager().findFragmentById(map);mapFragment.getMapAsync(this);new Retrievedata().execute()}请将完整源代码添加到问题中,而不是添加注释(在此处添加
new Retrievedata().execute();
)?