mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33: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();
|
||||
|
|
|
|||
|
|
@ -3,9 +3,11 @@
|
|||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<fragment android:name="fr.free.nrw.commons.nearby.NearbyListFragment"
|
||||
android:id="@+id/container"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
@ -9,5 +9,5 @@
|
|||
android:id="@+id/listview"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue