Example usage for android.view LayoutInflater from

List of usage examples for android.view LayoutInflater from

Introduction

In this page you can find the example usage for android.view LayoutInflater from.

Prototype

public static LayoutInflater from(Context context) 

Source Link

Document

Obtains the LayoutInflater from the given context.

Usage

From source file:com.ximai.savingsmore.save.activity.AddGoodsAcitivyt.java

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.servise:
        Intent intent = new Intent();
        intent.setAction(Intent.ACTION_CALL);
        intent.setData(Uri.parse("tel:" + "58366991"));
        startActivity(intent);// www .j a  va 2 s  .  c o  m
        break;

    case R.id.one_classity:
        PopupWindowFromBottomUtil.shouRange(AddGoodsAcitivyt.this,
                LayoutInflater.from(AddGoodsAcitivyt.this).inflate(R.layout.business_my_center_activity, null),
                good_one_classify, new PopupWindowFromBottomUtil.Listener2() {
                    @Override
                    public void callBack(BaseMessage Id1, String content, PopupWindow popupWindow) {
                        yijifenlei.setTextColor(getResources().getColor(R.color.text_black));
                        yijifenlei.setText(Id1.Name);
                        myProduct.FirstClassId = Id1.Id;
                        oneId = Id1.Id;
                        popupWindow.dismiss();
                    }
                });
        break;
    case R.id.two_classity:
        if (null != oneId && !TextUtils.isEmpty(oneId)) {
            good_two_classify.clear();
            for (int i = 0; i < list.size(); i++) {
                if (null != list.get(i).Name && null != list.get(i).ParentId && null != list.get(i).Id
                        && list.get(i).ParentId.equals(oneId)) {
                    good_two_classify.add(list.get(i));
                }
            }
            PopupWindowFromBottomUtil.shouRange(
                    AddGoodsAcitivyt.this, LayoutInflater.from(AddGoodsAcitivyt.this)
                            .inflate(R.layout.business_my_center_activity, null),
                    good_two_classify, new PopupWindowFromBottomUtil.Listener2() {
                        @Override
                        public void callBack(BaseMessage Id1, String content, PopupWindow popupWindow) {
                            erjifenlei.setTextColor(getResources().getColor(R.color.text_black));
                            erjifenlei.setText(Id1.Name);
                            myProduct.SecondClassId = Id1.Id;
                            popupWindow.dismiss();
                        }
                    });
        } else {
            Toast.makeText(AddGoodsAcitivyt.this, "", Toast.LENGTH_SHORT).show();
        }
        break;
    case R.id.brand_name:
        PopupWindowFromBottomUtil.shouRange(AddGoodsAcitivyt.this,
                LayoutInflater.from(AddGoodsAcitivyt.this).inflate(R.layout.business_my_center_activity, null),
                brand_list, new PopupWindowFromBottomUtil.Listener2() {
                    @Override
                    public void callBack(BaseMessage Id1, String content, PopupWindow popupWindow) {
                        brand.setTextColor(getResources().getColor(R.color.text_black));
                        brand.setText(Id1.Name);
                        myProduct.BrandId = Id1.Id;
                        popupWindow.dismiss();
                    }
                });
        break;
    case R.id.xingshi_item:
        PopupWindowFromBottomUtil.shouSalesType(AddGoodsAcitivyt.this,
                LayoutInflater.from(AddGoodsAcitivyt.this).inflate(R.layout.business_my_center_activity, null),
                goodSalesTypes, new PopupWindowFromBottomUtil.Listenrt3() {
                    @Override
                    public void callback(GoodSalesType goodSalesType, PopupWindow popupWindow) {
                        myProduct.PromotionType = goodSalesType.Id;
                        yuan_price.setText("");
                        cuxiao_price.setText("");
                        cuxiao_text.setText("");
                        xingshi.setTextColor(getResources().getColor(R.color.text_black));
                        xingshi.setText(goodSalesType.Value);
                        xingshi_id = goodSalesType.Id;
                        if (goodSalesType.Id.equals("5")) {
                            yuan_price.setText("10");
                            cuxiao_price.setText("10");
                        } else if (goodSalesType.Id.equals("6")) {
                            yuan_price.setText("1");
                            cuxiao_price.setText("1");
                        } else if (goodSalesType.Id.equals("11")) {
                            yuan_price.setText("0");
                            cuxiao_price.setText("0");
                        } else if (goodSalesType.Id.equals("2")) {
                            cuxiao_text.setText("N?N");

                        }
                        popupWindow.dismiss();
                    }
                });
        break;
    case R.id.dizhi_item:
        PopupWindowFromBottomUtil.showAddress(AddGoodsAcitivyt.this,
                LayoutInflater.from(AddGoodsAcitivyt.this).inflate(R.layout.business_my_center_activity, null),
                list, new PopupWindowFromBottomUtil.Listenre1() {
                    @Override
                    public void callBack(String Id1, String Id2, String Id3, String content,
                            PopupWindow popupWindow) {
                        myProduct.ProvinceId = Id1;
                        myProduct.CityId = Id2;
                        myProduct.AreaId = Id3;
                        dizhi.setTextColor(getResources().getColor(R.color.text_black));
                        dizhi.setText(content);
                        popupWindow.dismiss();
                    }
                });
        break;
    case R.id.start_time_item:
        UsePicker.showAll(AddGoodsAcitivyt.this, new UsePicker.CallBack() {
            @Override
            public void callBack(String time) {
                SimpleDateFormat dd = new SimpleDateFormat("yyyy-MM-dd HH:mm");
                Date date1 = null;
                try {
                    date1 = dd.parse(time);
                } catch (ParseException e) {
                    e.printStackTrace();
                }
                Long time1 = date1.getTime();
                Date dt = new Date();
                Long now = dt.getTime();
                if (now > time1) {
                    Toast.makeText(AddGoodsAcitivyt.this, "??",
                            Toast.LENGTH_SHORT).show();
                } else {
                    start_date = time;
                    myProduct.StartTime = time;
                    start.setTextColor(getResources().getColor(R.color.text_black));
                    start.setText(time);
                }
            }
        }, start.getText().toString());
        break;
    case R.id.end_time_item:
        UsePicker.showAll(AddGoodsAcitivyt.this, new UsePicker.CallBack() {
            @Override
            public void callBack(String time) {
                SimpleDateFormat dd = new SimpleDateFormat("yyyy-MM-dd");

                try {
                    Date date1 = dd.parse(start_date);
                    Date date2 = dd.parse(time);
                    Long time1 = date1.getTime();
                    Long time2 = date2.getTime();
                    if ((time2 > time1)) {
                        myProduct.EndTime = time;
                        end.setTextColor(getResources().getColor(R.color.text_black));
                        end.setText(time);
                    } else {
                        Toast.makeText(AddGoodsAcitivyt.this, "??",
                                Toast.LENGTH_SHORT).show();
                    }
                } catch (ParseException e) {
                    e.printStackTrace();
                }

            }
        }, end.getText().toString());
        break;
    case R.id.danwei_item:
        PopupWindowFromBottomUtil.shouRange(AddGoodsAcitivyt.this,
                LayoutInflater.from(AddGoodsAcitivyt.this).inflate(R.layout.business_my_center_activity, null),
                danwei_list, new PopupWindowFromBottomUtil.Listener2() {
                    @Override
                    public void callBack(BaseMessage Id1, String content, PopupWindow popupWindow) {
                        myProduct.UnitId = Id1.Id;
                        danwei.setTextColor(getResources().getColor(R.color.text_black));
                        danwei.setText(Id1.Name);
                        popupWindow.dismiss();
                    }
                });
        break;
    case R.id.bizhong_item:
        PopupWindowFromBottomUtil.shouRange(AddGoodsAcitivyt.this,
                LayoutInflater.from(AddGoodsAcitivyt.this).inflate(R.layout.business_my_center_activity, null),
                bizhong_list, new PopupWindowFromBottomUtil.Listener2() {
                    @Override
                    public void callBack(BaseMessage Id1, String content, PopupWindow popupWindow) {
                        myProduct.CurrencyId = Id1.Id;
                        bizhong.setTextColor(getResources().getColor(R.color.text_black));
                        bizhong.setText(Id1.Name);
                        popupWindow.dismiss();
                    }
                });
        break;
    case R.id.fapiao_item:
        PopupWindowFromBottomUtil.shouRange(AddGoodsAcitivyt.this,
                LayoutInflater.from(AddGoodsAcitivyt.this).inflate(R.layout.business_my_center_activity, null),
                fapiao_list, new PopupWindowFromBottomUtil.Listener2() {
                    @Override
                    public void callBack(BaseMessage Id1, String content, PopupWindow popupWindow) {
                        myProduct.InvoiceId = Id1.Id;
                        fapiao.setTextColor(getResources().getColor(R.color.text_black));
                        fapiao.setText(Id1.Name);
                        popupWindow.dismiss();
                    }
                });
        break;
    case R.id.btnCancel:
        setIconWindow.dismiss();
        break;
    case R.id.btnCamera:
        openCamera();
        setIconWindow.dismiss();
        break;
    case R.id.btnAlbum:
        openAlbum();
        setIconWindow.dismiss();
        break;
    case R.id.fabu:
        myProduct.Name = my_name.getText().toString();
        myProduct.Name = product_name.getText().toString();
        myProduct.Number = product_bianhao.getText().toString();
        myProduct.Address = xiangxi_address.getText().toString();
        myProduct.OriginalPrice = yuan_price.getText().toString();
        myProduct.Price = cuxiao_price.getText().toString();
        myProduct.Introduction = explain.getText().toString();
        myProduct.Description = explain.getText().toString();
        myProduct.Images = images;
        if (myProduct.Images.size() > 0 && null != myProduct.Name && null != myProduct.CityId
                && null != myProduct.InvoiceId && null != myProduct.Address && null != myProduct.AreaId
                && null != myProduct.BrandId && null != myProduct.CurrencyId && null != myProduct.CityId
                && null != myProduct.Description && null != myProduct.EndTime && null != myProduct.Description
                && null != myProduct.FirstClassId && null != myProduct.SecondClassId
                && null != myProduct.Description) {
            saveMyProduct(myProduct);
        } else {
            Toast.makeText(AddGoodsAcitivyt.this, "?", Toast.LENGTH_SHORT).show();
        }

        break;

    }
}

From source file:com.chaturs.notepad.NoteEditor.java

private void showDialogForTitle() {

    View view = LayoutInflater.from(this).inflate(R.layout.dialog_title, null);
    final EditText edit = (EditText) view.findViewById(R.id.edit);
    Button okButton = (Button) view.findViewById(R.id.ok);
    Button cancelButton = (Button) view.findViewById(R.id.cancel);

    edit.setText(title);/* w  w  w .ja  va  2  s .  com*/
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("Enter Title");
    builder.setView(view);
    builder.setCancelable(false);

    okButton.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            title = edit.getText().toString();

            if (title.trim().length() == 0) {
                edit.setError("Please Enter Some Text !");
                return;
            }

            saveNote();
            setTitle(title);
            dialog.dismiss();
        }
    });

    cancelButton.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {

            dialog.dismiss();

        }
    });

    dialog = builder.create();
    dialog.show();
}

From source file:com.bbxiaoqu.api.util.Utils.java

public static void makeEventToast(Context context, String text, boolean isLongToast) {

    Toast toast = null;/*from ww  w .  j  a v a2  s . c  om*/
    if (isLongToast) {
        toast = Toast.makeText(context, "", Toast.LENGTH_LONG);
    } else {
        toast = Toast.makeText(context, "", Toast.LENGTH_SHORT);
    }
    View v = LayoutInflater.from(context).inflate(R.layout.toast_view, null);
    TextView textView = (TextView) v.findViewById(R.id.text);
    textView.setText(text);
    toast.setView(v);
    toast.show();
}

From source file:cm.aptoide.pt.ApkInfo.java

public void loadMalware(final MalwareStatus malwareStatus) {
    runOnUiThread(new Runnable() {

        @Override// ww w. java 2  s  . com
        public void run() {
            try {
                EnumApkMalware apkStatus = EnumApkMalware
                        .valueOf(malwareStatus.getStatus().toUpperCase(Locale.ENGLISH));
                Log.d("ApkInfoMalware-malwareStatus", malwareStatus.getStatus());
                Log.d("ApkInfoMalware-malwareReason", malwareStatus.getReason());

                switch (apkStatus) {
                case SCANNED:
                    ((TextView) findViewById(R.id.app_badge_text)).setText(getString(R.string.trusted));
                    ((ImageView) findViewById(R.id.app_badge)).setImageResource(R.drawable.badge_scanned);
                    ((LinearLayout) findViewById(R.id.badge_layout)).setOnClickListener(new OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            View trustedView = LayoutInflater.from(ApkInfo.this)
                                    .inflate(R.layout.dialog_anti_malware, null);
                            AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(ApkInfo.this)
                                    .setView(trustedView);
                            final AlertDialog trustedDialog = dialogBuilder.create();
                            trustedDialog.setIcon(R.drawable.badge_scanned);
                            trustedDialog.setTitle(getString(R.string.app_trusted, viewApk.getName()));
                            trustedDialog.setCancelable(true);

                            TextView tvSignatureValidation = (TextView) trustedView
                                    .findViewById(R.id.tv_signature_validation);
                            tvSignatureValidation.setText(getString(R.string.signature_verified));
                            ImageView check_signature = (ImageView) trustedView
                                    .findViewById(R.id.check_signature);
                            check_signature.setImageResource(R.drawable.ic_yes);

                            trustedDialog.setButton(Dialog.BUTTON_NEUTRAL, "Ok", new Dialog.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface arg0, int arg1) {
                                    trustedDialog.dismiss();
                                }
                            });
                            trustedDialog.show();
                        }
                    });
                    break;
                //             case UNKNOWN:
                //                ((TextView) findViewById(R.id.app_badge_text)).setText(getString(R.string.unknown));
                //                ((ImageView) findViewById(R.id.app_badge)).setImageResource(R.drawable.badge_unknown);
                //                break;
                case WARN:
                    ((TextView) findViewById(R.id.app_badge_text)).setText(getString(R.string.warning));
                    ((ImageView) findViewById(R.id.app_badge)).setImageResource(R.drawable.badge_warn);
                    ((LinearLayout) findViewById(R.id.badge_layout)).setOnClickListener(new OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            View warnView = LayoutInflater.from(ApkInfo.this)
                                    .inflate(R.layout.dialog_anti_malware, null);
                            AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(ApkInfo.this)
                                    .setView(warnView);
                            final AlertDialog warnDialog = dialogBuilder.create();
                            warnDialog.setIcon(R.drawable.badge_warn);
                            warnDialog.setTitle(getString(R.string.app_warning, viewApk.getName()));
                            warnDialog.setCancelable(true);

                            TextView tvSignatureValidation = (TextView) warnView
                                    .findViewById(R.id.tv_signature_validation);
                            tvSignatureValidation.setText(getString(R.string.signature_not_verified));
                            ImageView check_signature = (ImageView) warnView.findViewById(R.id.check_signature);
                            check_signature.setImageResource(R.drawable.ic_failed);

                            warnDialog.setButton(Dialog.BUTTON_NEUTRAL, "Ok", new Dialog.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface arg0, int arg1) {
                                    warnDialog.dismiss();
                                }
                            });
                            warnDialog.show();
                        }
                    });
                    break;
                //             case CRITICAL:
                //                ((TextView) findViewById(R.id.app_badge_text)).setText(getString(R.string.critical));
                //                ((ImageView) findViewById(R.id.app_badge)).setImageResource(R.drawable.badge_critical);
                //                break;
                default:
                    break;
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

    });

}

