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) //Load from data source (NearbyPlaces.java)
places = loadAttractionsFromLocation(mLatestLocation); places = loadAttractionsFromLocation(mLatestLocation);
/*
// Create a progress bar to display while the list loads // Create a progress bar to display while the list loads
ProgressBar progressBar = new ProgressBar(getActivity()); ProgressBar progressBar = new ProgressBar(getActivity());
progressBar.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, 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 // Must add the progress bar to the root of the layout
ViewGroup root = (ViewGroup) view.getRootView(); ViewGroup root = (ViewGroup) view.getRootView();
root.addView(progressBar); root.addView(progressBar);
*/
mAdapter = new NearbyAdapter(getActivity(), places); mAdapter = new NearbyAdapter(getActivity(), places);
setListAdapter(mAdapter); setListAdapter(mAdapter);

View file

@ -31,8 +31,13 @@ public class NearbyPlaces {
boolean firstLine = true; boolean firstLine = true;
String line; 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. // Skip CSV header.
if (firstLine) { if (firstLine) {
firstLine = false; firstLine = false;