mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-28 05:13:53 +01:00
Moved adapter setup to onViewCreated, to prevent crash
This commit is contained in:
parent
b7d0e6e725
commit
d62fd565b6
4 changed files with 16 additions and 3 deletions
|
|
@ -6,6 +6,7 @@ import android.location.Location;
|
|||
import android.location.LocationListener;
|
||||
import android.location.LocationManager;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.util.Log;
|
||||
|
||||
|
|
|
|||
|
|
@ -59,15 +59,25 @@ public class NearbyListFragment extends ListFragment {
|
|||
ViewGroup root = (ViewGroup) view.getRootView();
|
||||
root.addView(progressBar);
|
||||
*/
|
||||
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
// This event is triggered soon after onCreateView().
|
||||
// Any view setup should occur here. E.g., view lookups and attaching view listeners.
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
// Setup any handles to view objects here
|
||||
// EditText etFoo = (EditText) view.findViewById(R.id.etFoo);
|
||||
final ListView listview = (ListView) view.findViewById(R.id.listview);
|
||||
|
||||
mAdapter = new NearbyAdapter(getActivity(), places);
|
||||
//setListAdapter(mAdapter);
|
||||
listview.setAdapter(mAdapter);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
private static List<Place> loadAttractionsFromLocation(final LatLng curLatLng) {
|
||||
|
||||
List<Place> places = NearbyPlaces.get();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue