mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Get latitude and longitude of item
This commit is contained in:
parent
9b80033eb5
commit
950a84f279
1 changed files with 10 additions and 14 deletions
|
|
@ -56,17 +56,6 @@ public class NearbyListFragment extends ListFragment {
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
|
|
||||||
/*
|
|
||||||
// Create a progress bar to display while the list loads
|
|
||||||
ProgressBar progressBar = new ProgressBar(getActivity());
|
|
||||||
progressBar.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
|
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT));
|
|
||||||
progressBar.setIndeterminate(true);
|
|
||||||
getListView().setEmptyView(progressBar);
|
|
||||||
// Must add the progress bar to the root of the layout
|
|
||||||
ViewGroup root = (ViewGroup) view.getRootView();
|
|
||||||
root.addView(progressBar);
|
|
||||||
*/
|
|
||||||
progressBar = (ProgressBar) view.findViewById(R.id.progressBar);
|
progressBar = (ProgressBar) view.findViewById(R.id.progressBar);
|
||||||
progressBar.setMax(10);
|
progressBar.setMax(10);
|
||||||
progressBar.setVisibility(View.VISIBLE);
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
|
|
@ -142,9 +131,16 @@ public class NearbyListFragment extends ListFragment {
|
||||||
listview.setAdapter(mAdapter);
|
listview.setAdapter(mAdapter);
|
||||||
|
|
||||||
listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
public void onItemClick(AdapterView<?> parent, View view,int position, long id) {
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
|
||||||
Log.d(TAG, "Item at position " + position + " selected");
|
|
||||||
|
Place place = places.get(position);
|
||||||
|
LatLng placeLatLng = place.location;
|
||||||
|
|
||||||
|
double latitude = placeLatLng.latitude;
|
||||||
|
double longitude = placeLatLng.longitude;
|
||||||
|
|
||||||
|
Log.d(TAG, "Item at position " + position + " has coords: Lat: " + latitude + " Long: " + longitude);
|
||||||
/*
|
/*
|
||||||
Intent i = new Intent(More.this, NextActvity.class);
|
Intent i = new Intent(More.this, NextActvity.class);
|
||||||
//If you wanna send any data to nextActicity.class you can use
|
//If you wanna send any data to nextActicity.class you can use
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue