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


Java ArrayAdapter.getCount方法代码示例

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


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

示例1: onTouch

import android.widget.ArrayAdapter; //导入方法依赖的package包/类
@Override
public boolean onTouch(View v, MotionEvent event) {
    if (event.getAction() == MotionEvent.ACTION_DOWN) {
        ArrayAdapter adapter = (ArrayAdapter) getAdapter();

        if (null != adapter) {

            if (_items.size() == 0) {
                for (int i = 0; i < adapter.getCount(); i++) {
                    _items.add(adapter.getItem(i));
                }
            }
            SearchableListDialog searchableListDialog = SearchableListDialog.newInstance
                    (_items);
            searchableListDialog.setOnSearchableItemClickListener(this);
            searchableListDialog.show(((Activity) _context).getFragmentManager(), "TAG");
        }
    }
    return true;
}
 
开发者ID:mityung,项目名称:XERUNG,代码行数:21,代码来源:SearchableSpinner.java

示例2: selectSpinnerItemByValue

import android.widget.ArrayAdapter; //导入方法依赖的package包/类
/**
 *
 * @param spnr
 * @param value
 *
 * solution based on an answer from stack overflow
 * resource: https://stackoverflow.com/questions/11072576/set-selected-item-of-spinner-programmatically
 *
 */

public static void selectSpinnerItemByValue(Spinner spnr, String value) {
    ArrayAdapter<String> adapter = (ArrayAdapter<String>) spnr.getAdapter();
    String currentItem;

    for (int i = 0; i < adapter.getCount(); i++) {
        currentItem = adapter.getItem(i);
        if(currentItem.equals(value)) {
            spnr.setSelection(i);
            return;
        }
    }
}
 
开发者ID:CMPUT301F17T15,项目名称:CIA,代码行数:23,代码来源:HabitViewActivity.java

示例3: isSameCollection

import android.widget.ArrayAdapter; //导入方法依赖的package包/类
public boolean isSameCollection(ArrayAdapter<TGSelectableItem> c1, ArrayAdapter<TGSelectableItem> c2) {
	if( c1 == c2 ) {
		return true;
	}
	if( c1 != null && c2 != null && c1.getCount() == c2.getCount() ) {
		int count = c1.getCount();
		for(int i = 0 ; i < count ; i ++) {
			if(!this.isSameObject(c1.getItem(i), c2.getItem(i))) {
				return false;
			}
		}
		return true;
	}
	return false;
}
 
开发者ID:axlecho,项目名称:tuxguitar,代码行数:16,代码来源:TGBrowserView.java

示例4: initBLEMeters

import android.widget.ArrayAdapter; //导入方法依赖的package包/类
private int initBLEMeters() {
		int adapterCount = 0;
		if (getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
			 
		    mPairedMeterNames = new HashMap<String, String>();
		    mPairedMeterAddrs = new HashMap<String, String>();
	    mPairedMeterCount = MeterPreferenceDialog.getPairedMeters(this, mPairedMeterNames, mPairedMeterAddrs);
	    
	    ArrayAdapter<String> selectedMeterSpinnerAdapter = (ArrayAdapter<String>)mSelectedMeter.getAdapter();
	    adapterCount = selectedMeterSpinnerAdapter.getCount();
			String nameKey;
		String addrKey;
		String nameValue;
		String addrValue;
	    for (int i=0; i<mPairedMeterCount; i++) {
	    	nameKey = PCLinkLibraryDemoConstant.BLE_PAIRED_METER_NAME_ + String.valueOf(i);
			addrKey = PCLinkLibraryDemoConstant.BLE_PAIRED_METER_ADDR_ + String.valueOf(i);
			nameValue = mPairedMeterNames.get(nameKey);
			addrValue = mPairedMeterAddrs.get(addrKey);
		    String remoteDeviceName = nameValue + "/" + addrValue;
		    
		    if (selectedMeterSpinnerAdapter != null) {
		    	boolean find_flag = false;
			    for (int j=0; j<selectedMeterSpinnerAdapter.getCount(); j++) {
	 				String remoteDeviceName2 = selectedMeterSpinnerAdapter.getItem(j);
	 				if (remoteDeviceName.equals(remoteDeviceName2)) {
	 					find_flag = true;
	 					break;
	 				}
	 			}
			    if (!find_flag) {
				    adapterCount++;
 					selectedMeterSpinnerAdapter.add(remoteDeviceName);
			    }
		    }
	    }
	}
		
		return adapterCount;
}
 
开发者ID:Welloculus,项目名称:MobileAppForPatient,代码行数:41,代码来源:PCLinkLibraryDemoActivity.java

示例5: setSpinnerSelectedID

import android.widget.ArrayAdapter; //导入方法依赖的package包/类
@SuppressWarnings("ConstantConditions")
public void setSpinnerSelectedID(Spinner sp, String text) {
    ArrayAdapter sca = (ArrayAdapter) sp.getAdapter();
    if (sca == null) {
        return;
    }

    for (int i = 0; i < sca.getCount(); i++) {
        if (sca.getItem(i) != null && sca.getItem(i).toString().equals(text)) {
            sp.setSelection(i);
            return;
        }
    }
}
 
开发者ID:mkeresztes,项目名称:AndiCar,代码行数:15,代码来源:BaseEditFragment.java


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