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:edu.cens.loci.ui.VisitDetailActivity.java

@Override
protected Dialog onCreateDialog(int id, Bundle args) {
    LayoutInflater factory = LayoutInflater.from(this);

    switch (id) {
    case DIALOG_WIFI:
        final View wifiView = factory.inflate(R.layout.dialog_wifi_view, null);
        final TableLayout wifiTable = (TableLayout) wifiView.findViewById(R.id.wifi_table);
        //updateWifiList(wifiTable, mPlace.wifis.get(0));
        String wifiJson = args.getString("wifi");
        //Log.d(TAG, "createDialog: " + wifiJson);
        try {/*from   w  w w .  j ava  2  s.  com*/
            updateWifiList(wifiTable, new LociWifiFingerprint(wifiJson));
        } catch (JSONException e) {
            MyLog.e(LociConfig.D.JSON, TAG, "updateWifiList: json failed.");
            e.printStackTrace();
            return null;
        }
        return new AlertDialog.Builder(this).setIcon(R.drawable.ic_settings_wireless)
                .setTitle("Nearby Wi-Fi Access Points").setView(wifiView)
                .setPositiveButton("Close", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {

                    }
                }).create();
    case DIALOG_RECOGNITION:
        final View recognitionView = factory.inflate(R.layout.dialog_recogresult_view, null);
        final ListView recognitionList = (ListView) recognitionView.findViewById(android.R.id.list);
        updateRecognitionList(recognitionList, args.getString("recognition"));
        return new AlertDialog.Builder(this).setIcon(R.drawable.ic_clock_strip_desk_clock)
                .setTitle("Recognition Results").setView(recognitionView)
                .setPositiveButton("Close", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {

                    }
                }).create();
    case DIALOG_CHANGE_PLACE:

        CharSequence[] items = { getResources().getString(R.string.visitDetail_addWiFiPlace) };
        final Intent intent = args.getParcelable("intent");
        return new AlertDialog.Builder(this).setIcon(android.R.drawable.ic_menu_edit).setTitle("Change place")
                .setItems(items, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {

                        /* User clicked so do some stuff */
                        switch (which) {
                        case 0:
                            startActivityForResult(intent, SUBACTIVITY_CHANGE_PLACE);
                        default:
                            break;
                        }

                    }
                }).create();
    }
    return null;
}

From source file:ee.ria.DigiDoc.fragment.ContainerDetailsFragment.java

private void createPinDialog() {
    View view = LayoutInflater.from(getActivity()).inflate(R.layout.enter_pin, null);
    enterPinText = findById(view, R.id.enterPin);
    pinText = findById(view, R.id.pin);//from   www  .j av  a2s .  c o m
    pinText.setHint(Token.PinType.PIN2.name());
    final AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
    builder.setPositiveButton(R.string.sign_button, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            tokenService.readCert(Token.CertType.CertSign, new CertificateInfoCallback());
        }
    }).setNegativeButton(R.string.cancel, null);
    builder.setView(view);
    pinDialog = builder.create();
}

From source file:android.com.example.contactslist.ui.ContactDetailFragment.java

