Example usage for android.view View getId

List of usage examples for android.view View getId

Introduction

In this page you can find the example usage for android.view View getId.

Prototype

@IdRes
@ViewDebug.CapturedViewProperty
public int getId() 

Source Link

Document

Returns this view's identifier.

Usage

From source file:com.appolis.receiving.AcReceiveOptionMove.java

@Override
public void onClick(View v) {
    Intent intent;// w w w.  j  a v a  2s .c  om

    switch (v.getId()) {
    case R.id.img_main_menu_scan_barcode:
        intent = new Intent(this, CaptureBarcodeCamera.class);
        startActivityForResult(intent, GlobalParams.CAPTURE_BARCODE_CAMERA_ACTIVITY);
        break;

    case R.id.btnOK:
        //validate and commit data
        checkAndCommitData();
        break;

    case R.id.btnCancel:
        setResult(RESULT_CANCELED);
        this.finish();
        break;
    default:
        break;
    }
}

From source file:chaitanya.im.searchforreddit.LauncherActivity.java

public void showPopup(View view) {
    UtilMethods.hideKeyboard(this);
    PopupMenu popupMenu = new PopupMenu(this, view);
    MenuInflater inflater = popupMenu.getMenuInflater();
    if (view.getId() == R.id.time_button) {
        inflater.inflate(R.menu.time_filter, popupMenu.getMenu());
        popupMenu.setOnMenuItemClickListener(timePopupListener);
    } else if (view.getId() == R.id.sort_button) {
        inflater.inflate(R.menu.sort_filter, popupMenu.getMenu());
        popupMenu.setOnMenuItemClickListener(sortPopupListener);
    }/*from  w  ww.  ja  v a2  s. c  om*/
    popupMenu.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();
        }//w w  w .  j a  v a 2 s.c o  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.ved.musicmapapp.LoginAcitivity.java

@Override
public void onClick(View v) {
    if (v.getId() == R.id.btn_login) {
        onClickLogin();//from   w w w  . ja  v a  2s.c  om
    } /*else if (v.getId() == R.id.tab_join) {
       tab_join.setBackgroundResource(R.drawable.bg_tab_press);
       tab_about.setBackgroundResource(R.drawable.bg_btn_tab);
      } else if (v.getId() == R.id.tab_about) {
       tab_join.setBackgroundResource(R.drawable.bg_btn_tab);
       tab_about.setBackgroundResource(R.drawable.bg_tab_press);
      }*/
}

From source file:com.sim2dial.dialer.ChatFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    if (v.getId() == R.id.sendPicture) {
        menu.add(0, MENU_PICTURE_SMALL, 0, getString(R.string.share_picture_size_small));
        menu.add(0, MENU_PICTURE_MEDIUM, 0, getString(R.string.share_picture_size_medium));
        menu.add(0, MENU_PICTURE_LARGE, 0, getString(R.string.share_picture_size_large));
        // Not a good idea, very big pictures cause Out of Memory
        // exceptions, slow display, ...
        // menu.add(0, MENU_PICTURE_REAL, 0,
        // getString(R.string.share_picture_size_real));
    } else {//from  w  w w.ja  va2s  .  c  o m
        menu.add(v.getId(), MENU_DELETE_MESSAGE, 0, getString(R.string.delete));
        ImageView iv = (ImageView) v.findViewById(R.id.image);
        if (iv != null && iv.getVisibility() == View.VISIBLE) {
            menu.add(v.getId(), MENU_SAVE_PICTURE, 0, getString(R.string.save_picture));
        } else {
            menu.add(v.getId(), MENU_COPY_TEXT, 0, getString(R.string.copy_text));
        }
    }
}

From source file:com.example.mapdemo.BasicMapDemoActivity.java

@Override
public void onClick(View v) {

    // update the main content by replacing fragments
    Fragment newContent = new Category();
    Bundle bundle = new Bundle();

    if (v.getId() == R.id.rlProfile) {
        // PROFILE
        newContent = new UserProfile();
        bundle.putString(CUR_PAGE_TITLE, "Profile");
        setTitle("Profile");
        setSelected(rlProfile);/*from  w  ww. j a  va2  s .c  o  m*/
    } else if (v.getId() == R.id.rlHome) {
        // HOME
        setTitle("Home");
        bundle.putString(CUR_PAGE_TITLE, "Home");
        setSelected(rlHome);
    } else if (v.getId() == R.id.rlUploads) {
        // UPLOADS
        setTitle("Uploads");
        bundle.putString(CUR_PAGE_TITLE, "Uploads");
        setSelected(rlUploads);
    } else if (v.getId() == R.id.rlSubscriptions) {
        // Subscriptions
        setTitle("My Subscriptions");
        bundle.putString(CUR_PAGE_TITLE, "My Subscriptions");
        setSelected(rlSubscriptions);
    } else if (v.getId() == R.id.rlPlaylists) {
        // PLAYLISTS
        setTitle("Playlists");
        bundle.putString(CUR_PAGE_TITLE, "Playlists");
        setSelected(rlPlaylists);
    } else if (v.getId() == R.id.rlHistory) {
        // HISTORY
        setTitle("History");
        bundle.putString(CUR_PAGE_TITLE, "History");
        setSelected(rlHistory);
    } else if (v.getId() == R.id.rlFav) {
        // FAVOURITES
        setTitle("Favourites");
        bundle.putString(CUR_PAGE_TITLE, "Favourites");
        setSelected(rlFav);
    }

    // SHARE
    else if (v.getId() == R.id.ivMenuFacebook) {
        // FACEBOOK
        Toast.makeText(this, "Facebook pressed!", Toast.LENGTH_SHORT).show();
    } else if (v.getId() == R.id.ivMenuTwitter) {
        // TWITTER
        Toast.makeText(this, "Twitter pressed!", Toast.LENGTH_SHORT).show();
    } else if (v.getId() == R.id.ivMenuShare) {
        // SHARE
        Toast.makeText(this, "Share pressed!", Toast.LENGTH_SHORT).show();
    }

    if (newContent != null) {
        newContent.setArguments(bundle);
        switchFragment(newContent);
    }

}

