There is a Parse.com table with 20 values, ListView downloads each value (regardless of whether there is content or not). It turns out that when there are only 2-3 text in the parse, the listView downloads these 2-3 texts and leaves the remaining 18 lines empty. What is the condition to create so that empty lines are not downloaded? P / S / delete lines from Pars can not.
Code:
private class RemoteDataTask extends AsyncTask<Void, Void, Void> { @Override protected void onPreExecute() { super.onPreExecute(); // Create a progressdialog mProgressDialog = new ProgressDialog(SevenActivity.this); // Set progressdialog title mProgressDialog.setTitle("LikedFar"); // Set progressdialog message mProgressDialog.setMessage("Загрузка..."); mProgressDialog.setIndeterminate(false); // Show progressdialog mProgressDialog.show(); } @Override protected Void doInBackground(Void... params) { // Locate the class table named "Country" in Parse.com ParseQuery<ParseObject> query = new ParseQuery<ParseObject>( "LikedFar"); // query.orderByDescending("_created_at"); try { ob = query.find(); } catch (ParseException e) { Log.e("Error", e.getMessage()); e.printStackTrace(); } return null; } @Override protected void onPostExecute(Void result) { // Locate the listview in listview_main.xml listview = (ListView) findViewById(R.id.listView); // Pass the results into an ArrayAdapter adapter = new ArrayAdapter<String>(SevenActivity.this, R.layout.listview_item); // Retrieve object "name" from Parse.com database for (ParseObject country : ob) { adapter.add((String) country.get("LikedFar")); } // Binds the Adapter to the ListView listview.setAdapter(adapter); // Close the progressdialog mProgressDialog.dismiss(); // Capture button clicks on ListView items setLV(); }