Code example for SparseArray

Methods: keyAt

0
	public Profile getItem(int position) {
		return profilesList.valueAt(position);
	} 
 
	public long getItemId(int position) {
		return profilesList.keyAt(position);
	} 
 
	public View getView(int position, View convertView, ViewGroup parent) {
		View v = convertView;
		Profile profile = profilesList.valueAt(position); // Collect the profile concerned
		if (v == null){
			LayoutInflater vi = (LayoutInflater) this.c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			v = vi.inflate(R.layout.item_list, null);
		} 
		 
		TextView default_TV = (TextView) v.findViewById(R.id.textView_DEFAULT);
		 
		// Checking if the current profile is by default 
		Database db = new Database(c);
		if(TouchIrc.getInstance().getIdDefaultProfile() == getItemId(position)){