标签:opera log java res attr title dial name listener
private class xxxAsyncTask extends AsyncTask<String, Void, Boolean> { ... AlertDialog.Builder alertBuilder ; ... @Override protected void onPreExecute() { ... alertBuilder = new AlertDialog.Builder(ResultActivity.this); ... } @Override protected Boolean doInBackground(String... params) { ... } @Override protected void onPostExecute(Boolean result) { super.onPostExecute(result); alertBuilder.setTitle("Choose Attraction"); ... //prepare data String[] arr = new String[operationNames.size()]; operationNames.toArray(arr); alertBuilder.setItems(arr, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int index) { try{ // if select index == x , do something //// keep in mind that java is not allowed to block the UI thread doing network post //// have to wrap this inside one async task, e.g: new xxxAsync().execute(usageUrl, json); ... } catch (Exception ex){ } finally { dialog.dismiss(); } } }); alertBuilder.create().show(); } }
android - asynTask中打开多选alertDialog
标签:opera log java res attr title dial name listener
原文地址:http://blog.csdn.net/lan_liang/article/details/53207733