/**
 * Builds an address LinearLayout based on address information from the Contacts Provider.
 * Each address for the contact gets its own LinearLayout object; for example, if the contact
 * has three postal addresses, then 3 LinearLayouts are generated.
 *
 * @param addressType From/*w  ww.j a va2 s  . c  o  m*/
 * {@link StructuredPostal#TYPE}
 * @param addressTypeLabel From
 * {@link StructuredPostal#LABEL}
 * @param address From
 * {@link StructuredPostal#FORMATTED_ADDRESS}
 * @return A LinearLayout to add to the contact details layout,
 *         populated with the provided address details.
 */
private LinearLayout buildAddressLayout(int addressType, String addressTypeLabel, final String address) {

    // Inflates the address layout
    final LinearLayout addressLayout = (LinearLayout) LayoutInflater.from(getActivity())
            .inflate(R.layout.contact_detail_item, mDetailsLayout, false);

    // Gets handles to the view objects in the layout
    final TextView headerTextView = (TextView) addressLayout.findViewById(R.id.contact_detail_header);
    final TextView addressTextView = (TextView) addressLayout.findViewById(R.id.contact_detail_item);
    final ImageButton viewAddressButton = (ImageButton) addressLayout.findViewById(R.id.button_view_address);

    // If there's no addresses for the contact, shows the empty view and message, and hides the
    // header and button.
    if (addressTypeLabel == null && addressType == 0) {
        headerTextView.setVisibility(View.GONE);
        viewAddressButton.setVisibility(View.GONE);
        addressTextView.setText(R.string.no_address);
    } else {
        // Gets postal address label type
        CharSequence label = StructuredPostal.getTypeLabel(getResources(), addressType, addressTypeLabel);

        // Sets TextView objects in the layout
        headerTextView.setText(label);
        addressTextView.setText(address);

        // Defines an onClickListener object for the address button
        viewAddressButton.setOnClickListener(new View.OnClickListener() {
            // Defines what to do when users click the address button
            @Override
            public void onClick(View view) {

                final Intent viewIntent = new Intent(Intent.ACTION_VIEW, constructGeoUri(address));

                // A PackageManager instance is needed to verify that there's a default app
                // that handles ACTION_VIEW and a geo Uri.
                final PackageManager packageManager = getActivity().getPackageManager();

                // Checks for an activity that can handle this intent. Preferred in this
                // case over Intent.createChooser() as it will still let the user choose
                // a default (or use a previously set default) for geo Uris.
                if (packageManager.resolveActivity(viewIntent, PackageManager.MATCH_DEFAULT_ONLY) != null) {
                    startActivity(viewIntent);
                } else {
                    // If no default is found, displays a message that no activity can handle
                    // the view button.
                    Toast.makeText(getActivity(), R.string.no_intent_found, Toast.LENGTH_SHORT).show();
                }
            }
        });

    }
    return addressLayout;
}

From source file:edu.cens.loci.ui.widget.GenericEditorView.java

private void createWifiDialog() {

    //Log.i("GenericEditor", "createWifiDialog");

    Context context = getContext();
    LayoutInflater factory = LayoutInflater.from(context);

    final View wifiView = factory.inflate(R.layout.dialog_wifi_view, null);

    final TableLayout wifiTable = (TableLayout) wifiView.findViewById(R.id.wifi_table);

    updateWifiList(wifiTable, mWifiFingerprint);

    new AlertDialog.Builder(context).setIcon(R.drawable.ic_settings_wireless)
            .setTitle(mWifiFingerprintTimeStamp).setView(wifiView)
            .setPositiveButton("Close", new DialogInterface.OnClickListener() {

                public void onClick(DialogInterface dialog, int which) {
                    // TODO Auto-generated method stub

                }/*from w w w . j a  va 2  s .  c o m*/
            }).create().show();

}

From source file:com.example.zf_android.activity.MerchantEdit.java

private void show3Dialog(int type, final String uri) {
    AlertDialog.Builder builder = new AlertDialog.Builder(MerchantEdit.this);
    final String[] items = getResources().getStringArray(R.array.apply_detail_view);

    MerchantEdit.this.type = type;
    builder.setItems(items, new DialogInterface.OnClickListener() {
        @Override/*w  ww.  j  av a 2s . co m*/
        public void onClick(DialogInterface dialog, int which) {

            switch (which) {
            case 0: {

                AlertDialog.Builder build = new AlertDialog.Builder(MerchantEdit.this);
                LayoutInflater factory = LayoutInflater.from(MerchantEdit.this);
                final View textEntryView = factory.inflate(R.layout.show_view, null);
                build.setView(textEntryView);
                final ImageView view = (ImageView) textEntryView.findViewById(R.id.imag);
                //               ImageCacheUtil.IMAGE_CACHE.get(uri, view);
                ImageLoader.getInstance().displayImage(uri, view, options);
                build.create().show();
                break;
            }

            case 1: {

                Intent intent;
                if (Build.VERSION.SDK_INT < 19) {
                    intent = new Intent(Intent.ACTION_GET_CONTENT);
                    intent.setType("image/*");
                } else {
                    intent = new Intent(Intent.ACTION_PICK,
                            android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
                }
                startActivityForResult(intent, REQUEST_UPLOAD_IMAGE);
                break;
            }
            case 2: {
                String state = Environment.getExternalStorageState();
                if (state.equals(Environment.MEDIA_MOUNTED)) {
                    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
                    File outDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
                    if (!outDir.exists()) {
                        outDir.mkdirs();
                    }
                    File outFile = new File(outDir, System.currentTimeMillis() + ".jpg");
                    photoPath = outFile.getAbsolutePath();
                    intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(outFile));
                    intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
                    startActivityForResult(intent, REQUEST_TAKE_PHOTO);
                } else {
                    CommonUtil.toastShort(MerchantEdit.this, getString(R.string.toast_no_sdcard));
                }
                break;
            }
            }
        }
    });

    builder.show();
}

From source file:com.azita.iot.ioclient.activity.MainActivity.java

public void showDialog_powerbar(View view) {
    View dialogView = LayoutInflater.from(this).inflate(R.layout.share_bottom_dialog_powerbar, null);
    final ShareBottomPopupDialog shareBottomPopupDialog = new ShareBottomPopupDialog(this, dialogView);
    shareBottomPopupDialog.showPopup(all_layout);

    ImageButton powerbar_powerbar_btn = (ImageButton) dialogView.findViewById(R.id.powerbar_powerbar_btn);
    powerbar_powerbar_btn.setOnClickListener(new View.OnClickListener() {
        @Override/* ww  w .  j a v  a2  s. c o  m*/
        public void onClick(View view) {
            if (powerbar_powerbar_btn_flag == 1) {
                Toast.makeText(MainActivity.this, "Power Bar Off", Toast.LENGTH_SHORT).show();
                if (powerbar_powerbar_btn_flag == 1 && powerbar_magcharging_btn_flag == 0
                        && powerbar_conference_btn_flag == 0 && powerbar_display_btn_flag == 0) {

                }
                powerbar_powerbar_btn_flag = 0;
            } else {
                Toast.makeText(MainActivity.this, "Power Bar On", Toast.LENGTH_SHORT).show();
                powerbar_powerbar_btn_flag = 1;
            }
            _powerbar_powerbar_btn = 1;
            String dummy = "{\"customerID\":2110, \"classID\":1022, \"typeID\":1001, \"DeviceID\":1001, \"value\":\"0000"
                    + powerbar_display_btn_flag + powerbar_conference_btn_flag + powerbar_magcharging_btn_flag
                    + powerbar_powerbar_btn_flag + "B\"}";
            MQTTHelper_.getInstance_(mContext).publish(dummy, true);
            shareBottomPopupDialog.dismiss();
        }
    });
    if (_powerbar_powerbar_btn == 1) {
        if (powerbar_powerbar_btn_flag == 1) {
            powerbar_powerbar_btn.setImageResource(R.mipmap.opt_powerbar_1);
        } else {
            powerbar_powerbar_btn.setImageResource(R.mipmap.opt_powerbar_0);
        }
    }
    ImageButton powerbar_magcharging_btn = (ImageButton) dialogView.findViewById(R.id.powerbar_magcharging_btn);
    powerbar_magcharging_btn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (powerbar_magcharging_btn_flag == 1) {
                Toast.makeText(MainActivity.this, "Magnetic Charger Disabled", Toast.LENGTH_SHORT).show();
                if (powerbar_powerbar_btn_flag == 0 && powerbar_magcharging_btn_flag == 1
                        && powerbar_conference_btn_flag == 0 && powerbar_display_btn_flag == 0) {

                }
                powerbar_magcharging_btn_flag = 0;
            } else {
                Toast.makeText(MainActivity.this, "Magnetic Charger Enabled", Toast.LENGTH_SHORT).show();
                powerbar_magcharging_btn_flag = 1;
            }
            _powerbar_magcharging_btn = 1;
            String dummy = "{\"customerID\":2110, \"classID\":1022, \"typeID\":1001, \"DeviceID\":1001, \"value\":\"0000"
                    + powerbar_display_btn_flag + powerbar_conference_btn_flag + powerbar_magcharging_btn_flag
                    + powerbar_powerbar_btn_flag + "B\"}";
            MQTTHelper_.getInstance_(mContext).publish(dummy, true);
            shareBottomPopupDialog.dismiss();
        }
    });
    if (_powerbar_magcharging_btn == 1) {
        if (powerbar_magcharging_btn_flag == 1) {
            powerbar_magcharging_btn.setImageResource(R.mipmap.opt_magcharging_1);
        } else {
            powerbar_magcharging_btn.setImageResource(R.mipmap.opt_magcharging_0);
        }
    }
    ImageButton powerbar_conference_btn = (ImageButton) dialogView.findViewById(R.id.powerbar_conference_btn);
    powerbar_conference_btn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (powerbar_conference_btn_flag == 1) {
                Toast.makeText(MainActivity.this, "Conference System Disabled", Toast.LENGTH_SHORT).show();
                if (powerbar_powerbar_btn_flag == 0 && powerbar_magcharging_btn_flag == 0
                        && powerbar_conference_btn_flag == 1 && powerbar_display_btn_flag == 0) {

                }
                powerbar_conference_btn_flag = 0;
            } else {
                Toast.makeText(MainActivity.this, "Conference System Enabled", Toast.LENGTH_SHORT).show();
                powerbar_conference_btn_flag = 1;
            }
            _powerbar_conference_btn = 1;
            String dummy = "{\"customerID\":2110, \"classID\":1022, \"typeID\":1001, \"DeviceID\":1001, \"value\":\"0000"
                    + powerbar_display_btn_flag + powerbar_conference_btn_flag + powerbar_magcharging_btn_flag
                    + powerbar_powerbar_btn_flag + "B\"}";
            MQTTHelper_.getInstance_(mContext).publish(dummy, true);
            shareBottomPopupDialog.dismiss();
        }
    });
    if (_powerbar_conference_btn == 1) {
        if (powerbar_conference_btn_flag == 1) {
            powerbar_conference_btn.setImageResource(R.mipmap.opt_conference_1);
        } else {
            powerbar_conference_btn.setImageResource(R.mipmap.opt_conference_0);
        }
    }
    ImageButton powerbar_display_btn = (ImageButton) dialogView.findViewById(R.id.powerbar_display_btn);
    powerbar_display_btn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (powerbar_display_btn_flag == 1) {
                Toast.makeText(MainActivity.this, "Projector Power Off", Toast.LENGTH_SHORT).show();
                if (powerbar_powerbar_btn_flag == 0 && powerbar_magcharging_btn_flag == 0
                        && powerbar_conference_btn_flag == 0 && powerbar_display_btn_flag == 1) {

                }
                powerbar_display_btn_flag = 0;
            } else {
                Toast.makeText(MainActivity.this, "Projector Power On", Toast.LENGTH_SHORT).show();
                powerbar_display_btn_flag = 1;
            }
            _powerbar_display_btn = 1;
            String dummy = "{\"customerID\":2110, \"classID\":1022, \"typeID\":1001, \"DeviceID\":1001, \"value\":\"0000"
                    + powerbar_display_btn_flag + powerbar_conference_btn_flag + powerbar_magcharging_btn_flag
                    + powerbar_powerbar_btn_flag + "B\"}";
            MQTTHelper_.getInstance_(mContext).publish(dummy, true);
            shareBottomPopupDialog.dismiss();
        }
    });
    if (_powerbar_display_btn == 1) {
        if (powerbar_display_btn_flag == 1) {
            powerbar_display_btn.setImageResource(R.mipmap.opt_display_1);
        } else {
            powerbar_display_btn.setImageResource(R.mipmap.opt_display_0);
        }
    }
    Button share_pop_cancle_btn = (Button) dialogView.findViewById(R.id.share_pop_cancle_btn);
    share_pop_cancle_btn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            shareBottomPopupDialog.dismiss();
        }
    });
}

