本文整理汇总了Java中android.widget.ListView.getItemAtPosition方法的典型用法代码示例。如果您正苦于以下问题:Java ListView.getItemAtPosition方法的具体用法?Java ListView.getItemAtPosition怎么用?Java ListView.getItemAtPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.ListView
的用法示例。
在下文中一共展示了ListView.getItemAtPosition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onListItemClick
import android.widget.ListView; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
protected void onListItemClick(ListView l, View v, int position, long id) {
Map<String, Object> map = (Map<String, Object>)l.getItemAtPosition(position);
Integer index = (Integer) map.get(KEY_INDEX);
if(appWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID) {
SharedPreferences prefs = getSharedPreferences(WIDGET_PREFS, 0);
SharedPreferences.Editor edit = prefs.edit();
edit.putInt(getPrefsKey(appWidgetId), index);
edit.commit();
Intent resultValue = new Intent();
resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,
appWidgetId);
setResult(RESULT_OK, resultValue);
ShortcutWidgetProvider.updateWidget(this);
finish();
}else {
Log.w(THIS_FILE, "Invalid widget ID here...");
}
}
示例2: onListItemClick
import android.widget.ListView; //导入方法依赖的package包/类
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
Map<String, String> item = (Map<String, String>)l.getItemAtPosition(position);
String className = item.get("class");
Intent intent = new Intent();
intent.setComponent(new ComponentName(this, className));
intent.putExtra("name", item.get("name"));
intent.putExtra("data", item.get("data"));
startActivity(intent);
}
示例3: onListItemClick
import android.widget.ListView; //导入方法依赖的package包/类
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
Map<String, String> item = (Map<String, String>)l.getItemAtPosition(position);
String className = item.get("class");
if (className != null) {
Intent intent = new Intent();
intent.setComponent(new ComponentName(this, className));
intent.putExtra("name", item.get("name"));
intent.putExtra("data", item.get("data"));
startActivity(intent);
} else {
String result = VSEngine.test();
Toast.makeText(getApplicationContext(), "executing result: " + result, Toast.LENGTH_LONG).show();
}
}
示例4: onListItemClick
import android.widget.ListView; //导入方法依赖的package包/类
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
Item item = (Item) l.getItemAtPosition(position);
if (mCurrentItem != null) {
if (item.isUp) {
File path = new File(mCurrentItem);
if (path.getParentFile() != null) {
mNextItem = path.getParentFile().getAbsolutePath();
tryLoadFileListFromNext(false);
}
} else {
File sel = new File(mCurrentItem, item.name);
if (sel.isDirectory()) {
mNextItem = sel.getAbsolutePath();
tryLoadFileListFromNext(false);
}
}
} else {
Log.e(TAG, "Clicked on " + item.name + " but there is no current directory set");
}
}
示例5: onListItemClick
import android.widget.ListView; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
protected void onListItemClick(ListView l, View v, int position, long id) {
Map<String, Object> map = (Map<String, Object>)l.getItemAtPosition(position);
Intent intent = new Intent((Intent) map.get("intent"));
intent.addCategory(APP_CAGEGORY);
startActivity(intent);
}
示例6: onItemClick
import android.widget.ListView; //导入方法依赖的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);
}
示例7: onClick
import android.widget.ListView; //导入方法依赖的package包/类
@Override
public void onClick(final DialogInterface dialog, final int which) {
final String oldAccount = getSignedInAccountName();
switch (which) {
case DialogInterface.BUTTON_POSITIVE: // Signed in
final ListView lv = ((AlertDialog)dialog).getListView();
final String newAccount =
(String) lv.getItemAtPosition(lv.getCheckedItemPosition());
getSharedPreferences()
.edit()
.putString(PREF_ACCOUNT_NAME, newAccount)
.apply();
AccountStateChangedListener.onAccountSignedIn(oldAccount, newAccount);
if (mDependentPreference != null) {
mDependentPreference.setChecked(true);
}
break;
case DialogInterface.BUTTON_NEUTRAL: // Signed out
AccountStateChangedListener.onAccountSignedOut(oldAccount);
getSharedPreferences()
.edit()
.remove(PREF_ACCOUNT_NAME)
.apply();
break;
}
}
示例8: onListItemClick
import android.widget.ListView; //导入方法依赖的package包/类
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
Map<String, String> item = (Map<String, String>)l.getItemAtPosition(position);
String className = item.get("class");
if (className != null) {
Intent intent = new Intent();
intent.setComponent(new ComponentName(this, className));
startActivity(intent);
}
}
示例9: onListItemClick
import android.widget.ListView; //导入方法依赖的package包/类
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
if (mListener != null) {
DrawerItem item = (DrawerItem) l.getItemAtPosition(position);
mListener.onDrawerItemClicked(item);
}
}
示例10: onListItemClick
import android.widget.ListView; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
protected void onListItemClick(ListView l, View v, int position, long id) {
Map<String, Object> map = (Map<String, Object>) l.getItemAtPosition(position);
Intent intent = (Intent) map.get("intent");
startActivity(intent);
}
示例11: onCreateContextMenu
import android.widget.ListView; //导入方法依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo)
{
Log.v(L.TAG, "ItemsListReactor.onCreateContextMenu()");
AdapterContextMenuInfo ctxMenuInfo = (AdapterContextMenuInfo)menuInfo;
ListView listView = (ListView)findViewById(R.id.ItemsListView);
ctxItem = (ItemDesc)listView.getItemAtPosition(ctxMenuInfo.position);
menu.setHeaderTitle("Item Options");
menu.add(Menu.NONE, EDIT_ITEM, Menu.NONE, "Edit");
menu.add(Menu.NONE, DELETE_ITEM, Menu.NONE, "Delete");
String toggleText;
if(ctxItem.isStar())
{
toggleText = "Remove Star";
}
else
{
toggleText = "Add Star";
}
menu.add(Menu.NONE, TOGGLE_STAR, Menu.NONE, toggleText);
if(dataViewer.getListData().size() > 1)
{
menu.add(Menu.NONE, MOVE_ITEM, Menu.NONE, "Move To");
}
}
示例12: onItemClick
import android.widget.ListView; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> adapter, View view, int position,
long id)
{
Log.v(L.TAG, "ItemsListReactor.onItemClick()");
ListView listView = (ListView)findViewById(R.id.ItemsListView);
ItemDesc itemDesc = (ItemDesc)listView.getItemAtPosition(position);
itemSelected(itemDesc);
}
示例13: onListItemClick
import android.widget.ListView; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void onListItemClick(ListView l, View v, int position, long id) {
Map<String, Object> map = (Map<String, Object>)l.getItemAtPosition(position);
Intent intent = (Intent) map.get("intent");
startActivity(intent);
}
示例14: onListItemClick
import android.widget.ListView; //导入方法依赖的package包/类
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
Map<String, Object> map = (Map<String, Object>)l.getItemAtPosition(position);
Intent intent = new Intent((Intent) map.get("intent"));
intent.addCategory(Intent.CATEGORY_SAMPLE_CODE);
startActivity(intent);
}
示例15: onListItemClick
import android.widget.ListView; //导入方法依赖的package包/类
@Override
protected void onListItemClick(ListView listView, View view, int position, long id) {
Map<String, Object> map = (Map<String, Object>)listView.getItemAtPosition(position);
Intent intent = (Intent) map.get(CLASS_NAME);
startActivity(intent);
}