当前位置: 首页>>代码示例>>Java>>正文


Java OnItemLongClickListener类代码示例

本文整理汇总了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;
       }
	});
}
 
开发者ID:ghsxl,项目名称:Android-Fitness,代码行数:19,代码来源:FoodActivity.java

示例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;
				       }
	});
}
 
开发者ID:ghsxl,项目名称:Android-Fitness,代码行数:20,代码来源:DietActivity.java

示例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;
		}
	});
}
 
开发者ID:yun2win,项目名称:yun2win-sdk-android,代码行数:22,代码来源:AppBrowser.java

示例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;
		}
	});
}
 
开发者ID:yun2win,项目名称:yun2win-sdk-android,代码行数:26,代码来源:OAFileBrowser.java

示例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;
		}
	});
}
 
开发者ID:yun2win,项目名称:yun2win-sdk-android,代码行数:22,代码来源:MusicFileBrowser.java

示例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);
     
}
 
开发者ID:jtwarren,项目名称:spidey,代码行数:27,代码来源:ScansActivity.java

示例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);
}
 
开发者ID:vinginmedina,项目名称:AccountPasswordsAndroid,代码行数:21,代码来源:MainActivity.java

示例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);
}
 
开发者ID:larseknu,项目名称:android_programmering_2014,代码行数:23,代码来源:ShowListActivity.java

示例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;
		}
	});
}
 
开发者ID:teejoe,项目名称:RssReader,代码行数:20,代码来源:ChannelListFragment.java

示例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;
}
 
开发者ID:iSCAU,项目名称:iSCAU-Android,代码行数:32,代码来源:CaldroidFragment.java

示例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;
		}
	});
}
 
开发者ID:kanpol,项目名称:omni-note,代码行数:25,代码来源:DriveActivity.java

示例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;
		}
	});
}
 
开发者ID:kohming,项目名称:qsolution,代码行数:22,代码来源:TabSurveyAudit.java

示例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;
		}
	});
}
 
开发者ID:kohming,项目名称:qsolution,代码行数:23,代码来源:TabSurveyAudit.java

示例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();

}
 
开发者ID:kohming,项目名称:qsolution,代码行数:25,代码来源:TabSurveyOutletActivity.java

示例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;
		}
	});
}
 
开发者ID:kohming,项目名称:qsolution,代码行数:27,代码来源:TabSurveyOutlet.java


注:本文中的android.widget.AdapterView.OnItemLongClickListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。