Add check to only read 10 lines

This commit is contained in:
misaochan 2016-08-25 18:26:17 +12:00
parent 3809c1fdbd
commit 55810cd050
2 changed files with 8 additions and 1 deletions

View file

@ -47,6 +47,7 @@ public class NearbyListFragment extends ListFragment {
//Load from data source (NearbyPlaces.java)
places = loadAttractionsFromLocation(mLatestLocation);
/*
// Create a progress bar to display while the list loads
ProgressBar progressBar = new ProgressBar(getActivity());
progressBar.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
@ -56,6 +57,7 @@ public class NearbyListFragment extends ListFragment {
// Must add the progress bar to the root of the layout
ViewGroup root = (ViewGroup) view.getRootView();
root.addView(progressBar);
*/
mAdapter = new NearbyAdapter(getActivity(), places);
setListAdapter(mAdapter);

View file

@ -31,8 +31,13 @@ public class NearbyPlaces {
boolean firstLine = true;
String line;
while ((line = in.readLine()) != null) {
int counter = 0;
//while ((line = in.readLine()) != null) {
while (in.readLine() != null && counter < 11) {
line = in.readLine();
counter++;
// Skip CSV header.
if (firstLine) {
firstLine = false;