本文整理匯總了Java中android.widget.AdapterView.OnItemLongClickListener類的典型用法代碼示例。如果您正苦於以下問題:Java OnItemLongClickListener類的具體用法?Java OnItemLongClickListener怎麽用?Java OnItemLongClickListener使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
OnItemLongClickListener類屬於android.widget.AdapterView包,在下文中一共展示了OnItemLongClickListener類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setListLongClick
import android.widget.AdapterView.OnItemLongClickListener; //導入依賴的package包/類
private void setListLongClick() {
this.result_nutrientList.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, final int position, long id) {
new AlertDialog.Builder(FoodActivity.this)
.setItems(R.array.menu_food, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
String[] PK = getResources().getStringArray(R.array.menu_food);
if(PK[which].equals("ɾ����ʳ����Ϣ")) {
showDeleteDialog();
}
}
}).show();
return true;
}
});
}
示例2: itemOnLongClick
import android.widget.AdapterView.OnItemLongClickListener; //導入依賴的package包/類
private void itemOnLongClick() {
this.listview.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, final int position, long id) {
new AlertDialog.Builder(DietActivity.this)
.setItems(R.array.menu_diet, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
String[] PK = getResources().getStringArray(R.array.menu_diet);
if(PK[which].equals("ɾ��������¼")) {
//Log.i("test", "itemDelete:"+position);
itemDelete(position);
}
}
}).show();
return true;
}
});
}
示例3: initView
import android.widget.AdapterView.OnItemLongClickListener; //導入依賴的package包/類
private void initView() {
mView = mInflater.inflate(R.layout.apk_browser, null);
mListView = (GridView) mView.findViewById(R.id.gvApkList);
mListView.setOnItemClickListener(this);
mListView.setOnItemLongClickListener(new OnItemLongClickListener() {
@SuppressLint("NewApi")
@Override
public boolean onItemLongClick(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
/*
* FileItemForOperation fileItem =
* mData.getFileItems().get(arg2); xtemp = arg1.getX(); ytemp
* =arg1.getY(); fileItem.getFileItem().setXlocation(xtemp);
* fileItem.getFileItem().setYlocation(ytemp);
* BrowerItemLongclick(fileItem);
*/
return true;
}
});
}
示例4: initView
import android.widget.AdapterView.OnItemLongClickListener; //導入依賴的package包/類
private void initView() {
mView = mInflater.inflate(R.layout.video_browser, null);
mListView = (ListView) mView.findViewById(R.id.lvVideoList);
mListView.setOnItemClickListener(this);
mGridView = (GridView) mView.findViewById(R.id.gvVideoList);
mGridView.setOnItemClickListener(this);
mGridView.setNumColumns(ScreenWidgh / 160);
mGridView.setVisibility(View.GONE);
mListView.setOnItemLongClickListener(new OnItemLongClickListener() {
@SuppressLint("NewApi")
@Override
public boolean onItemLongClick(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
/*
* FileItemForOperation fileItem =
* mData.getFileItems().get(arg2); xtemp = arg1.getX(); ytemp
* =arg1.getY(); fileItem.getFileItem().setXlocation(xtemp);
* fileItem.getFileItem().setYlocation(ytemp);
* VideoBrowerItemLongclick(fileItem);
*/
return true;
}
});
}
示例5: initView
import android.widget.AdapterView.OnItemLongClickListener; //導入依賴的package包/類
private void initView() {
mView = mInflater.inflate(R.layout.music_browser, null);
mListView = (ListView) mView.findViewById(R.id.lvMusicList);
mListView.setOnItemClickListener(this);
mListView.setOnItemLongClickListener(new OnItemLongClickListener() {
@SuppressLint("NewApi")
@Override
public boolean onItemLongClick(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
/*
* FileItemForOperation fileItem =
* mData.getFileItems().get(arg2); xtemp = arg1.getX(); ytemp
* =arg1.getY(); fileItem.getFileItem().setXlocation(xtemp);
* fileItem.getFileItem().setYlocation(ytemp);
* MusicBrowerItemLongclick(fileItem);
*/
return true;
}
});
}
示例6: onCreate
import android.widget.AdapterView.OnItemLongClickListener; //導入依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTitle(R.string.history_of_spidey_scans);
mDb = DatabaseHelper.getInstance(this);
List<Scan> scans = mDb.getAllScans();
mListView = getListView();
//add on long click listener to start action mode
getListView().setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> adapterView, View view, int position, long id) {
onListItemCheck(position);
return true;
}
});
// use the SimpleCursorAdapter to show the
// elements in a ListView
ScanAdapter adapter = new ScanAdapter(this,scans);
setListAdapter(adapter);
}
示例7: onCreate
import android.widget.AdapterView.OnItemLongClickListener; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
myApp = (MyApplication) getApplication();
setContentView(R.layout.activity_main);
myActivity = this;
mContext = this;
myApp.setUrlVing();
myApp.setPostUrlVing();
Button saveBtn = (Button)findViewById(R.id.saveBtn);
myApp.saveStuff(mContext, saveBtn);
adapter = new PasswordListAdapter(mContext,android.R.layout.simple_list_item_2,myApp.getExpArray());
listView = (ListView) findViewById(R.id.passwordDataList);
listView.setAdapter(adapter);
listView.setOnItemClickListener((OnItemClickListener) mContext);
listView.setOnItemLongClickListener((OnItemLongClickListener) mContext);
myApp.setExpandAdapter(adapter);
ReadKeyFiles readRSATask = new ReadKeyFiles(myActivity, mContext);
readRSATask.execute(myApp);
}
示例8: onCreate
import android.widget.AdapterView.OnItemLongClickListener; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
datasource = new ShowDataSource(this);
datasource.open();
ListView listView = getListView();
listView.setOnItemLongClickListener(new OnItemLongClickListener() {
public boolean onItemLongClick(AdapterView<?> adapterView, View view, int position, long id) {
deleteShowDialog(position);
return true;
}
});
List<Show> shows = datasource.getAllShows();
ShowListAdapter adapter = new ShowListAdapter(this, android.R.layout.simple_list_item_1);
setListAdapter(adapter);
adapter.addAll(shows);
}
示例9: onActivityCreated
import android.widget.AdapterView.OnItemLongClickListener; //導入依賴的package包/類
@Override
public void onActivityCreated(Bundle savedInstanceState){
super.onActivityCreated(savedInstanceState);
// Set the ListView's long click listener.
getListView().setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> listView, View view,
int position, long id) {
if (mChannelLongClickListener != null) {
getListView().setItemChecked(position, true);
mChannelLongClickListener.onChannelLongClicked(position);
return true;
}
return false;
}
});
}
示例10: getDateItemLongClickListener
import android.widget.AdapterView.OnItemLongClickListener; //導入依賴的package包/類
/**
* Callback to listener when date is valid (not disable, not outside of
* min/max date)
*
* @return
*/
private OnItemLongClickListener getDateItemLongClickListener() {
dateItemLongClickListener = new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view,
int position, long id) {
DateTime dateTime = dateInMonthsList.get(position);
if (caldroidListener != null) {
if ((minDateTime != null && dateTime.lt(minDateTime))
|| (maxDateTime != null && dateTime.gt(maxDateTime))
|| (disableDates != null && disableDates
.indexOf(dateTime) != -1)) {
return false;
}
Date date = CalendarHelper.convertDateTimeToDate(dateTime);
caldroidListener.onLongClickDate(date, view);
}
return true;
}
};
return dateItemLongClickListener;
}
示例11: onResult
import android.widget.AdapterView.OnItemLongClickListener; //導入依賴的package包/類
@Override
public void onResult(MetadataBufferResult result) {
if (!result.getStatus().isSuccess()) {
showMessage("Problem while retrieving files");
return;
}
mDriveResultsAdapter.setData(result.getMetadataBuffer());
listView.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent,
View view, int position, long id) {
Metadata metadata = mDriveResultsAdapter.getItem(position);
StringBuilder sb = new StringBuilder();
sb.append(metadata.getTitle() + "\n")
.append(metadata.getMimeType() + "\n")
.append(metadata.getFileSize() + "\n")
.append(metadata.getCreatedDate() + "\n")
.append(metadata.getModifiedDate() + "\n");
showMessage(sb.toString());
return false;
}
});
}
示例12: loadListPosm
import android.widget.AdapterView.OnItemLongClickListener; //導入依賴的package包/類
private void loadListPosm() {
posms.clear();
outletPosm = new TtDKunjunganSurveyorOutletPosm();
outletPosm.setKode(outlet.getKode());
posms = outletPosmDao.listByExample(outletPosm);
adapter = new PosmOutletAdapter(this, posms);
lsOutletPosm.setAdapter(adapter);
adapter.notifyDataSetChanged();
lsOutletPosm.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> arg0, View arg1, int index, long arg3) {
outletPosm = new TtDKunjunganSurveyorOutletPosm();
outletPosm = posms.get(index);
outletPosmDao.delete(outletPosm.getId());
Toast.makeText(getApplicationContext(), "Outlet posm berhasil dihapus", Toast.LENGTH_LONG).show();
loadListPosm();
return false;
}
});
}
示例13: loadListOmsetKategori
import android.widget.AdapterView.OnItemLongClickListener; //導入依賴的package包/類
private void loadListOmsetKategori() {
listOmsetKategori.clear();
omsetKategori = new TtDKunjunganSurveyorOmsetKatagori();
omsetKategoriDao = new TtDKunjunganSurveyorOmsetKatagoriDao(getApplicationContext());
omsetKategori.setKodeKunjungan(outlet.getKode()+new SimpleDateFormat("ddMMyyyy").format(new Date()));
listOmsetKategori = omsetKategoriDao.listByExample(omsetKategori);
adapterOmsetKategori = new OmsetKategoriAdapter(this, listOmsetKategori);
lsOmset.setAdapter(adapterOmsetKategori);
adapterOmsetKategori.notifyDataSetChanged();
lsOmset.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> arg0, View arg1, int index, long arg3) {
omsetKategori = new TtDKunjunganSurveyorOmsetKatagori();
omsetKategori = listOmsetKategori.get(index);
omsetKategoriDao.delete(omsetKategori.getId());
Toast.makeText(getApplicationContext(), "Omset Kategori Berhasil Dihapus", Toast.LENGTH_LONG).show();
loadListPosm();
return false;
}
});
}
示例14: viewFasilitas
import android.widget.AdapterView.OnItemLongClickListener; //導入依賴的package包/類
private void viewFasilitas() {
fasilitasOutlet = new TmOutletFasilitas();
fasilitasOutlet.setKodeOutlet(outlet.getKode());
listFasilitasOutlet = new ArrayList<TmOutletFasilitas>();
listFasilitasOutlet.clear();
listFasilitasOutlet = fasilitasOutletDao.listByExample(fasilitasOutlet);
fasilitasOutletAdapter= new FasilitasAdapter(TabSurveyOutletActivity.this, listFasilitasOutlet);
viewFasilitas.setAdapter(fasilitasOutletAdapter);
viewFasilitas.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> arg0, View arg1,
int i, long index) {
fasilitasOutlet = new TmOutletFasilitas();
fasilitasOutlet = listFasilitasOutlet.get(i);
fasilitasOutletDao.delete(fasilitasOutlet.getId());
Toast.makeText(getApplicationContext(), "Fasilitas outlet berhasil dihapus", Toast.LENGTH_LONG).show();
viewFasilitas();
return false;
}
});
fasilitasOutletAdapter.notifyDataSetChanged();
}
示例15: loadListPosm
import android.widget.AdapterView.OnItemLongClickListener; //導入依賴的package包/類
private void loadListPosm() {
posms.clear();
outletPosm = new TtDKunjunganSurveyorOutletPosm();
outletPosm.setKodeKunjungan(outlet.getKode()
+ kategori.getKodeKategori()
+ new SimpleDateFormat("ddMMyy").format(new Date()));
posms = outletPosmDao.listByExample(outletPosm);
adapter = new PosmOutletAdapter(this, posms);
lsOutletPosm.setAdapter(adapter);
adapter.notifyDataSetChanged();
lsOutletPosm.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> arg0, View arg1,
int index, long arg3) {
outletPosm = new TtDKunjunganSurveyorOutletPosm();
outletPosm = posms.get(index);
outletPosmDao.delete(outletPosm.getId());
Toast.makeText(getApplicationContext(),
"Outlet posm berhasil dihapus", Toast.LENGTH_LONG)
.show();
loadListPosm();
return false;
}
});
}