From source file:android.support.v7.app.AlertController.java

private void setupCustomContent(ViewGroup customPanel) {
    final View customView;
    if (mView != null) {
        customView = mView;/* w  w w . ja v a 2  s  .co  m*/
    } else if (mViewLayoutResId != 0) {
        final LayoutInflater inflater = LayoutInflater.from(mContext);
        customView = inflater.inflate(mViewLayoutResId, customPanel, false);
    } else {
        customView = null;
    }

    final boolean hasCustomView = customView != null;
    if (!hasCustomView || !canTextInput(customView)) {
        mWindow.setFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
                WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
    }

    if (hasCustomView) {
        final FrameLayout custom = (FrameLayout) mWindow.findViewById(R.id.custom);
        custom.addView(customView, new LayoutParams(MATCH_PARENT, MATCH_PARENT));

        if (mViewSpacingSpecified) {
            custom.setPadding(mViewSpacingLeft, mViewSpacingTop, mViewSpacingRight, mViewSpacingBottom);
        }

        if (mListView != null) {
            ((LinearLayout.LayoutParams) customPanel.getLayoutParams()).weight = 0;
        }
    } else {
        customPanel.setVisibility(View.GONE);
    }
}

From source file:net.phase.wallet.Currency.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    double exchrate = Currency.getRate(context.getActiveCurrency());

    LayoutInflater inflater = LayoutInflater.from(context);

    View v = inflater.inflate(R.layout.walletlayout, null);
    v.setLongClickable(true);/*from w  ww .j  a v a 2 s . com*/
    v.setOnClickListener(context);
    v.setTag(position);

    DecimalFormat df = new DecimalFormat(WalletActivity.decimalString(decimalpoints));

    TextView balanceTextView = (TextView) v.findViewById(R.id.walletBalanceText);
    balanceTextView.setText(df.format(wallets[position].balance / BalanceRetriever.SATOSHIS_PER_BITCOIN));

    TextView curTextView = (TextView) v.findViewById(R.id.walletCurText);
    curTextView.setTextSize(10);

    if (exchrate != 0) {
        curTextView.setText(
                "(" + df.format(wallets[position].balance * exchrate / BalanceRetriever.SATOSHIS_PER_BITCOIN)
                        + context.getActiveCurrency() + ")");
    } else {
        curTextView.setText("");
    }

    balanceTextView.setTextSize(20);
    balanceTextView.setTextColor(Color.GREEN);

    TextView nameTextView = (TextView) v.findViewById(R.id.walletNameText);
    nameTextView.setText(wallets[position].name);
    nameTextView.setTextColor(Color.BLACK);
    nameTextView.setTextSize(16);

    TextView lastUpdatedTextView = (TextView) v.findViewById(R.id.lastUpdatedText);

    lastUpdatedTextView.setTextColor(Color.GRAY);
    lastUpdatedTextView.setTextSize(8);
    lastUpdatedTextView.setText("Last Updated: " + getTimeStampString(wallets[position].lastUpdated));

    TextView infoTextView = (TextView) v.findViewById(R.id.infoText);

    infoTextView.setTextColor(Color.GRAY);
    infoTextView.setTextSize(8);
    infoTextView.setText(
            wallets[position].keys.length + " keys (" + wallets[position].getActiveKeyCount() + " in use)");

    TextView txLastUpdatedTextView = (TextView) v.findViewById(R.id.txLastUpdatedText);
    txLastUpdatedTextView.setTextColor(Color.GRAY);
    txLastUpdatedTextView.setTextSize(8);

    TextView txInfoTextView = (TextView) v.findViewById(R.id.txInfoText);
    txInfoTextView.setTextColor(Color.GRAY);
    txInfoTextView.setTextSize(8);

    if (wallets[position].transactions != null && wallets[position].transactions.length > 0) {
        txLastUpdatedTextView.setText(
                "Last Transaction: " + getTimeStampString(Transaction.latest(wallets[position].transactions)));
        txInfoTextView.setText(wallets[position].transactions.length + " transactions ("
                + Transaction.compressTransactions(wallets[position].transactions).length + " unique)");
    } else {
        txLastUpdatedTextView.setText("");
        txInfoTextView.setText("");
    }

    Button button = (Button) v.findViewById(R.id.updateButton);
    button.setTag(position);
    button.setOnClickListener(context);
    return v;
}

