Note that there are some explanatory texts on larger screens.

plurals
  1. POandroid- setAdapter on AlertDialog not working
    text
    copied!<p>I am making a list of the user's tumblr blogs in a pop-box. All of this happens within a Handler. Here is the code:</p> <pre><code>private class PicHandler extends Handler{ Context c; String name; JumblrClient client; public PicHandler(Context context, String n, JumblrClient cl){ c=context; name = n; client = cl; } public void handleMessage(Message msg) { final String[] cs = preferences.getString("allBlogs", "").split(","); for (String s : cs){ Log.d("DrawLog", s); //logs the blogs correctly } ListAdapter adapter = new ArrayAdapter&lt;String&gt;( getApplicationContext(), android.R.layout.simple_selectable_list_item, cs); Log.d("DrawLog", (String) adapter.getItem(0)); //logs the first blog correctlys new AlertDialog.Builder(c) .setTitle("Choose blog") .setMessage("Choose the blog to publish the .gif") .setAdapter(adapter, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { String root_sd = Environment.getExternalStorageDirectory().toString(); File file = new File( root_sd + "/Flippy/" + name) ; if(file.exists()){ Log.d("DrawLog", "file exists"); //file exists Log.d("DrawLog", file.getPath()); } PhotoPost post; try { post = client.newPost(cs[which], PhotoPost.class); //Photo p = new Photo(); post.setData(file); Log.d("DrawLog" , post.toString()+""); post.save(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InstantiationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch(NullPointerException e){ Log.d("DrawLog", "null pointer wtf"); } } }).create().show(); } } </code></pre> <p>All the logs log the right things... It's just when the alert displays there is no list. Any ideas why?</p>
 

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