Java Code Examples for android.widget.RadioButton#setOnClickListener()
The following examples show how to use
android.widget.RadioButton#setOnClickListener() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java From HereGPSLocation with GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); locationManager = (LocationManager) getSystemService(LOCATION_SERVICE); checkBox = (CheckBox) findViewById(R.id.checkBox1); radio0 = (RadioButton) findViewById(R.id.radio0); radio1 = (RadioButton) findViewById(R.id.radio1); checkBoxRefresh = (CheckBox) findViewById(R.id.checkBox2); textCounter = (TextView) findViewById(R.id.textView2); textView = (TextView) findViewById(R.id.textView1); checkBox.setOnClickListener(this); radio0.setOnClickListener(this); radio1.setOnClickListener(this); checkBoxRefresh.setOnClickListener(this); updateThread.start(); }
Example 2
Source File: PickerView.java From PickerView with Apache License 2.0 | 6 votes |
private void initView() { pickerTitleName = (TextView) view.findViewById(R.id.pickerTitleName); pickerConfirm = (TextView) view.findViewById(R.id.pickerConfirm); groupSelect = (RadioGroup) view.findViewById(R.id.groupSelect); mTextFirst = (RadioButton) view.findViewById(R.id.mTextFirst); mTextSecond = (RadioButton) view.findViewById(R.id.mTextSecond); mTextThird = (RadioButton) view.findViewById(R.id.mTextThird); mTextFourth = (RadioButton) view.findViewById(R.id.mTextFourth); pickerList = (ListView) view.findViewById(R.id.pickerList); emptyView = (TextView) view.findViewById(R.id.empty_data_hints); pickerList.setEmptyView(view.findViewById(R.id.picker_list_empty_data)); mTextFirst.setOnClickListener(this); mTextSecond.setOnClickListener(this); mTextThird.setOnClickListener(this); pickerConfirm.setOnClickListener(this); if (!TextUtils.isEmpty(pickerData.getPickerTitleName())){ pickerTitleName.setText(pickerData.getPickerTitleName()); } }
Example 3
Source File: RecordShowActivity.java From RecordPath3D with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.recorddisplay_activity); mMapView = (MapView) findViewById(R.id.map); mMapView.onCreate(savedInstanceState);// 此方法必须重写 mGraspRadioButton = (RadioButton) findViewById(R.id.record_show_activity_grasp_radio_button); mOriginRadioButton = (RadioButton) findViewById(R.id.record_show_activity_origin_radio_button); mOriginRadioButton.setOnClickListener(this); mGraspRadioButton.setOnClickListener(this); mDisplaybtn = (ToggleButton) findViewById(R.id.displaybtn); mDisplaybtn.setOnClickListener(this); Intent recordIntent = getIntent(); int threadPoolSize = Runtime.getRuntime().availableProcessors() * 2 + 3; mThreadPool = Executors.newFixedThreadPool(threadPoolSize); if (recordIntent != null) { mRecordItemId = recordIntent.getIntExtra(RecordActivity.RECORD_ID, -1); } initMap(); }
Example 4
Source File: DownloadSettingsActivity.java From MediaSDK with Apache License 2.0 | 6 votes |
private void initViews() { mStoreLocText = (TextView)findViewById(R.id.store_loc_txt); mStoreSizeText = (TextView)findViewById(R.id.store_size); mOpenFileText = (TextView)findViewById(R.id.open_file_txt); mClearDownloadText = (TextView)findViewById(R.id.clear_download_cache); mBtn1 = (RadioButton)findViewById(R.id.btn1); mBtn2 = (RadioButton)findViewById(R.id.btn2); mBtn3 = (RadioButton)findViewById(R.id.btn3); mBtn4 = (RadioButton)findViewById(R.id.btn4); mBtn5 = (RadioButton)findViewById(R.id.btn5); mBtn11 = (RadioButton)findViewById(R.id.btn11); mBtn12 = (RadioButton)findViewById(R.id.btn12); mStoreLocText.setText( VideoDownloadManager.getInstance().getCacheFilePath()); mOpenFileText.setOnClickListener(this); mClearDownloadText.setOnClickListener(this); mBtn1.setOnClickListener(this); mBtn2.setOnClickListener(this); mBtn3.setOnClickListener(this); mBtn4.setOnClickListener(this); mBtn5.setOnClickListener(this); mBtn11.setOnClickListener(this); mBtn12.setOnClickListener(this); }
Example 5
Source File: RadioGroup.java From NEON with Apache License 2.0 | 5 votes |
public RadioGroup(List<RadioButton> radios, Activity activity, CustomRadioGroupListener prgl) { this.radios = radios; this.activity = activity; this.customListener = prgl; for (RadioButton rb : radios) { rb.setOnClickListener(this); } }
Example 6
Source File: DistilledPagePrefsView.java From delion with Apache License 2.0 | 5 votes |
/** * Initiatializes a Button and selects it if it corresponds to the current * theme. */ private RadioButton initializeAndGetButton(int id, final Theme theme) { final RadioButton button = (RadioButton) findViewById(id); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mDistilledPagePrefs.setTheme(theme); } }); return button; }
Example 7
Source File: RadioButtonPreference.java From Indic-Keyboard with Apache License 2.0 | 5 votes |
@Override protected void onBindView(final View view) { super.onBindView(view); mRadioButton = (RadioButton)view.findViewById(R.id.radio_button); mRadioButton.setChecked(mIsSelected); mRadioButton.setOnClickListener(mClickListener); view.setOnClickListener(mClickListener); }
Example 8
Source File: RadioButtonPreference.java From simple-keyboard with Apache License 2.0 | 5 votes |
@Override protected void onBindView(final View view) { super.onBindView(view); mRadioButton = (RadioButton)view.findViewById(R.id.radio_button); mRadioButton.setChecked(mIsSelected); mRadioButton.setOnClickListener(mClickListener); view.setOnClickListener(mClickListener); }
Example 9
Source File: PrefsFast.java From CSipSimple with GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fast_settings); //Init checkboxes objects globIntegrate = (CheckBox) findViewById(R.id.glob_integrate); globProfileAlways = (RadioButton) findViewById(R.id.glob_profile_always); globProfileWifi = (RadioButton) findViewById(R.id.glob_profile_wifi); globProfileNever = (RadioButton) findViewById(R.id.glob_profile_never); globGsm = (CheckBox) findViewById(R.id.glob_tg); Button saveBtn = (Button) findViewById(R.id.save_bt); saveBtn.setOnClickListener(this); globProfileAlways.setOnClickListener(this); globProfileNever.setOnClickListener(this); globProfileWifi.setOnClickListener(this); findViewById(R.id.row_glob_integrate).setOnClickListener(this); findViewById(R.id.row_glob_profile_always).setOnClickListener(this); findViewById(R.id.row_glob_profile_wifi).setOnClickListener(this); findViewById(R.id.row_glob_profile_never).setOnClickListener(this); findViewById(R.id.row_glob_tg).setOnClickListener(this); updateFromPrefs(); }
Example 10
Source File: ChooseDialog.java From SimpleProject with MIT License | 5 votes |
private BaseAdapter createSingleChooseAdapter() { return new BaseCommonAdapter<String>(getContext(), items, R.layout.dialog_item_single_choose_layout) { @Override public void convert(ViewHolder holder, String paramT, final int position) { holder.setText(R.id.item_text, paramT); final RadioButton radioButton = holder.getView(R.id.radio_button); if (checkedItemIndex == position) { radioButton.setChecked(true); selectedRadioButton = radioButton; } else { radioButton.setChecked(false); } View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View v) { if (position != checkedItemIndex) { if (selectedRadioButton != null) { selectedRadioButton.setChecked(false); } radioButton.setChecked(true); selectedRadioButton = radioButton; checkedItemIndex = position; } else { radioButton.setChecked(false); } } }; holder.getContentView().setOnClickListener(listener); radioButton.setOnClickListener(listener); } }; }
Example 11
Source File: TypeRecommendIndexPageAdapter.java From BigApp_Discuz_Android with Apache License 2.0 | 5 votes |
/** * 过滤条件的item */ public View getForumFilterItem(int position, View convertView) { if (convertView == null) { convertView = View.inflate(context, R.layout.item_forum_filter_recomm, null); } RadioGroup group = ViewHolder.get(convertView, R.id.radio); int index = getHomePageIndex(position); final Recommend recommend = homePage.get(index).getRecommend(); ArrayList<ThreadConfig> threadConfigItems = recommend.getThreadConfigs(); int[] ids = {R.id.radioButton1, R.id.radioButton2, R.id.radioButton3, R.id.radioButton4}; group.check(ids[recommend.getForumFilterSelectIndex()]); for (int i = 0; i < ids.length; i++) { RadioButton radioButton = ViewHolder.get(convertView, ids[i]); if (threadConfigItems != null && i < threadConfigItems.size()) { ThreadConfig item = threadConfigItems.get(i); radioButton.setVisibility(View.VISIBLE); radioButton.setText(getFilterItemTitle(item)); } else { radioButton.setVisibility(View.GONE); } final int ii = i; radioButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { filterItemClick(recommend, ii); } }); } return convertView; }
Example 12
Source File: ScanningMethodPreference.java From talkback with Apache License 2.0 | 5 votes |
@Override protected void onBindDialogView(@NonNull View dialogView) { for (int i = 0; i < radioButtonIds.length; i++) { RadioButton radioButton = dialogView.findViewById(radioButtonIds[i]); View summaryView = dialogView.findViewById(scanningMethodSummaryViewIds[i]); if (isScanningMethodEnabled[i]) { radioButton.setVisibility(View.VISIBLE); summaryView.setVisibility(View.VISIBLE); // Use an OnClickListener instead of on OnCheckChangedListener so we are informed when the // currently checked item is tapped. (The OnCheckChangedListener is only called when a // different radio button is selected.) final int keyIndex = i; View.OnClickListener scanningMethodOnClickListener = v -> { SwitchAccessPreferenceUtils.setScanningMethod(context, scanningMethodKeys[keyIndex]); Dialog dialog = getDialog(); if (dialog != null) { dialog.dismiss(); } }; radioButton.setOnClickListener(scanningMethodOnClickListener); summaryView.setOnClickListener(scanningMethodOnClickListener); } else { radioButton.setVisibility(View.GONE); summaryView.setVisibility(View.GONE); } } RadioGroup scanningMethodRadioGroup = dialogView.findViewById(R.id.scanning_options_radio_group); updateCheckedBasedOnCurrentValue(scanningMethodRadioGroup); }
Example 13
Source File: TypeContentIndexPageAdapter.java From BigApp_Discuz_Android with Apache License 2.0 | 5 votes |
/** * 过滤条件的item */ public View getForumFilterItem(int position, View convertView) { if (convertView == null) { convertView = View.inflate(context, R.layout.item_forum_filter_recomm, null); } RadioGroup group = ViewHolder.get(convertView, R.id.radio); int index = getHomePageIndex(position); final Recommend recommend = homePage.get(index).getRecommend(); ArrayList<ThreadConfig> threadConfigItems = recommend.getThreadConfigs(); int[] ids = {R.id.radioButton1, R.id.radioButton2, R.id.radioButton3, R.id.radioButton4}; group.check(ids[recommend.getForumFilterSelectIndex()]); for (int i = 0; i < ids.length; i++) { RadioButton radioButton = ViewHolder.get(convertView, ids[i]); if (threadConfigItems != null && i < threadConfigItems.size()) { ThreadConfig item = threadConfigItems.get(i); radioButton.setVisibility(View.VISIBLE); radioButton.setText(getFilterItemTitle(item)); } else { radioButton.setVisibility(View.GONE); } final int ii = i; radioButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { filterItemClick(recommend, ii); } }); } return convertView; }
Example 14
Source File: DistilledPagePrefsView.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** * Initiatializes a Button and selects it if it corresponds to the current * theme. */ private RadioButton initializeAndGetButton(int id, final Theme theme) { final RadioButton button = (RadioButton) findViewById(id); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mDistilledPagePrefs.setTheme(theme); } }); return button; }
Example 15
Source File: MultiLineRadioGroup.java From MultiLineRadioGroup with MIT License | 5 votes |
private void initRadioButton(RadioButton radioButton) { radioButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { boolean didCheckStateChange = checkButton((RadioButton) v); if (didCheckStateChange && mOnCheckedChangeListener != null) { mOnCheckedChangeListener.onCheckedChanged(MultiLineRadioGroup.this, mCheckedButton); } if (mOnClickListener != null) { mOnClickListener.onClick(MultiLineRadioGroup.this, mCheckedButton); } } }); }
Example 16
Source File: FavoritesScene.java From MHViewer with Apache License 2.0 | 4 votes |
private void bindSource(ViewGroup parent) { LayoutInflater inflater = getLayoutInflater2(); if (mFabLayout == null) { return; } if (inflater == null) { return; } for (MHPlugin source : MHPluginManager.Companion.getINSTANCE().livePlugin()) { RadioButton item = (RadioButton) inflater.inflate(R.layout.item_source_bar, parent, false); item.setText(source.getName().substring(0, 2)); item.setTag(source.getName()); item.setId(View.generateViewId()); parent.addView(item); if (source.getName().equals(currentSource)) { item.setChecked(true); } item.setOnClickListener(v -> { switchSource((String) v.getTag()); mHelper.refresh(); updateSearchBar(); }); item.setOnLongClickListener(v -> { String target = (String) v.getTag(); new AlertDialog.Builder(getContext2()) .setTitle(getContext2().getResources().getString(R.string.import_collection, target, currentSource)) .setPositiveButton(android.R.string.ok, (dialog, which) -> { Intent intent = new Intent(getActivity2(), ImportService.class); intent.setAction(ImportService.Companion.getACTION_START()); intent.putExtra(ImportService.Companion.getKEY_TARGET(), target); intent.putExtra(ImportService.Companion.getKEY_SOURCE(), currentSource); intent.putExtra(ImportService.Companion.getKEY_LOCAL(), mUrlBuilder.getFavCat() == FavListUrlBuilder.FAV_CAT_LOCAL); getContext2().startService(intent); }).create().show(); return true; }); } }
Example 17
Source File: GroupTypeFragment.java From actor-platform with GNU Affero General Public License v3.0 | 4 votes |
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View res = inflater.inflate(R.layout.fragment_edit_type, container, false); res.setBackgroundColor(style.getBackyardBackgroundColor()); TextView publicTitle = (TextView) res.findViewById(R.id.publicTitle); publicTitle.setText(groupVM.getGroupType() == GroupType.CHANNEL ? R.string.group_public_channel_title : R.string.group_public_group_title); publicTitle.setTextColor(style.getTextPrimaryColor()); TextView publicDescription = (TextView) res.findViewById(R.id.publicDescription); publicDescription.setText(groupVM.getGroupType() == GroupType.CHANNEL ? R.string.group_public_channel_text : R.string.group_public_group_text); publicDescription.setTextColor(style.getTextSecondaryColor()); TextView privateTitle = (TextView) res.findViewById(R.id.privateTitle); privateTitle.setText(groupVM.getGroupType() == GroupType.CHANNEL ? R.string.group_private_channel_title : R.string.group_private_group_title); privateTitle.setTextColor(style.getTextPrimaryColor()); TextView privateDescription = (TextView) res.findViewById(R.id.privateDescription); privateDescription.setText(groupVM.getGroupType() == GroupType.CHANNEL ? R.string.group_private_channel_text : R.string.group_private_group_text); privateDescription.setTextColor(style.getTextSecondaryColor()); TextView publicLinkPrefix = (TextView) res.findViewById(R.id.publicLinkPrefix); publicLinkPrefix.setTextColor(style.getTextSecondaryColor()); String prefix = ActorSDK.sharedActor().getGroupInvitePrefix(); if (prefix == null) { prefix = "@"; } publicLinkPrefix.setText(prefix); RadioButton publicRadio = (RadioButton) res.findViewById(R.id.publicRadio); RadioButton privateRadio = (RadioButton) res.findViewById(R.id.privateRadio); View publicSelector = res.findViewById(R.id.publicSelector); View privateSelector = res.findViewById(R.id.privateSelector); publicShortName = (EditText) res.findViewById(R.id.publicLink); View publicLinkContainer = res.findViewById(R.id.publicContainer); View publicShadowTop = res.findViewById(R.id.shadowTop); View publicShadowBottom = res.findViewById(R.id.shadowBottom); if (groupVM.getShortName().get() != null) { publicRadio.setChecked(true); privateRadio.setChecked(false); publicLinkContainer.setVisibility(View.VISIBLE); publicShadowTop.setVisibility(View.VISIBLE); publicShadowBottom.setVisibility(View.VISIBLE); publicShortName.setText(groupVM.getShortName().get()); isPublic = true; } else { publicRadio.setChecked(false); privateRadio.setChecked(true); publicLinkContainer.setVisibility(View.GONE); publicShadowTop.setVisibility(View.GONE); publicShadowBottom.setVisibility(View.GONE); publicShortName.setText(null); isPublic = false; } View.OnClickListener publicClick = view -> { if (!isPublic) { isPublic = true; publicRadio.setChecked(true); privateRadio.setChecked(false); publicLinkContainer.setVisibility(View.VISIBLE); publicShadowTop.setVisibility(View.VISIBLE); publicShadowBottom.setVisibility(View.VISIBLE); publicShortName.setText(groupVM.getShortName().get()); } }; View.OnClickListener privateClick = view -> { if (isPublic) { isPublic = false; publicRadio.setChecked(false); privateRadio.setChecked(true); publicLinkContainer.setVisibility(View.GONE); publicShadowTop.setVisibility(View.GONE); publicShadowBottom.setVisibility(View.GONE); publicShortName.setText(null); } }; publicRadio.setOnClickListener(publicClick); publicSelector.setOnClickListener(publicClick); privateRadio.setOnClickListener(privateClick); privateSelector.setOnClickListener(privateClick); return res; }
Example 18
Source File: ShoppingDetailActivity.java From ShoppingCartActivity with Apache License 2.0 | 4 votes |
private void initView() { backBtn=(Button)findViewById(R.id.btn_back); headerRight=(TextView)findViewById(R.id.bt_header_right); tvCommodity=(TextView)findViewById(R.id.tv_title); tvCommodityTitle=(TextView)findViewById(R.id.commodity_title); tvCommodityNumber=(TextView)findViewById(R.id.commodity_number); tvCommodityMoney=(TextView)findViewById(R.id.commodity_money); rlCommodityChange=(RelativeLayout)findViewById(R.id.commodity_relative_change); tvCommodityChange=(TextView)findViewById(R.id.commodity_change); tvCommodityChangeName=(TextView)findViewById(R.id.commodity_change_name); reCommodityDescription=(RelativeLayout)findViewById(R.id.commodity_description); rbCommoditySummarize=(RadioButton)findViewById(R.id.commodity_summarize); rbCommodityParameter=(RadioButton)findViewById(R.id.commodity_parameter); tvAllAppraise=(TextView)findViewById(R.id.all_appraise); imgUserHead=(ImageView)findViewById(R.id.user_head); tvUserName=(TextView)findViewById(R.id.user_name); tvAppraiseTime=(TextView)findViewById(R.id.user_time); mRespond=(LinearLayout)findViewById(R.id.respond); tvUserPraise=(TextView)findViewById(R.id.user_praise); btnCommodityLike=(Button)findViewById(R.id.commodity_like); btnCommodityCart=(Button)findViewById(R.id.commodity_cart); reCommodityAddCart=(RelativeLayout)findViewById(R.id.commodity_add_cart); mBannerViewPager=(BannerViewPager)findViewById(R.id.rl_commodity_pager); mCommodiyuViewGroup=(LinearLayout)findViewById(R.id.rl_commodity_viewGroup); reAddressChoose=(RelativeLayout)findViewById(R.id.rl_address_choose); isInventory=(TextView)findViewById(R.id.is_inventory); backBtn.setVisibility(View.INVISIBLE); headerRight.setVisibility(View.INVISIBLE); rlCommodityChange.setOnClickListener(this); tvAllAppraise.setOnClickListener(this); tvUserPraise.setOnClickListener(this); btnCommodityLike.setOnClickListener(this); rbCommoditySummarize.setOnClickListener(this); rbCommodityParameter.setOnClickListener(this); btnCommodityCart.setOnClickListener(this); reCommodityAddCart.setOnClickListener(this); reAddressChoose.setOnClickListener(this); }
Example 19
Source File: TabsScrollableDemoFragment.java From material-components-android with Apache License 2.0 | 4 votes |
@Nullable @Override public View onCreateDemoView( LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) { // return layoutInflater.inflate(getTabsContent(), viewGroup, false /* attachToRoot */); View view = layoutInflater.inflate( R.layout.cat_tabs_scrollable_fragment, viewGroup, false /* attachToRoot */); ViewGroup content = view.findViewById(R.id.content); View tabsContent = layoutInflater.inflate(getTabsContent(), content, false /* attachToRoot */); content.addView(tabsContent, 0); scrollableTabLayout = tabsContent.findViewById(R.id.scrollable_tab_layout); RadioButton tabGravityStartButton = view.findViewById(R.id.tabs_gravity_start_button); tabGravityStartButton.setOnClickListener( v -> scrollableTabLayout.setTabGravity(TabLayout.GRAVITY_START)); RadioButton tabGravityCenterButton = view.findViewById(R.id.tabs_gravity_center_button); tabGravityCenterButton.setOnClickListener( v -> scrollableTabLayout.setTabGravity(TabLayout.GRAVITY_CENTER)); if (bundle != null) { scrollableTabLayout.removeAllTabs(); scrollableTabLayout.setTabGravity(bundle.getInt(KEY_TAB_GRAVITY)); // Restore saved tabs String[] tabLabels = bundle.getStringArray(KEY_TABS); for (String label : tabLabels) { scrollableTabLayout.addTab(scrollableTabLayout.newTab().setText(label)); } } numTabs = scrollableTabLayout.getTabCount(); tabTitles = getContext().getResources().getStringArray(R.array.cat_tabs_titles); Button addButton = view.findViewById(R.id.add_tab_button); addButton.setOnClickListener( v -> { scrollableTabLayout.addTab( scrollableTabLayout.newTab().setText(tabTitles[numTabs % tabTitles.length])); numTabs++; }); Button removeButton = view.findViewById(R.id.remove_tab_button); removeButton.setOnClickListener( v -> { Tab tab = scrollableTabLayout.getTabAt(scrollableTabLayout.getTabCount() - 1); if (tab != null) { scrollableTabLayout.removeTab(tab); } numTabs = Math.max(0, numTabs - 1); }); return view; }
Example 20
Source File: GetVipActivity.java From Social with Apache License 2.0 | 4 votes |
private void initData(){ rb_count_1 = (RadioButton)this.findViewById(R.id.id_get_vip_activity_rb_1); rb_count_3 = (RadioButton)this.findViewById(R.id.id_get_vip_activity_rb_3); rb_count_6 = (RadioButton)this.findViewById(R.id.id_get_vip_activity_rb_6); rb_count_12 = (RadioButton)this.findViewById(R.id.id_get_vip_activity_rb_12); rb_type_1 = (RadioButton)this.findViewById(R.id.id_get_vip_activity_rb_zhifubao); rb_type_2 = (RadioButton)this.findViewById(R.id.id_get_vip_activity_rb_credit); rb_count_1.setOnClickListener(this); rb_count_3.setOnClickListener(this); rb_count_6.setOnClickListener(this); rb_count_12.setOnClickListener(this); rb_type_1.setOnClickListener(this); rb_type_2.setOnClickListener(this); rv_pay = (RippleView)this.findViewById(R.id.id_get_vip_activity_rv_pay); rv_pay.setOnRippleCompleteListener(new RippleView.OnRippleCompleteListener() { @Override public void onComplete(RippleView rippleView) { if (month_count == null || month_count.length() == 0) { Toast.makeText(GetVipActivity.this, "请选择开通时长", Toast.LENGTH_LONG).show(); return; } if (type == null || month_count.length() == 0) { Toast.makeText(GetVipActivity.this, "请选择支付方式", Toast.LENGTH_LONG).show(); return; } if (type.equals("1")) { Intent intent = new Intent(GetVipActivity.this,PayActivity.class); startActivity(intent); //Toast.makeText(GetVipActivity.this, "暂不支持支付宝付款", Toast.LENGTH_LONG).show(); return; } else if (type.equals("2")) { getVip(); } } }); }