From source file:ee.ria.DigiDoc.fragment.ContainerDetailsFragment.java

private void startMobileSign() {
    View view = LayoutInflater.from(getActivity()).inflate(R.layout.mobile_id_dialogue, null);
    final EditText mobileNr = findById(view, R.id.mobile_nr);
    final EditText personalCode = findById(view, R.id.personal_code);
    final CheckBox rememberMe = findById(view, R.id.remember_me);

    final AppPreferences preferences = AppPreferences.get(getContext());
    mobileNr.setText(preferences.getMobileNumber());
    personalCode.setText(preferences.getPersonalCode());

    final AlertDialog.Builder builder = new AlertDialog.Builder(getContext())
            .setPositiveButton(R.string.sign_button, new DialogInterface.OnClickListener() {
                @Override/*  w  ww  .  j  a  v a 2s .com*/
                public void onClick(DialogInterface dialog, int which) {
                    refreshContainerFacade();
                    String phone = mobileNr.getText().toString();
                    String pCode = personalCode.getText().toString();
                    if (rememberMe.isChecked()) {
                        preferences.updateMobileNumber(phone);
                        preferences.updatePersonalCode(pCode);
                    }
                    String message = getResources().getString(R.string.action_sign) + " "
                            + containerFacade.getName();
                    MobileCreateSignatureRequest request = CreateSignatureRequestBuilder
                            .aCreateSignatureRequest().withContainer(containerFacade).withIdCode(pCode)
                            .withPhoneNr(phone).withDesiredMessageToDisplay(message)
                            .withLocale(Locale.getDefault())
                            .withLocalSigningProfile(getFutureSignatureProfile()).build();
                    Intent mobileSignIntent = new Intent(getActivity(), MobileSignService.class);
                    mobileSignIntent.putExtra(CREATE_SIGNATURE_REQUEST, toJson(request));
                    mobileSignIntent.putExtra(ACCESS_TOKEN_PASS, Conf.instance().PKCS12Pass());
                    mobileSignIntent.putExtra(ACCESS_TOKEN_PATH,
                            new File(FileUtils.getSchemaCacheDirectory(getContext()), "878252.p12")
                                    .getAbsolutePath());
                    getActivity().startService(mobileSignIntent);
                    disableSigning();
                }
            }).setNegativeButton(R.string.cancel, null).setView(view);
    notificationUtil.clearMessages();
    builder.show();
}

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

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.submit:
        if (store_name.getText() == null || TextUtils.isEmpty(store_name.getText())) {
            Toast.makeText(BusinessMyCenterActivity.this, "??", Toast.LENGTH_SHORT).show();
        } else if (phone_number.getText() == null || TextUtils.isEmpty(phone_number.getText())) {
            Toast.makeText(BusinessMyCenterActivity.this, "?", Toast.LENGTH_SHORT).show();
        }/*from   w ww.  ja  va2  s .  co  m*/

        //                else if (website.getText() == null || TextUtils.isEmpty(website.getText())) {
        //                    Toast.makeText(BusinessMyCenterActivity.this, "", Toast.LENGTH_SHORT).show();
        //                } else if (weChat.getText() == null || TextUtils.isEmpty(weChat.getText())) {
        //                    Toast.makeText(BusinessMyCenterActivity.this, "", Toast.LENGTH_SHORT).show();
        //                }

        else if (address.getmTvRightText() == null || TextUtils.isEmpty(address.getmTvRightText())) {
            Toast.makeText(BusinessMyCenterActivity.this, "?", Toast.LENGTH_SHORT).show();
        } else if (xixiang_adress.getText() == null || TextUtils.isEmpty(xixiang_adress.getText())) {
            Toast.makeText(BusinessMyCenterActivity.this, "", Toast.LENGTH_SHORT).show();
        } else if (create_date.getmTvRightText() == null || TextUtils.isEmpty(create_date.getmTvRightText())) {
            Toast.makeText(BusinessMyCenterActivity.this, "??", Toast.LENGTH_SHORT)
                    .show();
        } else if (zhizhao_number.getText() == null || TextUtils.isEmpty(zhizhao_number.getText())) {
            Toast.makeText(BusinessMyCenterActivity.this, "???", Toast.LENGTH_SHORT)
                    .show();
        } else if (zhegnshu_number.getText() == null || TextUtils.isEmpty(zhegnshu_number.getText())) {
            Toast.makeText(BusinessMyCenterActivity.this, "????", Toast.LENGTH_SHORT).show();
        } else if (xukezheng_path == null || TextUtils.isEmpty(xukezheng_path)) {
            Toast.makeText(BusinessMyCenterActivity.this, "??", Toast.LENGTH_SHORT)
                    .show();
        } else if (position.getText() == null || TextUtils.isEmpty(position.getText())) {
            Toast.makeText(BusinessMyCenterActivity.this, "???", Toast.LENGTH_SHORT).show();
        } else if (xiliren_number.getText() == null || TextUtils.isEmpty(xiliren_number.getText())) {
            Toast.makeText(BusinessMyCenterActivity.this, "?", Toast.LENGTH_SHORT)
                    .show();
        } else if (lianxiren.getText() == null || TextUtils.isEmpty(lianxiren.getText())) {
            Toast.makeText(BusinessMyCenterActivity.this, "?", Toast.LENGTH_SHORT).show();
        } else if (good_type.getmTvRightText() == null || TextUtils.isEmpty(good_type.getmTvRightText())
                && good_type.getmTvRightText().equals("")) {
            Toast.makeText(BusinessMyCenterActivity.this, "?", Toast.LENGTH_SHORT).show();
        } else if (good_range.getmTvRightText() == null || TextUtils.isEmpty(good_range.getmTvRightText())
                && good_range.getmTvRightText().equals("")) {
            Toast.makeText(BusinessMyCenterActivity.this, "?", Toast.LENGTH_SHORT).show();
        } else if (zhizhao_path == null || TextUtils.isEmpty(zhizhao_path)) {
            Toast.makeText(BusinessMyCenterActivity.this, "?", Toast.LENGTH_SHORT).show();
        } else {
            myUserExtInfo.StoreName = store_name.getText().toString();
            myUserExtInfo.OfficePhone = phone_number.getText().toString();
            myUserExtInfo.WebSite = website.getText().toString();
            userParameter.WeChat = weChat.getText().toString();
            userParameter.Domicile = xixiang_adress.getText().toString();
            myUserExtInfo.FoundingDate = create_date.getmTvRightText();
            myUserExtInfo.BusinessLicenseNumber = zhizhao_number.getText().toString();
            myUserExtInfo.LicenseKeyNumber = zhegnshu_number.getText().toString();
            userParameter.UserDisplayName = lianxiren.getText().toString();
            userParameter.Post = position.getText().toString();
            list_images.addAll(images);
            myUserExtInfo.Images = list_images;
            if (good_type.getmTvRightText().equals("???")) {
                myUserExtInfo.IsBag = "true";
            } else {
                myUserExtInfo.IsBag = "false";
            }
            list1.add(myBusinessScopes);
            userParameter.BusinessScopes = list1;
            userParameter.UserExtInfo = myUserExtInfo;
            if (a == b) {
                save_message(userParameter);
            }
        }
        break;
    case R.id.create_time:
        UsePicker.showYearMonthDay(BusinessMyCenterActivity.this, new UsePicker.CallBack() {
            @Override
            public void callBack(String time) {
                create_date.getmTvRight_().setText(time);
                myUserExtInfo.FoundingDate = time;
            }
        }, create_date.getmTvRightText());
        break;
    case R.id.yingye_start:
        UsePicker.showHuors(BusinessMyCenterActivity.this, new UsePicker.CallBack() {
            @Override
            public void callBack(String time) {
                yingye_start.getmTvRight_().setText(time);
                myUserExtInfo.StartHours = time;
            }
        }, yingye_start.getmTvRightText());
        break;
    case R.id.yingye_end:
        UsePicker.showHuors(BusinessMyCenterActivity.this, new UsePicker.CallBack() {
            @Override
            public void callBack(String time) {
                yingye_end.getmTvRight_().setText(time);
                myUserExtInfo.EndHours = time;
            }
        }, yingye_end.getmTvRightText());
        break;
    case R.id.head_image:
        isslinece = false;
        isItem = false;
        isheadImage = true;
        isZhengshu = false;
        showSetIconWindow();
        break;

    case R.id.good_type:
        PopupWindowFromBottomUtil.shouWindowWithWheel(
                BusinessMyCenterActivity.this, LayoutInflater.from(BusinessMyCenterActivity.this)
                        .inflate(R.layout.business_my_center_activity, null),
                list_type, new PopupWindowFromBottomUtil.Listener() {
                    @Override
                    public void confirm(String content, PopupWindow window) {
                        good_type.getmTvRight_().setText(content);
                        window.dismiss();
                    }
                });
        break;
    case R.id.range:
        if (good_type.getmTvRightText().equals("???")) {
            PopupWindowFromBottomUtil.shouRange(BusinessMyCenterActivity.this,
                    LayoutInflater.from(BusinessMyCenterActivity.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) {
                            good_range.getmTvRight_().setText(content);
                            //                            myDictNode.Name = Id1.Name;
                            //                            myDictNode.SortNo = Id1.SortNo;
                            //                            myDictNode.Id=Id1.Id;
                            myBusinessScopes.DictNodeId = Id1.Id;
                            popupWindow.dismiss();
                        }
                    });
        } else {
            PopupWindowFromBottomUtil.shouRange(BusinessMyCenterActivity.this,
                    LayoutInflater.from(BusinessMyCenterActivity.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) {
                            good_range.getmTvRight_().setText(content);
                            //                            myDictNode.Name = Id1.Name;
                            //                            myDictNode.SortNo = Id1.SortNo;
                            //                            myDictNode.Id=Id1.Id;
                            myBusinessScopes.DictNodeId = Id1.Id;
                            popupWindow.dismiss();
                        }
                    });
        }
        break;
    case R.id.adress:
        PopupWindowFromBottomUtil.showAddress(
                BusinessMyCenterActivity.this, LayoutInflater.from(BusinessMyCenterActivity.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) {
                        if (null != Id1) {
                            userParameter.ProvinceId = Id1;
                        }
                        if (null != Id2) {
                            userParameter.CityId = Id2;
                        }
                        if (null != Id3) {
                            userParameter.AreaId = Id3;
                        }
                        address.getmTvRight_().setText(content);
                        popupWindow.dismiss();
                    }

                });
        break;
    case R.id.liscense_item:
        isslinece = true;
        isItem = false;
        isheadImage = false;
        isZhengshu = false;
        showSetIconWindow();
        break;
    case R.id.zhengshu_item:
        isItem = false;
        isheadImage = false;
        isslinece = false;
        isZhengshu = true;
        showSetIconWindow();
        break;
    case R.id.btnCancel:
        setIconWindow.dismiss();
        break;
    case R.id.btnCamera:
        openCamera();
        setIconWindow.dismiss();
        break;
    case R.id.btnAlbum:
        openAlbum();
        setIconWindow.dismiss();
        break;
    }
}

