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


Java Adapter.getItem方法代码示例

本文整理汇总了Java中android.widget.Adapter.getItem方法的典型用法代码示例。如果您正苦于以下问题:Java Adapter.getItem方法的具体用法?Java Adapter.getItem怎么用?Java Adapter.getItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.Adapter的用法示例。


在下文中一共展示了Adapter.getItem方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getItem

import android.widget.Adapter; //导入方法依赖的package包/类
@Override
public Object getItem(int position)
{
    
    for (final Map.Entry<String,Adapter> entry : sectionMap.entrySet())
    {
        final Adapter adapter = entry.getValue();
        
        final int size = adapter.getCount() + (hasSectionHeader ? 1 : 0);
        
        if (position == 0 && hasSectionHeader)
            return entry.getKey();
        
        if (position < size)
            return adapter.getItem(position - 1);
        
        position -= size;
    }
    
    return null;
}
 
开发者ID:rtr-nettest,项目名称:open-rmbt,代码行数:22,代码来源:SectionListAdapter.java

示例2: updateNote

import android.widget.Adapter; //导入方法依赖的package包/类
private void updateNote(){
    Adapter a = lvItemList.getAdapter();
    JSONArray jsonArray = new JSONArray();

    try {
        CheckListItem temp;
        for (int i = 0; i < itemNamesList.size(); i++) {
            temp = (CheckListItem) a.getItem(i);
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("name", temp.getName());
            jsonObject.put("checked", temp.isChecked());
            jsonArray.put(jsonObject);
        }
        fillNameIfEmpty();
        DbAccess.updateNote(getBaseContext(), id, etName.getText().toString(), jsonArray.toString(), currentCat);
        Toast.makeText(getApplicationContext(), R.string.toast_updated, Toast.LENGTH_SHORT).show();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:SecUSo,项目名称:privacy-friendly-notes,代码行数:21,代码来源:ChecklistNoteActivity.java

示例3: saveNote

import android.widget.Adapter; //导入方法依赖的package包/类
private void saveNote(){
    Adapter a = lvItemList.getAdapter();
    JSONArray jsonArray = new JSONArray();
    try {
        CheckListItem temp;
        for (int i = 0; i < itemNamesList.size(); i++) {
            temp = (CheckListItem) a.getItem(i);
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("name", temp.getName());
            jsonObject.put("checked", temp.isChecked());
            jsonArray.put(jsonObject);
        }
        fillNameIfEmpty();
        id = DbAccess.addNote(getBaseContext(), etName.getText().toString(), jsonArray.toString(), DbContract.NoteEntry.TYPE_CHECKLIST, currentCat);
        Toast.makeText(getApplicationContext(), R.string.toast_saved, Toast.LENGTH_SHORT).show();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:SecUSo,项目名称:privacy-friendly-notes,代码行数:20,代码来源:ChecklistNoteActivity.java

示例4: getSelectedItem

import android.widget.Adapter; //导入方法依赖的package包/类
public Object getSelectedItem() {
    if (mCurrSelectedView != null) {
        int position = mCurrSelectedView.getPosition();
        Adapter adapter = mSpinnerListView.getAdapter();
        if (adapter != null && adapter.getCount() > 0 && position >= 0) {
            return adapter.getItem(position);
        } else {
            return null;
        }
    }
    return null;
}
 
开发者ID:michaelprimez,项目名称:searchablespinner,代码行数:13,代码来源:SearchableSpinner.java

示例5: getItemPosition

import android.widget.Adapter; //导入方法依赖的package包/类
public int getItemPosition(Object item) {
    if (item == null)
        return -1;
    Adapter adapter = mSpinnerListView.getAdapter();
    if (adapter != null) {
        for (int i = 0; i < adapter.getCount(); i++) {
            Object adpItem = adapter.getItem(i);
            if (adpItem != null && adpItem.equals(item)) {
                return i;
            }
        }
    }
    return -1;
}
 
开发者ID:michaelprimez,项目名称:searchablespinner,代码行数:15,代码来源:SearchableSpinner.java

示例6: getSelectedItem

import android.widget.Adapter; //导入方法依赖的package包/类
public Object getSelectedItem() {
	Adapter localAdapter = getAdapter();
	int i = getSelectedItemPosition();
	if ((localAdapter != null) && (localAdapter.getCount() > 0) && (i >= 0))
		return localAdapter.getItem(i);
	return null;
}
 
开发者ID:Evan-Galvin,项目名称:FreeStreams-TVLauncher,代码行数:8,代码来源:AdapterView.java

示例7: getItem

import android.widget.Adapter; //导入方法依赖的package包/类
@Override
public Object getItem(int position) {
    for (Object section : this.sections.keySet()) {
        Adapter adapter = sections.get(section);
        int size = adapter.getCount() + 1;

        // check if position inside this section
        if (position == 0) return section;
        if (position < size) return adapter.getItem(position - 1);

        // otherwise jump into next section
        position -= size;
    }
    return null;
}
 
开发者ID:Kamshak,项目名称:foursquared,代码行数:16,代码来源:SeparatedListAdapter.java

示例8: getContentString

import android.widget.Adapter; //导入方法依赖的package包/类
private String getContentString(){
    StringBuilder content = new StringBuilder();
    Adapter a = lvItemList.getAdapter();
    CheckListItem temp;
    for (int i=0; i < itemNamesList.size(); i++) {
        temp = (CheckListItem) a.getItem(i);
        content.append("- " + temp.getName() + " [" + (temp.isChecked() ? "✓" : "   ") + "]\n");
    }
    return content.toString();
}
 
开发者ID:SecUSo,项目名称:privacy-friendly-notes,代码行数:11,代码来源:ChecklistNoteActivity.java

示例9: getItem

import android.widget.Adapter; //导入方法依赖的package包/类
public Object getItem(int position) {
    for(Object section : this.sections.keySet()) {
        Adapter adapter = sections.get(section);
        int size = adapter.getCount() + 1;

        // check if position inside this section
        if(position == 0) return section;
        if(position < size) return adapter.getItem(position - 1);

        // otherwise jump into next section
        position -= size;
    }
    return null;
}
 
开发者ID:wseemann,项目名称:RoMote,代码行数:15,代码来源:SeparatedListAdapter.java

示例10: getItemAtPosition

import android.widget.Adapter; //导入方法依赖的package包/类
public Object getItemAtPosition(int paramInt) {
	Adapter localAdapter = getAdapter();
	return (localAdapter == null) || (paramInt < 0) ? null : localAdapter.getItem(paramInt);
}
 
开发者ID:Evan-Galvin,项目名称:FreeStreams-TVLauncher,代码行数:5,代码来源:AdapterView.java


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