From source file:com.example.util.Utils.java

/**
 * Show toast information/* w  w  w .  j a v  a2s . c  om*/
 * 
 * @param context
 *            application context
 * @param text
 *            the information which you want to show
 * @return show toast dialog
 */
public static void makeEventToast(Context context, String text, boolean isLongToast) {

    Toast toast = null;
    if (isLongToast) {
        toast = Toast.makeText(context, "", Toast.LENGTH_LONG);
    } else {
        toast = Toast.makeText(context, "", Toast.LENGTH_SHORT);
    }
    View v = LayoutInflater.from(context).inflate(R.layout.toast_view, null);
    TextView textView = (TextView) v.findViewById(R.id.text);
    textView.setText(text);
    toast.setView(v);
    toast.show();
}

From source file:tr.com.turkcellteknoloji.turkcellupdater.UpdaterDialogManager.java

@SuppressLint("NewApi")
private static View createMessageDialogContentsView(Activity activity, MessageDescription messageDescription) {

    Context context = activity;//w ww.  j  a  va 2  s  .c  om

    final AlertDialog.Builder builder;

    // Workaround for dialog theme problems
    if (android.os.Build.VERSION.SDK_INT > 10) {
        builder = new AlertDialog.Builder(context);
        context = builder.getContext();
    } else {
        context = new ContextThemeWrapper(context, android.R.style.Theme_Dialog);
        builder = new AlertDialog.Builder(context);
    }

    builder.setTitle("Send feedback");

    final LayoutInflater inflater = LayoutInflater.from(context);
    final View dialogContentsView = inflater.inflate(R.layout.updater_dialog_message, null, false);
    final TextView textView = (TextView) dialogContentsView.findViewById(R.id.dialog_update_message_text);
    final ImageView imageView = (ImageView) dialogContentsView.findViewById(R.id.dialog_update_message_image);
    final ViewSwitcher switcher = (ViewSwitcher) dialogContentsView
            .findViewById(R.id.dialog_update_message_switcher);

    String messageText = null;
    String imageUrl = null;

    if (messageDescription != null) {
        messageText = messageDescription.get(MessageDescription.KEY_MESSAGE);
        imageUrl = messageDescription.get(MessageDescription.KEY_IMAGE_URL);
    }

    if (Utilities.isNullOrEmpty(messageText)) {
        textView.setVisibility(View.GONE);
    } else {
        textView.setText(messageText);
    }

    if (Utilities.isNullOrEmpty(imageUrl)) {
        switcher.setVisibility(View.GONE);
    } else {
        URI uri;
        try {
            uri = new URI(imageUrl);
        } catch (URISyntaxException e) {
            uri = null;
        }

        if (uri != null) {
            DownloadRequest request = new DownloadRequest();
            request.setUri(uri);
            request.setDownloadHandler(new DownloadHandler() {

                @Override
                public void onSuccess(byte[] result) {
                    // Load image from byte array
                    final Bitmap bitmap = BitmapFactory.decodeByteArray(result, 0, result.length);
                    imageView.setImageBitmap(bitmap);

                    // Hide progress bar and display image
                    if (switcher != null) {
                        switcher.setDisplayedChild(1);
                    }
                }

                @Override
                public void onProgress(Integer percent) {

                }

                @Override
                public void onFail(Exception ex) {
                    Log.e("Message image couldn't be loaded", ex);
                }

                @Override
                public void onCancelled() {

                }
            });
            HttpClient client = Utilities.createClient("Turkcell Updater/1.0 ", false);
            try {
                request.executeAsync(client);
            } catch (Exception e) {
                Log.e("Message image couldn't be loaded", e);
            }

        } else {
            switcher.setVisibility(View.GONE);
        }

    }

    return dialogContentsView;
}

From source file:com.entertailion.android.dial.ServerFinder.java

private AlertDialog buildConfirmationDialog(final DialServer dialServer) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    View view = LayoutInflater.from(this).inflate(R.layout.device_info, null);
    final TextView ipTextView = (TextView) view.findViewById(R.id.device_info_ip_address);

    builder.setMessage(formatName(dialServer));
    ipTextView.setText(dialServer.getIpAddress().getHostAddress());

    return builder.setTitle(R.string.finder_label).setCancelable(false)
            .setPositiveButton(R.string.finder_connect, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialogInterface, int id) {
                    connectToEntry(dialServer);
                }/*www.j a v a2s . c  om*/
            }).setNegativeButton(R.string.finder_add_other, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialogInterface, int id) {
                    showOtherDevices();
                }
            }).create();
}