Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Populating a ListView with Kumulos

I'm having trouble implementing Kumulos into my ListView. I'm new to database manipulation and was unable to find any examples of how to use Kumulos through stackoverflow and google.

Question about my Custom Adapter. How do I insert an image from Kumulos into my custom adapter?

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
public class CustomListViewAdapter extends BaseAdapter {

private Context mContext;
private ArrayList<HashMap<String, String>> person;
private static LayoutInflater inflater = null;

public CustomListViewAdapter(Context context, ArrayList<HashMap<String, String>> data){

    mContext = context;
    person = data;
    inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}


@Override
public int getCount() {
    return person.size();
}

@Override
public Object getItem(int position) {
    return position;
}

@Override
public long getItemId(int position) {
    return position;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {

    View view = convertView;

    if (convertView == null){

        view = inflater.inflate(R.layout.personlist_row, null);

        TextView dl = (TextView) view.findViewById(R.id.tvdl);
        TextView last = (TextView) view.findViewById(R.id.tvLastName);
        TextView first = (TextView) view.findViewById(R.id.tvFirstName);
        TextView middle = (TextView) view.findViewById(R.id.tvMiddleName);
        TextView ss = (TextView) view.findViewById(R.id.tvSS);
        ImageView image = (ImageView) view.findViewById(R.id.idPic);

        HashMap<String, String> mPerson = new HashMap<>();

        mPerson = person.get(position);



        dl.setText(mPerson.get("dl"));
        last.setText(mPerson.get("lastName"));
        first.setText(mPerson.get("firstName"));
        middle.setText(mPerson.get("middleName"));
        ss.setText(mPerson.get("ss"));
        ????????image.setImageDrawable(mContext.getResources().????????????????????



    }


    return view;
}

}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////

I'm really having the most difficulty with using Kumulos to fill in my data.

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public class PersonSearchPop extends Activity {

private ListView personlist;
private CustomListViewAdapter customListViewAdapter;
public static final String YOUR_API_KEY = "FIELD HIDDEN";
public static final String YOUR_SECRET_KEY = "FIELD  HIDDEN";


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.listview_popup);

    Kumulos.initWithAPIKeyAndSecretKey(YOUR_API_KEY, YOUR_SECRET_KEY, this);

    DisplayMetrics dm = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(dm);

    int width = dm.widthPixels;
    int height = dm.heightPixels;

    getWindow().setLayout((int) (width * .4), (int) (height * .6));

///////////////////////////////////////////////////////////////////////////////////////////////////////////

    String lname = "Johnson";
    HashMap<String, String> params = new HashMap<String, String>();
    params.put("lastName",String.valueOf(lname));
    Kumulos.call("searchPerson", params, new ResponseHandler()){

        @Override
        public void didCompleteWithResult(Object result){
            List<Map<String, Object>> result = (ArrayList<LinkedHashMap<String, Object>>) result;
            for (LinkedHashMap<String, Object> item:results){
                String make = (String) item.get("make");
                String model = (String) item.get("model");
            }
        }
    }

    for (int i = 0; i < 10; i++){

        HashMap<String, String> data = new HashMap<>();
        data.put("title", bookTitles[i]);
        data.put("pages", bookPages[i]);
        data.put("author", authors[i]);


        authorList.add(data);

///////////////////////////////////////////////////////////////////////////////////////////////////////

    personlist = (ListView) findViewById(R.id.list);
    customListViewAdapter = new CustomListViewAdapter(getApplicationContext(),params);
    personlist.setAdapter(customListViewAdapter);   


    personlist.setOnItemClickListener(new AdapterView.OnItemClickListener(){
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id){
            finish();
        }
    });
}

}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////

Sign In or Register to comment.