Note that there are some explanatory texts on larger screens.

plurals
  1. POSpinner in ActionBar is not updating ListView
    primarykey
    data
    text
    <p>I have two elements:</p> <ol> <li>Spinner INSIDE THE ACTIONBAR (HoloEverywhere (support.v7)) of my Activity set with an <code>onItemSelectedListener()</code>.</li> <li>Listview in my Activity which is filled with an ArrayAdapter</li> </ol> <p>When I choose an Item from the Spinner, the ListView should be updated. But somehow there is a problem with my Spinner I guess. The ListView first updates when I clicked in a TextField of my Activity after I choose a SpinnerItem.</p> <p>My code:</p> <pre><code>// Get a databaseConnection and fills the history variable with the data of // the selected spinnerItem "history" is right filled with all Strings for // the chosen Spinner from the database -&gt; works correct public void updateHistory() { sqlLightDatabase database = new sqlLightDatabase(this); ArrayList&lt;String&gt; history = database.getArrayList( mySpinner.getSelectedItem().toString()); // set the adapter to the ListView ArrayAdapter&lt;String&gt; listenAdapter = new ArrayAdapter&lt;String&gt;(this, R.layout.list_item, history); myListView.setAdapter(listenAdapter); // the code works through, but the ListView is not shown the update // instantly. But now, when I click a TextField in my Activity, myListView // shows the new data } // Is instantly called when an Item is selected in mySpinner (in my ActionBar) @Override public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int position, long id) { // the updateHistory function is called but myLitstView doesn't get // updated with new Data updateHistory(); //Just for testing. The following is working instantly fine. drivenDistance_TF.setText("History changed"); } </code></pre> <p>I tried the last two days to fix this issue, but I have absolute no idea what I could else try to get the ListView instantly updated.</p> <p>There is no ErrorLog, because there are no errors.</p>
    singulars
    1. This table or related slice is empty.
    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. 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