Android Open Source - digital-ocean-swimmer Record Type Adapter

From Project

Back to project page digital-ocean-swimmer.


The source code is released under:

MIT License

If you think the Android project digital-ocean-swimmer listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.yassirh.digitalocean.ui;
/*from w  w w .jav  a 2 s  .  c o m*/
import java.util.HashMap;

import com.yassirh.digitalocean.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

public class RecordTypeAdapter extends BaseAdapter {

    public static HashMap<String, Integer> sData = new HashMap<String, Integer>();
      sData.put("ns", R.drawable.ns);
        sData.put("srv", R.drawable.srv);
        sData.put("txt", R.drawable.txt);
        sData.put("cname", R.drawable.cname);
    private String[] keys;
    private static LayoutInflater inflater = null;
    public RecordTypeAdapter(Activity activity){
        keys = sData.keySet().toArray(new String[sData.size()]);
        inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    public int getCount() {
        return sData.size();

    public Object getItem(int position) {
        return sData.get(keys[position]);

    public long getItemId(int position) {
        return position;

    public View getView(int pos, View convertView, ViewGroup parent) {
       View vi=convertView;
             vi = inflater.inflate(R.layout.record_type_list_row, parent, false);
        ImageView recordTypeImageView = (ImageView) vi.findViewById(;
        return vi;

Java Source Code List