public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if ("FacebookMessenger".equals(platform.getName())) { if(lastPosition >= 0) { Following lastFollwing = adapter.getItem(lastPosition); lastFollwing.checked = false; } lastPosition = position; } Following following = adapter.getItem(position); following.checked = !following.checked; if(following.checked) { checkNum++; } else { checkNum--; } updateConfirmView(); adapter.notifyDataSetChanged(); }
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { final String deviceName = ((DeviceListItem)view).getDeviceName(); final long deviceId = ((DeviceListItem)view).getDeviceId(); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(getActivity().getString(R.string.DeviceListActivity_unlink_s, deviceName)); builder.setMessage(R.string.DeviceListActivity_by_unlinking_this_device_it_will_no_longer_be_able_to_send_or_receive); builder.setNegativeButton(android.R.string.cancel, null); builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { handleDisconnectDevice(deviceId); } }); builder.show(); }
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (currentLevel == LEVEL_PROVINCE) { selectedProvince = provinceList.get(position); queryCities(); } else if (currentLevel == LEVEL_CITY) { selectedCity = cityList.get(position); queryCounties(); } else if (currentLevel == LEVEL_COUNTY) { String weatherID = countyList.get(position).getWeatherID(); Intent intent = new Intent(getActivity(), WeatherActivity.class); intent.putExtra("weather_id", weatherID); startActivity(intent); getActivity().finish(); } }
@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); this.setContentView(R.layout.label_dialog); labelList = (ListView) findViewById(R.id.label_list); cancel = (Button) findViewById(R.id.cancel); // ListView SimpleAdapter adapter = new SimpleAdapter(context, getLabelList(), R.layout.label_list_item, new String[]{"label_img", "label_value"}, new int[]{ R.id.label_img, R.id.label_value}); labelList.setAdapter(adapter); //ListView labelList .setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) { HashMap<String, Object> label = getLabelList().get(position); selectedLabel = (String) label.get("label_value"); ToodooOptionsModel ToodooOptionsModel = toodooOptionsList.get(0); ToodooOptionsModel.setOptionValue(selectedLabel); mAdapter.notifyDataSetChanged(); labelDialog.dismiss(); } }); cancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { labelDialog.dismiss(); } }); }
private void lvClick() { lv_main.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { switch (i) { case 0: startOtherActivity(LinearLayoutActivity.class); break; case 1: startOtherActivity(GridActivity.class); break; case 2: startOtherActivity(FlowLayoutActivity.class); break; } } }); }
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { UploadView uploadView = (UploadView)view; String uploadId = uploadView.getUploadId(); if (binder.isStop()) { UploadInfo uploadInfo = DataSet.getUploadInfo(uploadId); if (uploadInfo != null && uploadInfo.getStatus() != Uploader.FINISH) { startUploadService(uploadInfo); } currentUploadId = uploadId; } else if (uploadId.equals(currentUploadId)) { switch (binder.getUploaderStatus()) { case Uploader.UPLOAD: binder.pause(); break; case Uploader.PAUSE: binder.upload(); break; } } }
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { ListView listView = (ListView) parent; AppInfo appInfo = (AppInfo) listView.getItemAtPosition(position); String packageName = appInfo.getPackageName(); String appName = appInfo.getAppName(); Log.d(TAG, packageName); if(!JniUtil.isRunning(packageName)){ openApp(packageName); } Log.d(TAG, "Create folder:" + FileUtil.createPath(HDOG_PATH +File.separator + packageName + File.separator + TYPE_DEX)); Log.d(TAG, "Create folder:" + FileUtil.createPath(HDOG_PATH +File.separator + packageName + File.separator + TYPE_DEY)); Intent intent = new Intent(this, DumpActivity.class); intent.putExtra("package_name", packageName); intent.putExtra("app_name", appName); startActivity(intent); }
@Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (module == null) return; final List<Example> examples = module.getExamples(); final String category = getCategoryByPosition(selectedPosition); final List<Example> exampleItems = convertToAdapterItems(examples, category); switch (position) { case 0: adapter.setSortStrategy(new SortByCategory(exampleItems)); break; case 1: adapter.setSortStrategy(new SortByFeatures(exampleItems)); break; case 2: adapter.setSortStrategy(new SortByName(exampleItems)); break; case 3: adapter.setSortStrategy(new SortByMostUsed(exampleItems)); break; } }
@Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { RecentInfo recentInfo = contactAdapter.getItem(position); if (recentInfo == null) { logger.e("recent#onItemLongClick null recentInfo -> position:%d", position); return false; } if (recentInfo.getSessionType() == DBConstant.SESSION_TYPE_SINGLE) { handleContactItemLongClick(getActivity(),recentInfo); } else { handleGroupItemLongClick(getActivity(),recentInfo); } return true; }
public void onItemClick(AdapterView<?> av, View v, int arg2, long arg3) { // Cancel discovery because it's costly and we're about to connect mBtAdapter.cancelDiscovery(); // Get the device MAC address, which is the last 17 chars in the View String info = ((TextView) v).getText().toString(); String address = info.substring(info.length() - 17); // Create the result Intent and include the MAC address Intent intent = new Intent(); intent.putExtra(EXTRA_DEVICE_ADDRESS, address); // Set result and finish this Activity setResult(Activity.RESULT_OK, intent); finish(); }
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { switch (position){ case 1: startActivity(new Intent(this, BannerAnimationActivity.class)); break; case 2: startActivity(new Intent(this, BannerStyleActivity.class)); break; case 3: startActivity(new Intent(this, IndicatorPositionActivity.class)); break; case 4: startActivity(new Intent(this, CustomBannerActivity.class)); break; case 5: startActivity(new Intent(this, BannerLocalActivity.class)); break; case 6: startActivity(new Intent(this, CustomViewPagerActivity.class)); break; } }
private View newList( final PickerQuery q, final ViewAnimator flip, AdapterView.OnItemClickListener click) { final View list = newList(q, click); list.setOnKeyListener(new View.OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP) { flip.setInAnimation(getContext(), R.anim.slide_in_left); flip.setOutAnimation(getContext(), R.anim.slide_out_right); flip.showPrevious(); flip.removeView(list); flip.setInAnimation(getContext(), R.anim.slide_in_right); flip.setOutAnimation(getContext(), R.anim.slide_out_left); return true; } return false; } }); return list; }
@Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { listItemList = trollyAdapter.getItems(); FlipShareView shareBottom = new FlipShareView.Builder(this, mToolbar) .addItem(new ShareItem("发布者::"+listItemList.get(position).PublisherName, Color.WHITE, 0xff43549C)) .addItem(new ShareItem("联系方式:"+listItemList.get(position).PublisherName, Color.WHITE, 0xff43549C)) .addItem(new ShareItem("物品类型:"+listItemList.get(position).TaskKindID, Color.WHITE, 0xff43549C)) .addItem(new ShareItem("物品描述:"+listItemList.get(position).Remark, Color.WHITE, 0xff4999F0)) .addItem(new ShareItem("取件时间:"+listItemList.get(position).FetchTime, Color.WHITE, 0xffD9392D)) .addItem(new ShareItem("取件地点:"+listItemList.get(position).FetchLocation, Color.WHITE, 0xff57708A)) .addItem(new ShareItem("送件时间:"+listItemList.get(position).SendTime, Color.WHITE, 0xffea0bb2)) .addItem(new ShareItem("送件地点:"+listItemList.get(position).SendLocation, Color.WHITE, 0xffea650b)) .addItem(new ShareItem("订单价格:"+listItemList.get(position).Money, Color.WHITE,0xff063e04)) .setItemDuration(200) .setBackgroundColor(0x60000000) .setAnimType(FlipShareView.TYPE_SLIDE) .create(); return true; }
public void initListPop() { listPopupWindow = new ListPopupWindow(getContext()); ListPopAdapter listPopAdapter = new ListPopAdapter(getContext(), valueList); listPopupWindow.setAdapter(listPopAdapter); listPopupWindow.setWidth(RelativeLayout.LayoutParams.WRAP_CONTENT); listPopupWindow.setHeight(RelativeLayout.LayoutParams.WRAP_CONTENT); listPopupWindow.setAnchorView(tv_select_coupons); listPopupWindow.setModal(true); listPopupWindow.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { tv_select_coupons.setText(valueList.get(position)); mKey = cardTemplateList.get(position).key; listPopupWindow.dismiss(); } }); }
private void addChangeProfilePicListener( final DBHelper dbHelper, final String uid ) { gridView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { pos = position; new AlertDialog.Builder(PictureGridActivity.this) .setTitle("Use as profile picture?") .setIcon(android.R.drawable.ic_dialog_alert) .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { StorageReference storageRef = dbHelper.getStorage().getReference("Photo/" + uid + "/" + hashList.get(pos)); storageRef.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() { @Override public void onSuccess(Uri downloadUrl) { dbHelper.getDb().getReference(dbHelper.getUserPath()).child(uid).child("profile_pic").setValue(downloadUrl.toString()); finish(); } }); } }) .setNegativeButton(android.R.string.no, null).show(); } }); }
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { switch (Item.values()[position]) { case 默认主题: setThemeColor(R.color.colorPrimary, R.color.colorPrimaryDark); mRefreshLayout.setPrimaryColors(0xff283645, 0xff6ea9ff); break; case 蓝色主题: setThemeColor(R.color.colorPrimary, R.color.colorPrimaryDark); break; case 绿色主题: setThemeColor(android.R.color.holo_green_light, android.R.color.holo_green_dark); break; case 红色主题: setThemeColor(android.R.color.holo_red_light, android.R.color.holo_red_dark); break; case 橙色主题: setThemeColor(android.R.color.holo_orange_light, android.R.color.holo_orange_dark); break; } mRefreshLayout.autoRefresh(); }
@Override public void initEvent() {//必须在onCreate方法内调用 //示例代码<<<<<<<<<<<<<<<<<<< lvDemo.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { setResult(RESULT_OK, new Intent().putExtra(RESULT_CLICKED_ITEM, position)); finish(); } }); //分页滚动示例代码<<<<<<<<<<<<<<<<<<< new PageScroller(lvDemo).init(); //分页滚动示例代码>>>>>>>>>>>>>>>>>>> //示例代码>>>>>>>>>>>>>>>>>>> }
protected void applySelectedViewMode(int newMode) { if(mHeaderView!=null) { //removing headerview if (mArchosGridView instanceof ListView) { ((ListView) mArchosGridView).removeHeaderView(mHeaderView); ((AdapterView)mHeaderView.getParent()).removeViewInLayout(mHeaderView); } if(mArchosGridView instanceof HeaderGridView) ((HeaderGridView) mArchosGridView).removeHeaderView(mHeaderView); } // Save the current position variables before changing the view mode setPosition(); mSelectedPosition = mArchosGridView.getFirstVisiblePosition(); setViewMode(newMode); //replacing headerView addHeaderView(); bindAdapter(); }
private void setCharacterList(){ ListView character_list = (ListView) findViewById(R.id.character_list); final ArrayAdapter<Character> adapter = new RowAdapter(this,characters); character_list.setAdapter(adapter); character_list.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { boolean isSelected = characters.get(i).isActive() ? false : true; characters.get(i).setActive(isSelected); adapter.notifyDataSetChanged(); } }); }
@Override public void initData() { list = new ArrayList<>(); list.add(context.getString(R.string.weChat)); list.add(context.getString(R.string.qq)); list.add(context.getString(R.string.weChatFriends)); list.add(context.getString(R.string.qzone)); list.add(context.getString(R.string.sina)); gridView.setAdapter(new ShareAdapter(context, list)); gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { if (onItemClick != null) { onItemClick.onItemClick(i); } } }); }
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { AbsContactItem item = (AbsContactItem) adapter.getItem(position); if (item == null) { return; } int type = item.getItemType(); if (type == ItemTypes.FUNC && customization != null) { customization.onFuncItemClick(item); return; } if (type == ItemTypes.FRIEND && item instanceof ContactItem && NimUIKit.getContactEventListener() != null) { NimUIKit.getContactEventListener().onItemClick(getActivity(), (((ContactItem) item).getContact()).getContactId()); } }
@Override public void onItemSelected(AdapterView<?> arg0, View arg1, int index, long arg3) { PreferencesHelper.getInstance().put(PreferencesHelper.Key.LAST_PRESET_NAME, mReverbSpinner.getSelectedItem().toString()); reverbSetting = index; if (mApp.isServiceRunning()) if (index == 0) { mApp.getService().getEqualizerHelper().getReverb().setPreset(PresetReverb.PRESET_NONE); reverbSetting = 0; } else if (index == 1) { mApp.getService().getEqualizerHelper().getReverb().setPreset(PresetReverb.PRESET_LARGEHALL); reverbSetting = 1; } else if (index == 2) { mApp.getService().getEqualizerHelper().getReverb().setPreset(PresetReverb.PRESET_LARGEROOM); reverbSetting = 2; } else if (index == 3) { mApp.getService().getEqualizerHelper().getReverb().setPreset(PresetReverb.PRESET_MEDIUMHALL); reverbSetting = 3; } else if (index == 4) { mApp.getService().getEqualizerHelper().getReverb().setPreset(PresetReverb.PRESET_MEDIUMROOM); reverbSetting = 4; } else if (index == 5) { mApp.getService().getEqualizerHelper().getReverb().setPreset(PresetReverb.PRESET_SMALLROOM); reverbSetting = 5; } else if (index == 6) { mApp.getService().getEqualizerHelper().getReverb().setPreset(PresetReverb.PRESET_PLATE); reverbSetting = 6; } else reverbSetting = 0; }
@Override public void onItemSelected(AdapterView<?> parent, View view, final int position, long id) { glSurfaceView.queueEvent(new Runnable() { @Override public void run() { // notify the renderer that we want to change the encoder's state videoRenderer.changeFilterMode(position); } }); }
@Override public void onItemClick(@NonNull AdapterView<?> parent, @NonNull View view, int position, long id) { final SampleItem item = getAdapter().getItem(position); mFragmentController.newRequest((int) item.getId()) .addToBackStack(true) .execute(); }
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { IIconCheckListAdapterItem item = (IIconCheckListAdapterItem) parent.getItemAtPosition(position); item.setChecked(!item.isChecked()); mListView.invalidateViews(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_earthquake); init(); //TODO: verify if there's internet connection if(thereIsInternet()){ progressBar.setVisibility(View.VISIBLE); } else if(!(thereIsInternet())){ progressBar.setVisibility(View.GONE); noInternetConection.setText("There is no internet connection"); } // Find a reference to the {@link ListView} in the layout LoaderManager loaderManager = getLoaderManager(); loaderManager.initLoader(EARTHQUAKE_LOADER, null, this); //TODO: set up the correct url earthquakeListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { Earthquake earthquake = earthquakeAdapterm.getItem(i); intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(earthquake.getUrl())); startActivity(intent); } }); }
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { final int checkedPos = mListView.getCheckedItemPosition(); final boolean hasValidSelection = checkedPos != ListView.INVALID_POSITION; if (mAlwaysUseOption && (!hasValidSelection || mLastSelected != checkedPos)) { mAlwaysButton.setEnabled(hasValidSelection); mOnceButton.setEnabled(hasValidSelection); if (hasValidSelection) { mListView.smoothScrollToPosition(checkedPos); } mLastSelected = checkedPos; } else { startSelected(position, false); } }
@Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (mIgnoreNextNavigation) { mIgnoreNextNavigation = false; return; } while (mState.stack.size() > position + 1) { mState.stackTouched = true; mState.stack.pop(); } onCurrentDirectoryChanged(ANIM_UP); }
protected void onListItemClick(AdapterView l, View v, int position, long id) { final BluetoothDevice device = leDeviceListAdapter.getDevice(position); if (device == null) return; final Intent intent = new Intent(this, ControllerActivity.class); intent.putExtra(EXTRAS_DEVICE_NAME, device.getName()); intent.putExtra(EXTRAS_DEVICE_ADDRESS, device.getAddress()); intent.putExtra(EXTRAS_DEVICE_TYPE, device.getType()); btScanner.stopScan(); startActivity(intent); }
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Item item = Item.values()[position]; if (Activity.class.isAssignableFrom(item.clazz)) { startActivity(new Intent(getContext(), item.clazz)); } else if (Fragment.class.isAssignableFrom(item.clazz)) { FragmentActivity.start(this, item.clazz); } }
@Override public boolean onContextItemSelected(MenuItem menuItem) { final AdapterView.AdapterContextMenuInfo menuInfo; menuInfo = (AdapterView.AdapterContextMenuInfo)menuItem.getMenuInfo(); /** * menuInfo.position for List index * menuItem.getItemId for operation index */ ReaderLocation rLocation = mRLocaitonList.get(menuInfo.position); switch(menuItem.getItemId()) { case LOC_CONTEXT_MENU_MODIFY: Toast.makeText(getContext(), "LOC_CONTEXT_MENU_MODIFY", Toast.LENGTH_SHORT); ModifyLocationFragment modifyLocationFragment = new ModifyLocationFragment(rLocation, menuInfo.position); modifyLocationFragment.setTargetFragment(this, 0); modifyLocationFragment.show(mFragmentManager, "ModifyLocation"); break; case LOC_CONTEXT_MENU_TAG: Toast.makeText(getContext(), "LOC_CONTEXT_MENU_TAG", Toast.LENGTH_SHORT); AssociateTagFragment associateTagFragment = new AssociateTagFragment(rLocation, menuInfo.position); associateTagFragment.setTargetFragment(this, 0); associateTagFragment.show(mFragmentManager, "AssociateTag"); break; case LOC_CONTEXT_MENU_DELETE: Toast.makeText(getContext(), "LOC_CONTEXT_MENU_DELETE", Toast.LENGTH_SHORT); DeleteLocation(rLocation); break; } return false; }
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) { if ("add".equals((String) StatusPostTextActivity.this.mAdapter.getItem(position))) { StatusPostTextActivity.this.openPhotoPicker(); return; } StatusPostTextActivity.this.mCurEditPicPosition = position; Uri imageUri = Uri.fromFile(new File((String) StatusPostTextActivity.this .mSelectPictures.get(position))); Intent intent = new Intent(StatusPostTextActivity.this.mActivity, ImageEditActivity .class); intent.setData(imageUri); StatusPostTextActivity.this.startActivityForResult(intent, 4); }
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long arg3) { MeasureCurveActivity.this.setSpinnerText(view); MeasureCurveActivity.this.measureType = MeasureCurveActivity.this.getMeasureType (position); MeasureCurveActivity.this.mMeasure.clear(); MeasureCurveActivity.this.mCurrentDate = DateHelper.format(new Date()); MeasureCurveActivity.this.mEndDate = MeasureCurveActivity.this.mCurrentDate; MeasureCurveActivity.this.mBeginDate = MeasureCurveActivity.this.getDateByMode (MeasureCurveActivity.this.mEndDate, MeasureCurveActivity.this.typeMode, true); MeasureCurveActivity.this.mViewportLeft = 0.0f; MeasureCurveActivity.this.mViewportRight = 0.0f; ((LineChartRenderer) MeasureCurveActivity.this.lineChart.getChartRenderer()) .resetPointIndex(); MeasureCurveActivity.this.requestMeasure(); }
private void onClickListener() { mListView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { isShowListView(); resolutionMap = cameraSize.get(position); String str = resolutionMap.get("width") + "*" + resolutionMap.get("height"); mDialogUtil.setTextSzie(editItemTexts[1], str.length()); editItemTexts[1].setText(str); } }); }
public boolean avPullUpIntercept(View child) { boolean intercept = false; AdapterView adapterChild = (AdapterView) child; // 判断AbsListView是否已经到达内容最底部 if (adapterChild.getLastVisiblePosition() == adapterChild.getCount() - 1 && (adapterChild.getChildAt(adapterChild.getChildCount() - 1).getBottom() == getMeasuredHeight())) { // 如果到达底部,则拦截事件 intercept = true; } return intercept; }
@Override protected void setupClickListeners() { this.getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { editItem(position); } }); ListView listView = getListView(); registerForContextMenu(listView); }
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { SessionAdapter adapter = (SessionAdapter) parent.getAdapter(); final String sessionId = adapter.getSessionIdAtPosition(position); mCallback.onSessionClicked(sessionId); }
private void loadListView() { ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1, items); mListView.setAdapter(adapter); mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { Intent intent = new Intent(getBaseContext(), ItemDescActivity.class); intent.putExtra("itemKey", itemKeys.get(i)); startActivity(intent); } }); }