From source file:com.insthub.O2OMobile.Activity.D1_OrderActivity.java

private void showOrderDialog(boolean isSucceed, orderacceptResponse response) {
    LayoutInflater inflater = LayoutInflater.from(D1_OrderActivity.this);
    View view = inflater.inflate(R.layout.d1_order_dialog, null);
    mOrderDialog = new Dialog(D1_OrderActivity.this, R.style.dialog);
    mOrderDialog.setContentView(view);//from   w w w .ja  v  a 2  s . c  o m
    mOrderDialog.setCanceledOnTouchOutside(false);
    mOrderDialog.show();

    Button order_dialog_button = (Button) view.findViewById(R.id.order_dialog_button);
    ImageView order_dialog_icon = (ImageView) view.findViewById(R.id.order_dialog_icon);
    TextView order_dialog_text = (TextView) view.findViewById(R.id.order_dialog_text);
    TextView order_dialog_error_text = (TextView) view.findViewById(R.id.order_dialog_error_text);

    if (isSucceed) {
        order_dialog_icon.setImageResource(R.drawable.b2_selected_icon);
        order_dialog_text.setText(getString(R.string.receive_order_success));
        order_dialog_text.setTextColor(Color.parseColor("#39BCED"));
    } else {
        order_dialog_icon.setImageResource(R.drawable.d3_failed);
        order_dialog_text.setText(getString(R.string.receive_order_fail));
        order_dialog_text.setTextColor(Color.parseColor("#f65858"));
        order_dialog_error_text.setText(response.error_desc);
    }

    order_dialog_button.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            mOrderDialog.dismiss();
        }
    });
}