Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Since you are updating the UI, you will need to use the <code>runOnUiThread(...)</code> method within the <code>AsyncTask</code>.</p> <pre><code>runOnUiThread(new Runnable() { public void run() { setVisibility(); } }); </code></pre> <p>Where you would need to define the <code>setVisibility()</code> method in the <code>ToDoListActivity</code> Activity. eg.</p> <pre><code>setVisibility() { empty.setVisibility(View.VISIBLE); empty2.setVisibility(View.VISIBLE); } </code></pre> <p>Also, it is best to declare the UI objects in the global scope and instantiate then in the <code>onCreate(...)</code> method. eg.</p> <pre><code>public class ToDoListActivity extends ListActivity { ... TextView empty; TextView empty2; ... @Override public void onCreate(Bundle savedInstanceState) { ... empty = (TextView) findViewById(android.R.id.empty); empty.setVisibility(View.INVISIBLE); empty2 = (TextView) findViewById(android.R.id.empty2); empty2.setVisibility(View.INVISIBLE); ... } </code></pre> <p><strong>EDIT</strong></p> <p>You need to modify the <code>onPostExecute(...)</code> method in the AsyncTask as below:</p> <pre><code>protected void onPostExecute(Void result) { // Put the list of todos into the list view ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(ToDoListActivity.this, R.layout.todo_row); for (ParseObject todo : todos) { adapter.add((String) todo.get("DataI")); adapter.add((String) todo.get("DataO")); adapter.add((String) todo.get("DataRSSI")); adapter.add((String) todo.get("DataSSID")); adapter.add((String) todo.get("DataTIME")); adapter.add((String) todo.get("DataRESTRICTED")); } setListAdapter(adapter); ToDoListActivity.this.progressDialog.dismiss(); /* REMOVE BELOW LINES */ //TextView empty = (TextView) findViewById(android.R.id.empty); //empty.setVisibility(View.VISIBLE); //TextView empty2 = (TextView) findViewById(android.R.id.empty2); //empty2.setVisibility(View.VISIBLE); </code></pre> <p>}</p> <p>As well as the <code>runOnUiThread(...)</code> method</p> <pre><code>runOnUiThread(new Runnable() { public void run() { setVisibility(); /* REMOVE BELOW LINES */ //empty.setVisibility(View.VISIBLE); //empty2.setVisibility(View.VISIBLE); } }); </code></pre> <p>And I do not see the <code>setVisibility()</code> method in your <code>ToDoListActivity</code> class.</p> <p><strong>UPDATE</strong></p> <pre><code>protected Void doInBackground(Void... params) { // Gets the current list of todos in sorted order ParseQuery query = new ParseQuery("TestObject"); query.orderByDescending("_created_at"); try { todos = query.find(); } catch (ParseException e) { } runOnUiThread(new Runnable() { public void run() { setVisibility(); }}); return null; // RETURN STATEMENT HERE } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload