本文整理匯總了Java中android.widget.AdapterView類的典型用法代碼示例。如果您正苦於以下問題:Java AdapterView類的具體用法?Java AdapterView怎麽用?Java AdapterView使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
AdapterView類屬於android.widget包,在下文中一共展示了AdapterView類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onItemClick
import android.widget.AdapterView; //導入依賴的package包/類
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();
}
示例2: onItemClick
import android.widget.AdapterView; //導入依賴的package包/類
@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();
}
示例3: onItemClick
import android.widget.AdapterView; //導入依賴的package包/類
@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();
}
}
示例4: onCreate
import android.widget.AdapterView; //導入依賴的package包/類
@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();
}
});
}
示例5: lvClick
import android.widget.AdapterView; //導入依賴的package包/類
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;
}
}
});
}
示例6: onItemClick
import android.widget.AdapterView; //導入依賴的package包/類
@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;
}
}
}
示例7: onItemClick
import android.widget.AdapterView; //導入依賴的package包/類
@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);
}
示例8: onItemSelected
import android.widget.AdapterView; //導入依賴的package包/類
@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;
}
}
示例9: onItemLongClick
import android.widget.AdapterView; //導入依賴的package包/類
@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;
}
示例10: onItemClick
import android.widget.AdapterView; //導入依賴的package包/類
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();
}
示例11: onItemClick
import android.widget.AdapterView; //導入依賴的package包/類
@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;
}
}
示例12: newList
import android.widget.AdapterView; //導入依賴的package包/類
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;
}
示例13: onItemLongClick
import android.widget.AdapterView; //導入依賴的package包/類
@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;
}
示例14: initListPop
import android.widget.AdapterView; //導入依賴的package包/類
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();
}
});
}
示例15: addChangeProfilePicListener
import android.widget.AdapterView; //導入依賴的package包/類
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();
}
});
}