From source file:com.hackensack.umc.activity.ProfileSelfiewithCropActivity.java

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.proceed_btn:
        profileInsuranceInfoFragment = new ProfileInsuranceInfoFragment();
        FragmentManager fragmentManager = getSupportFragmentManager();
        android.support.v4.app.FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        fragmentTransaction.add(R.id.fragmentIcContainer, profileInsuranceInfoFragment, "IsuranceFragment");
        fragmentTransaction.addToBackStack(null);
        fragmentTransaction.commit();//from  ww  w.  j  a v a  2  s  .c  o  m
        break;
    case R.id.manual_btn:
        Intent intent = new Intent(ProfileSelfiewithCropActivity.this, RegistrationDetailsActivity.class);
        Bundle b = new Bundle();
        b.putInt(Constant.REGISTRATION_MODE, Constant.MANUAL);
        intent.putExtra(Constant.BUNDLE, b);
        startActivity(intent);
        break;
    case R.id.selfie_img:

        selectedImageView = Constant.SELFIE;
        imageUri = dispatchTakePictureIntent(ProfileSelfiewithCropActivity.this, 1, Constant.SELFIE);
        break;

    }

}

From source file:eu.alefzero.owncloud.ui.fragment.FileDetailFragment.java

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.fdDownloadBtn: {
        //Toast.makeText(getActivity(), "Downloading", Toast.LENGTH_LONG).show();
        Intent i = new Intent(getActivity(), FileDownloader.class);
        i.putExtra(FileDownloader.EXTRA_ACCOUNT, mAccount);
        i.putExtra(FileDownloader.EXTRA_REMOTE_PATH, mFile.getRemotePath());
        i.putExtra(FileDownloader.EXTRA_FILE_PATH, mFile.getRemotePath());
        i.putExtra(FileDownloader.EXTRA_FILE_SIZE, mFile.getFileLength());
        v.setEnabled(false);/*  w  w  w  .  java  2 s. c o  m*/
        getActivity().startService(i);
        break;
    }
    case R.id.fdKeepInSync: {
        CheckBox cb = (CheckBox) getView().findViewById(R.id.fdKeepInSync);
        mFile.setKeepInSync(cb.isChecked());
        FileDataStorageManager fdsm = new FileDataStorageManager(mAccount,
                getActivity().getApplicationContext().getContentResolver());
        fdsm.saveFile(mFile);
        if (mFile.keepInSync()) {
            onClick(getView().findViewById(R.id.fdDownloadBtn));
        }
        break;
    }
    case R.id.fdRenameBtn: {
        EditNameFragment dialog = EditNameFragment.newInstance(mFile.getFileName());
        dialog.show(getFragmentManager(), "nameeditdialog");
        dialog.setOnDismissListener(this);
        break;
    }
    case R.id.fdRemoveBtn: {
        ConfirmationDialogFragment confDialog = ConfirmationDialogFragment
                .newInstance("to remove " + mFile.getFileName());
        confDialog.setOnConfirmationListener(this);
        confDialog.show(getFragmentManager(), FTAG_CONFIRMATION);
        break;
    }
    default:
        Log.e(TAG, "Incorrect view clicked!");
    }

    /* else if (v.getId() == R.id.fdShareBtn) {
    Thread t = new Thread(new ShareRunnable(mFile.getRemotePath()));
    t.start();
    }*/
}

From source file:com.hackensack.umc.activity.ProfileSelfieActivity.java

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.proceed_btn:
        profileInsuranceInfoFragment = new ProfileInsuranceInfoFragment();
        FragmentManager fragmentManager = getSupportFragmentManager();
        android.support.v4.app.FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        fragmentTransaction.add(R.id.fragmentIcContainer, profileInsuranceInfoFragment, "IsuranceFragment");
        fragmentTransaction.addToBackStack(null);
        fragmentTransaction.commit();//  w  ww  .j a v a 2  s .c  o  m
        break;
    case R.id.manual_btn:
        Intent intent = new Intent(ProfileSelfieActivity.this, RegistrationDetailsActivity.class);
        Bundle b = new Bundle();
        b.putInt(Constant.REGISTRATION_MODE, Constant.MANUAL);
        intent.putExtra(Constant.BUNDLE, b);
        startActivity(intent);
        break;
    case R.id.selfie_img:
        if (!isMessageShown) {
            showAlert(ProfileSelfieActivity.this, getString(R.string.suggestion),
                    getString(R.string.selfie_suggestion_message));
        } else {
            selectedImageView = Constant.SELFIE;
            imageUri = CameraFunctionality.dispatchTakePictureIntent(ProfileSelfieActivity.this, 1,
                    Constant.SELFIE);
        }

        break;

    }

}

From source file:org.dvbviewer.controller.ui.fragments.ChannelList.java

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.contextMenu:
        selectedPosition = (Integer) v.getTag();
        getListView().showContextMenu();
        break;//  www.j  a  v a 2  s .c  o  m

    default:
        break;
    }
}