@Override
 public void onClick(View v) {
   for (int i = 0; i < characters.size(); ++i) {
     characters.get(i).setClicked(true);
     characters.get(i).changeBorder();
   }
   ((CharTextView) v).setClicked(false);
   ((CharTextView) v).changeBorder();
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    characters = new ArrayList<CharTextView>();
    mainLayout = new LinearLayout(this);
    setContentView(mainLayout);
    mainLayout.setOrientation(LinearLayout.VERTICAL);
    mainLayout.setId(442);
    grid = new GridLayout(this);
    GridLayout.LayoutParams gridParams =
        new GridLayout.LayoutParams(GridLayout.spec(3), GridLayout.spec(7));
    grid.setId(444);
    int counter = 0;
    for (int i = 0; i < 7; ++i) {
      for (int j = 0; j < 2; ++j) {
        CharTextView iv = new CharTextView(this);
        Bitmap joeAvatar = BitmapFactory.decodeResource(getResources(), R.drawable.joe);
        Character joe = new Character(joeAvatar, "Joe Nash", 24, "United Kingdom");
        iv.setCharacterCell(joe);
        iv.setId(50 + counter);
        GridLayout.LayoutParams buttonparams =
            new GridLayout.LayoutParams(GridLayout.spec(j), GridLayout.spec(i));
        buttonparams.height = 200;
        buttonparams.width = 150;
        iv.setOnClickListener(this);
        grid.addView(iv, buttonparams);
        characters.add(iv);
        counter++;
      }
    }

    heroLayout = new FrameLayout(this);
    heroLayout.setId(443);
    FrameLayout.LayoutParams frameParams =
        new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    frameParams.height = 600;
    ImageView portrait = new ImageView(this);
    portrait.setImageBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.joenash));
    heroLayout.addView(portrait);

    Button fightButton = new Button(this);
    fightButton.setText(R.string.fight);
    ViewGroup.LayoutParams buttonParams =
        new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    buttonParams.height = 150;
    buttonParams.width = 650;

    mainLayout.addView(heroLayout, frameParams);
    mainLayout.addView(grid, gridParams);
    mainLayout.addView(fightButton, buttonParams);
    // znameto
    //        heroLayout.setBackground();
    // String variable = "variable"
    // int Button = getResources().getIdentifier(variable, "drawable", getPackageName());
  }