Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting a ListView to work when grabbing data from a mySQL server
    primarykey
    data
    text
    <p>As the title says, I have a mySQL database that has data on it. I want my android app to retrieve that data and insert it into a ListView. I don't think I'm doing it correctly because my current code; although not producing any errors, doesn't work. Here is my code:</p> <p><a href="http://pastebin.com/sZy5dAzS" rel="nofollow">http://pastebin.com/sZy5dAzS</a></p> <p>I'd just like to point out that when I insert that data into a TextView it shows up on my app just fine. So it must be that I'm doing something wrong with my ListView. I just don't know what.</p> <p>Just to make it easier to read these are the parts of my ListView:</p> <p>At the top of my code</p> <pre><code>List&lt;String&gt; nameData = new ArrayList&lt;String&gt;(); </code></pre> <p>The for loop for my JSON Parsing:</p> <pre><code> try { jArray = new JSONArray(result); JSONObject json_data = null; currentList = (ListView) findViewById(R.id.list); for (int i = 0; i &lt; jArray.length(); i++) { json_data = jArray.getJSONObject(i); nameData.add(drivername = json_data.getString("Driver_full_name")); nameData.add(drivesfor = json_data.getString("Drives_for")); } </code></pre> <p>I do have a catch here as you can see in the pastebin link, just haven't posted it.</p> <p>and the onPostExecute</p> <pre><code>protected void onPostExecute(String output){ currentList.setAdapter(new ArrayAdapter&lt;String&gt; (CurrentSeasonDrivers.this, android.R.layout.simple_list_item_2, nameData)); Toast.makeText(CurrentSeasonDrivers, "DONE!", Toast.LENGTH_LONG).show(); } </code></pre> <p>Just to reiterate; a TextView works fine when pulling the data so the rest of the code is correct.</p> <p>Really appreciate any help given. Thanks. </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.
 

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