我有latitude与longitude它是从URL(JSON)的到来.我必须计算从用户位置(需要首先确定)到特定latitude和longitude基础(来自URL)的距离,并显示它们之间的距离.
可以在附加图像上看到JSON数据:
获取(餐馆的纬度和经度)JSON数据的URL:https://comida-95724.herokuapp.com/api/v1/restaurants/get_featured_restaurants
ListActiivty.java
public class ListViewActivity extends Activity {
// Log tag
private static final String TAG = ListViewActivity.class.getSimpleName();
// change here url of server api
private static final String url = "https://comida-95724.herokuapp.com/api/v1/restaurants/get_featured_restaurants";
private ProgressDialog pDialog;
private List<Movie> movieList = new ArrayList<Movie>();
private ListView listView;
private CustomListAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_listview);
listView = (ListView) findViewById(R.id.list);
adapter = new CustomListAdapter(this, movieList);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { …Run Code Online (Sandbox Code Playgroud)