Android Open Source - game_guess_lib Dialog Modal List Adapter

From Project

Back to project page game_guess_lib.


The source code is released under:

MIT License

If you think the Android project game_guess_lib 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.wkmf.guess.lib.common.dialog;
//w  w  w .  j a va  2s .  com
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.wkmf.guess.lib.R;

import java.util.List;

public class DialogModalListAdapter extends BaseAdapter{

  private Context context;
  //lista de elementos
  private List<DialogElement> elements;

  public DialogModalListAdapter(Context context, List<DialogElement> elements) {
    this.context = context;
    this.elements = elements;

  //generamos la vista
  public View getView(int pos, View v, ViewGroup parent) {
    if(v == null){
      v = ((LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE))
          .inflate(R.layout.item_dialog, null);
    //recuperamos el objeto
    DialogElement element = (DialogElement)getItem(pos);
    //pintamos el titulo
        // cantidad de vidas
        // icono

    //devolvemos la vista
    return v;

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

  public Object getItem(int pos) {
    return elements.get(pos);

  public long getItemId(int pos) {
    return 0;

Java Source Code List