public static void main(String[] args) { Personaje per1 = new Pacman(); System.out.println(per1.getNombre() + ", avanzo de a " + per1.getAvance() + " pasos"); per1.setSpeedBehavior(new Speed2()); System.out.println(per1.getNombre() + ", avanzo de a " + per1.getAvance() + " pasos"); per1.setSEatBehavior(new CanEat()); System.out.println(per1.getNombre() + ", avanzo de a " + per1.getAvance() + " pasos"); }
@Override public View getView(int position, View convertView, ViewGroup parent) { View view = convertView; if (view == null) { view = LayoutInflater.from(getContext()).inflate(R.layout.personaje_list, parent, false); } // Metemos datos Personaje personaje = getItem(position); String path = Environment.getExternalStorageDirectory().toString() + "/ImagenesMMO/" + personaje.getNombreImagen(); ImageView imagenPersonaje = (ImageView) view.findViewById(R.id.imagenPersonaje); TextView nombrePersonaje = (TextView) view.findViewById(R.id.nombrePersonaje); TextView clasePersonaje = (TextView) view.findViewById(R.id.clasePersonaje); TextView resumenPersonaje = (TextView) view.findViewById(R.id.resumenPersonaje); imagenPersonaje.setImageDrawable(Drawable.createFromPath(path)); nombrePersonaje.setText(personaje.getNombre()); clasePersonaje.setText(personaje.getClase()); resumenPersonaje.setText(personaje.getResumen()); return view; }