List of usage examples for android.app AlertDialog getListView
public ListView getListView()
From source file:com.nachiket.titan.LibraryActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case MENU_SEARCH: setSearchBoxVisible(!mSearchBoxVisible); return true; case MENU_PLAYBACK: openPlaybackActivity();//from w w w .j av a 2 s .c o m return true; case MENU_SORT: { MediaAdapter adapter = (MediaAdapter) mCurrentAdapter; int mode = adapter.getSortMode(); int check; if (mode < 0) { check = R.id.descending; mode = ~mode; } else { check = R.id.ascending; } int[] itemIds = adapter.getSortEntries(); String[] items = new String[itemIds.length]; Resources res = getResources(); for (int i = itemIds.length; --i != -1;) { items[i] = res.getString(itemIds[i]); } RadioGroup header = (RadioGroup) getLayoutInflater().inflate(R.layout.sort_dialog, null); header.check(check); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.sort_by); builder.setSingleChoiceItems(items, mode + 1, this); // add 1 for header builder.setNeutralButton(R.string.done, null); AlertDialog dialog = builder.create(); dialog.getListView().addHeaderView(header); dialog.setOnDismissListener(this); dialog.show(); return true; } default: return super.onOptionsItemSelected(item); } }
From source file:org.akvo.caddisfly.ui.activity.MainActivity.java
@Override public void onLoadCalibration(final Handler.Callback callback) { final Context context = this; final MainApp mainApp = (MainApp) this.getApplicationContext(); try {// w w w.j a va 2 s . c om AlertDialog.Builder builderSingle = new AlertDialog.Builder(context); builderSingle.setIcon(R.drawable.ic_launcher); builderSingle.setTitle(R.string.loadCalibration); final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(context, android.R.layout.select_dialog_singlechoice); File external = Environment.getExternalStorageDirectory(); final String folderName = Config.CALIBRATE_FOLDER_NAME; String path = external.getPath() + folderName; File folder = new File(path); if (folder.exists()) { final File[] listFiles = folder.listFiles(); for (File listFile : listFiles) { arrayAdapter.add(listFile.getName()); } builderSingle.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); builderSingle.setAdapter(arrayAdapter, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String fileName = listFiles[which].getName(); final ArrayList<Integer> swatchList = new ArrayList<Integer>(); final ArrayList<String> rgbList = FileUtils.loadFromFile(fileName); if (rgbList != null) { for (String rgb : rgbList) { swatchList.add(ColorUtils.getColorFromRgb(rgb)); } (new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... params) { mainApp.saveCalibratedSwatches(mainApp.currentTestInfo.getCode(), swatchList); mainApp.setSwatches(mainApp.currentTestInfo.getCode()); SharedPreferences sharedPreferences = PreferenceManager .getDefaultSharedPreferences(context); SharedPreferences.Editor editor = sharedPreferences.edit(); for (int i = 0; i < mainApp.rangeIntervals.size(); i++) { int index = i * mainApp.rangeIncrementStep; ColorUtils.autoGenerateColors(index, mainApp.currentTestInfo.getCode(), mainApp.colorList, mainApp.rangeIncrementStep, editor, 0); } editor.apply(); return null; } @Override protected void onPostExecute(Void result) { super.onPostExecute(result); callback.handleMessage(null); } }).execute(); } } }); final AlertDialog alert = builderSingle.create(); alert.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialogInterface) { final ListView listView = alert.getListView(); listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) { final int position = i; AlertUtils.askQuestion(context, R.string.delete, R.string.selectedWillBeDeleted, new DialogInterface.OnClickListener() { @SuppressWarnings("unchecked") @Override public void onClick(DialogInterface dialogInterface, int i) { String fileName = listFiles[position].getName(); FileUtils.deleteFile(folderName, fileName); ArrayAdapter listAdapter = (ArrayAdapter) listView.getAdapter(); listAdapter.remove(listAdapter.getItem(position)); } }); return true; } }); } }); alert.show(); } else { AlertUtils.showMessage(context, R.string.notFound, R.string.noSavedCalibrations); } } catch (ActivityNotFoundException e) { AlertUtils.showMessage(context, R.string.error, R.string.updateRequired); } callback.handleMessage(null); }
From source file:ti.modules.titanium.ui.widget.TiUIDialog.java
public void show(KrollDict options) { AlertDialog dialog = dialogWrapper.getDialog(); if (dialog == null) { processProperties(proxy.getProperties()); getBuilder().setOnCancelListener(new OnCancelListener() { @Override//from w w w .j a va2s.c o m public void onCancel(DialogInterface dlg) { int cancelIndex = (proxy.hasProperty(TiC.PROPERTY_CANCEL)) ? TiConvert.toInt(proxy.getProperty(TiC.PROPERTY_CANCEL)) : -1; Log.d(TAG, "onCancelListener called. Sending index: " + cancelIndex, Log.DEBUG_MODE); handleEvent(cancelIndex); hide(null); } }); dialog = getBuilder().create(); // Initially apply accessibility properties here, the first time // the dialog actually becomes available. After this, propertyChanged // can also be used. ListView listView = dialog.getListView(); if (listView != null) { listView.setContentDescription(composeContentDescription()); int importance = ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO; if (proxy != null) { Object propertyValue = proxy.getProperty(TiC.PROPERTY_ACCESSIBILITY_HIDDEN); if (propertyValue != null && TiConvert.toBoolean(propertyValue)) { importance = ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_NO; } } ViewCompat.setImportantForAccessibility(listView, importance); } dialogWrapper.setDialog(dialog); builder = null; } try { Activity dialogActivity = dialogWrapper.getActivity(); if (dialogActivity != null && !dialogActivity.isFinishing()) { if (dialogActivity instanceof TiBaseActivity) { //add dialog to its activity so we can clean it up later to prevent memory leak. ((TiBaseActivity) dialogActivity).addDialog(dialogWrapper); dialog.show(); } } else { dialog = null; Log.w(TAG, "Dialog activity is destroyed, unable to show dialog with message: " + TiConvert.toString(proxy.getProperty(TiC.PROPERTY_MESSAGE))); } } catch (Throwable t) { Log.w(TAG, "Context must have gone away: " + t.getMessage(), t); } }
From source file:com.juick.android.MessageMenu.java
protected void runActions() { if (!isDialogMode()) { AlertDialog.Builder builder = new AlertDialog.Builder(activity); final CharSequence[] items = new CharSequence[menuActions.size()]; for (int j = 0; j < items.length; j++) { items[j] = menuActions.get(j).title; }//w w w . j av a2 s .co m builder.setItems(items, this); final AlertDialog alertDialog = builder.create(); alertDialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialog) { ColorsTheme.ColorTheme colorTheme = JuickMessagesAdapter.getColorTheme(activity); ColorDrawable divider = new ColorDrawable( colorTheme.getColor(ColorsTheme.ColorKey.COMMON_BACKGROUND, 0xFFFFFFFF)); alertDialog.getListView().setDivider(divider); alertDialog.getListView().setDividerHeight(1); } }); alertDialog.show(); final ListAdapter adapter = alertDialog.getListView().getAdapter(); SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(activity); float menuFontScale = 1; try { menuFontScale = Float.parseFloat(sp.getString("menuFontScale", "1.0")); } catch (Exception e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } final boolean compressedMenu = sp.getBoolean("compressedMenu", false); final boolean singleLineMenu = sp.getBoolean("singleLineMenu", false); final float finalMenuFontScale = menuFontScale; final int screenHeight = activity.getWindow().getWindowManager().getDefaultDisplay().getHeight(); alertDialog.getListView().setAdapter(new ListAdapter() { @Override public boolean areAllItemsEnabled() { return adapter.areAllItemsEnabled(); } @Override public boolean isEnabled(int position) { return adapter.isEnabled(position); } @Override public void registerDataSetObserver(DataSetObserver observer) { adapter.registerDataSetObserver(observer); } @Override public void unregisterDataSetObserver(DataSetObserver observer) { adapter.unregisterDataSetObserver(observer); } @Override public int getCount() { return items.length; } @Override public Object getItem(int position) { return adapter.getItem(position); } @Override public long getItemId(int position) { return adapter.getItemId(position); } @Override public boolean hasStableIds() { return adapter.hasStableIds(); } @Override public View getView(int position, View convertView, ViewGroup parent) { View retval = adapter.getView(position, null, parent); if (retval instanceof TextView) { TextView tv = (TextView) retval; if (compressedMenu) { int minHeight = (int) ((screenHeight * 0.7) / getCount()); tv.setMinHeight(minHeight); tv.setMinimumHeight(minHeight); } if (singleLineMenu) { tv.setSingleLine(true); tv.setEllipsize(TextUtils.TruncateAt.MIDDLE); } tv.setTextSize(22 * finalMenuFontScale); } return retval; } @Override public int getItemViewType(int position) { return adapter.getItemViewType(position); } @Override public int getViewTypeCount() { return adapter.getViewTypeCount(); } @Override public boolean isEmpty() { return adapter.isEmpty(); } }); } else { AlertDialog.Builder builder = new AlertDialog.Builder( new ContextThemeWrapper(activity, R.style.Theme_Sherlock)); View dialogView = activity.getLayoutInflater().inflate(R.layout.message_menu2, null); builder.setView(dialogView); builder.setCancelable(true); int width = activity.getWindowManager().getDefaultDisplay().getWidth(); View scrollView = dialogView.findViewById(R.id.scrollView); scrollView.getLayoutParams().width = (int) (width * 0.90); final AlertDialog alertDialog = builder.create(); alertDialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialog) { //MainActivity.restyleChildrenOrWidget(alertDialog.getWindow().getDecorView()); } }); TextView messageNo = (TextView) dialogView.findViewById(R.id.message_no); messageNo.setText(listSelectedItem.getDisplayMessageNo()); Spinner openUrl = (Spinner) dialogView.findViewById(R.id.open_url); Button singleURL = (Button) dialogView.findViewById(R.id.single_url); if (urls != null && urls.size() == 1) { singleURL.setVisibility(View.VISIBLE); openUrl.setVisibility(View.GONE); SpannableStringBuilder sb = new SpannableStringBuilder(); sb.append(urls.get(0)); sb.setSpan(new UnderlineSpan(), 0, sb.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); singleURL.setText(sb); singleURL.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { alertDialog.dismiss(); launchURL(listSelectedItem.getMID(), urls.get(0)); } }); } else if (urls != null && urls.size() > 0) { singleURL.setVisibility(View.GONE); openUrl.setVisibility(View.VISIBLE); openUrl.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (position != 0) { alertDialog.dismiss(); launchURL(listSelectedItem.getMID(), urls.get(position)); } } @Override public void onNothingSelected(AdapterView<?> parent) { //To change body of implemented methods use File | Settings | File Templates. } }); urls.add(0, activity.getString(R.string.ClickToSelectURL)); openUrl.setAdapter(new BaseAdapter() { @Override public int getCount() { return urls.size(); } @Override public Object getItem(int position) { return position; } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { View rowView = activity.getLayoutInflater().inflate(android.R.layout.simple_list_item_1, null); TextView textView = (TextView) rowView.findViewById(android.R.id.text1); textView.setSingleLine(false); textView.setMaxLines(5); SpannableStringBuilder sb = new SpannableStringBuilder(); sb.append(urls.get(position)); if (position == 0) { textView.setTextColor(0xFF808080); } else { sb.setSpan(new UnderlineSpan(), 0, sb.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } textView.setText(sb); return rowView; } }); } else { openUrl.setVisibility(View.GONE); singleURL.setVisibility(View.GONE); } final String UName = listSelectedItem.User.UName; View recommendMessage = dialogView.findViewById(R.id.recommend_message); View deleteMessage = dialogView.findViewById(R.id.delete_message); View saveMessage = dialogView.findViewById(R.id.save_message); View unsaveMessage = dialogView.findViewById(R.id.unsave_message); //View subscribeUser = dialogView.findViewById(R.id.subscribe_user); View subscribeMessage = dialogView.findViewById(R.id.subscribe_message); //View unsubscribeUser = dialogView.findViewById(R.id.unsubscribe_user); View unsubscribeMessage = dialogView.findViewById(R.id.unsubscribe_message); View translateMessage = dialogView.findViewById(R.id.translate_message); View shareMessage = dialogView.findViewById(R.id.share_message); //View blacklistUser = dialogView.findViewById(R.id.blacklist_user); //View filterUser = dialogView.findViewById(R.id.filter_user); //View userBlog = dialogView.findViewById(R.id.user_blog); //View userStats = dialogView.findViewById(R.id.user_stats); View openMessageInBrowser = dialogView.findViewById(R.id.open_message_in_browser); Button userCenter = (Button) dialogView.findViewById(R.id.user_center); if (null == dialogView.findViewById(R.id.column_3)) { // only for portrait userCenter.setText("@" + listSelectedItem.User.UName + " " + userCenter.getText()); } unsubscribeMessage.setEnabled(listSelectedItem.getRID() == 0); subscribeMessage.setEnabled(listSelectedItem.getRID() == 0); unsaveMessage.setEnabled(listSelectedItem.getRID() == 0); recommendMessage.setEnabled(listSelectedItem.getRID() == 0); if (UName.equalsIgnoreCase(JuickAPIAuthorizer.getJuickAccountName(activity.getApplicationContext()))) { recommendMessage.setVisibility(View.GONE); } else { deleteMessage.setVisibility(View.GONE); } if (messagesSource instanceof SavedMessagesSource) { saveMessage.setVisibility(View.GONE); } else { unsaveMessage.setVisibility(View.GONE); } recommendMessage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { alertDialog.dismiss(); actionRecommendMessage(); } }); deleteMessage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { alertDialog.dismiss(); actionDeleteMessage(); } }); saveMessage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { alertDialog.dismiss(); actionSaveMessage(); } }); unsaveMessage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { alertDialog.dismiss(); actionUnsaveMessage(); } }); // subscribeUser.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // alertDialog.dismiss(); // actionSubscribeUser(); // } // }); subscribeMessage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { alertDialog.dismiss(); actionSubscribeMessage(); } }); // unsubscribeUser.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // alertDialog.dismiss(); // actionUnsubscribeUser(); // } // }); unsubscribeMessage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { alertDialog.dismiss(); actionUnsubscribeMessage(); } }); translateMessage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { alertDialog.dismiss(); actionTranslateMessage(); } }); shareMessage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { alertDialog.dismiss(); actionShareMessage(); } }); // blacklistUser.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // alertDialog.dismiss(); // actionBlacklistUser(); // } // }); // filterUser.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // alertDialog.dismiss(); // actionFilterUser(UName); // } // }); // userBlog.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // alertDialog.dismiss(); // actionUserBlog(); // } // }); // userStats.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // alertDialog.dismiss(); // actionUserStats(); // } // }); openMessageInBrowser.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { alertDialog.dismiss(); actionOpenMessageInBrowser(); } }); userCenter.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { alertDialog.dismiss(); actionUserCenter(); } }); completeInitDialogMode(alertDialog, dialogView); alertDialog.show(); } }
From source file:ti.modules.titanium.ui.widget.TiUIDialog.java
@Override public void propertyChanged(String key, Object oldValue, Object newValue, KrollProxy proxy) { Log.d(TAG, "Property: " + key + " old: " + oldValue + " new: " + newValue, Log.DEBUG_MODE); AlertDialog dialog = dialogWrapper.getDialog(); if (key.equals(TiC.PROPERTY_TITLE)) { if (dialog != null) { dialog.setTitle((String) newValue); }/*from www . j a v a 2s . co m*/ } else if (key.equals(TiC.PROPERTY_MESSAGE)) { if (dialog != null) { dialog.setMessage((String) newValue); } } else if (key.equals(TiC.PROPERTY_BUTTON_NAMES)) { if (dialog != null) { dialog.dismiss(); dialog = null; } processButtons(TiConvert.toStringArray((Object[]) newValue)); } else if (key.equals(TiC.PROPERTY_OK) && !proxy.hasProperty(TiC.PROPERTY_BUTTON_NAMES)) { if (dialog != null) { dialog.dismiss(); dialog = null; } processButtons(new String[] { TiConvert.toString(newValue) }); } else if (key.equals(TiC.PROPERTY_OPTIONS)) { if (dialog != null) { dialog.dismiss(); dialog = null; } getBuilder().setView(null); int selectedIndex = -1; if (proxy.hasProperty(TiC.PROPERTY_SELECTED_INDEX)) { selectedIndex = TiConvert.toInt(proxy.getProperty(TiC.PROPERTY_SELECTED_INDEX)); } processOptions(TiConvert.toStringArray((Object[]) newValue), selectedIndex); } else if (key.equals(TiC.PROPERTY_SELECTED_INDEX)) { if (dialog != null) { dialog.dismiss(); dialog = null; } getBuilder().setView(null); if (proxy.hasProperty(TiC.PROPERTY_OPTIONS)) { processOptions(TiConvert.toStringArray((Object[]) proxy.getProperty(TiC.PROPERTY_OPTIONS)), TiConvert.toInt(newValue)); } } else if (key.equals(TiC.PROPERTY_ANDROID_VIEW)) { if (dialog != null) { dialog.dismiss(); dialog = null; } if (newValue != null) { processView((TiViewProxy) newValue); } else { proxy.setProperty(TiC.PROPERTY_ANDROID_VIEW, null); } } else if (key.equals(TiC.PROPERTY_PERSISTENT) && newValue != null) { dialogWrapper.setPersistent(TiConvert.toBoolean(newValue)); } else if (key.indexOf("accessibility") == 0) { if (dialog != null) { ListView listView = dialog.getListView(); if (listView != null) { if (key.equals(TiC.PROPERTY_ACCESSIBILITY_HIDDEN)) { int importance = ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO; if (newValue != null && TiConvert.toBoolean(newValue)) { importance = ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_NO; } ViewCompat.setImportantForAccessibility(listView, importance); } else { listView.setContentDescription(composeContentDescription()); } } } } else { super.propertyChanged(key, oldValue, newValue, proxy); } }
From source file:com.wikonos.fingerprint.activities.MainActivity.java
/** * Create dialog list of logs/* w w w . j av a 2 s . c o m*/ * * @return */ public AlertDialog getDialogReviewLogs() { /** * List of logs */ File folder = new File(LogWriter.APPEND_PATH); final String[] files = folder.list(new FilenameFilter() { public boolean accept(File dir, String filename) { if (filename.contains(".log") && !filename.equals(LogWriter.DEFAULT_NAME) && !filename.equals(LogWriterSensors.DEFAULT_NAME) && !filename.equals(ErrorLog.DEFAULT_NAME)) return true; else return false; } }); Arrays.sort(files); ArrayUtils.reverse(files); String[] files_with_status = new String[files.length]; String[] sent_mode = { "", "(s) ", "(e) ", "(s+e) " }; for (int i = 0; i < files.length; ++i) { //0 -- not sent //1 -- server //2 -- email files_with_status[i] = sent_mode[getSentFlags(files[i], this)] + files[i]; } if (files != null && files.length > 0) { final boolean[] selected = new boolean[files.length]; final AlertDialog ald = new AlertDialog.Builder(MainActivity.this) .setMultiChoiceItems(files_with_status, selected, new DialogInterface.OnMultiChoiceClickListener() { public void onClick(DialogInterface dialog, int which, boolean isChecked) { selected[which] = isChecked; } }) .setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { // removeDialog(DIALOG_ID_REVIEW); } }) /** * Delete log */ .setNegativeButton("Delete", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { //Show delete confirm standardConfirmDialog("Delete Logs", "Are you sure you want to delete selected logs?", new OnClickListener() { //Confrim Delete @Override public void onClick(DialogInterface dialog, int which) { int deleteCount = 0; boolean flagSelected = false; for (int i = 0; i < selected.length; i++) { if (selected[i]) { flagSelected = true; LogWriter.delete(files[i]); LogWriter.delete(files[i].replace(".log", ".dev")); deleteCount++; } } reviewLogsCheckItems(flagSelected); removeDialog(DIALOG_ID_REVIEW); Toast.makeText(getApplicationContext(), deleteCount + " logs deleted.", Toast.LENGTH_SHORT).show(); } }, new OnClickListener() { //Cancel Delete @Override public void onClick(DialogInterface dialog, int which) { //Do nothing dialog.dismiss(); Toast.makeText(getApplicationContext(), "Delete cancelled.", Toast.LENGTH_SHORT).show(); } }, false); } }) /** * Send to server functional **/ .setNeutralButton("Send to Server", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if (isOnline()) { ArrayList<String> filesList = new ArrayList<String>(); for (int i = 0; i < selected.length; i++) if (selected[i]) { filesList.add(LogWriter.APPEND_PATH + files[i]); //Move to httplogsender //setSentFlags(files[i], 1, MainActivity.this); //Mark file as sent } if (reviewLogsCheckItems(filesList.size() > 0 ? true : false)) { DataPersistence d = new DataPersistence(getApplicationContext()); new HttpLogSender(MainActivity.this, d.getServerName() + getString(R.string.submit_log_url), filesList) .setToken(getToken()).execute(); } // removeDialog(DIALOG_ID_REVIEW); } else { standardAlertDialog(getString(R.string.msg_alert), getString(R.string.msg_no_internet), null); } } }) /** * Email **/ .setPositiveButton("eMail", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { boolean flagSelected = false; // convert from paths to Android friendly // Parcelable Uri's ArrayList<Uri> uris = new ArrayList<Uri>(); for (int i = 0; i < selected.length; i++) if (selected[i]) { flagSelected = true; /** wifi **/ File fileIn = new File(LogWriter.APPEND_PATH + files[i]); Uri u = Uri.fromFile(fileIn); uris.add(u); /** sensors **/ File fileInSensors = new File( LogWriter.APPEND_PATH + files[i].replace(".log", ".dev")); Uri uSens = Uri.fromFile(fileInSensors); uris.add(uSens); setSentFlags(files[i], 2, MainActivity.this); //Mark file as emailed } if (reviewLogsCheckItems(flagSelected)) { /** * Run sending email activity */ Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE); emailIntent.setType("plain/text"); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Wifi Searcher Scan Log"); emailIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris); startActivity(Intent.createChooser(emailIntent, "Send mail...")); } // removeDialog(DIALOG_ID_REVIEW); } }).create(); ald.getListView().setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, final int position, long id) { AlertDialog segmentNameAlert = segmentNameDailog("Rename Segment", ald.getContext(), files[position], null, view, files, position); segmentNameAlert.setCanceledOnTouchOutside(false); segmentNameAlert.show(); return false; } }); return ald; } else { return standardAlertDialog(getString(R.string.msg_alert), getString(R.string.msg_log_nocount), new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { removeDialog(DIALOG_ID_REVIEW); } }); } }