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


Java ListView.getItemAtPosition方法代码示例

本文整理汇总了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...");
    }
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:27,代码来源:ShortcutWidgetConfigure.java

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

示例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();
    }
}
 
开发者ID:alibaba,项目名称:Virtualview-Android,代码行数:16,代码来源:ScriptListActivity.java

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

示例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);
}
 
开发者ID:yangjiantao,项目名称:AndroidUiKit,代码行数:10,代码来源:HomeActivity.java

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

示例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;
    }
}
 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:27,代码来源:AccountsSettingsFragment.java

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

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

示例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);
}
 
开发者ID:yangyankai,项目名称:Seconds,代码行数:9,代码来源:ActivityMain.java

示例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");
    }
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:29,代码来源:SimplyDoActivity.java

示例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);
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:11,代码来源:SimplyDoActivity.java

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

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

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


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