add Button to TableLayout - Android android.widget

Android examples for android.widget:TableLayout

Description

add Button to TableLayout

Demo Code

import android.content.Context;
import android.widget.Button;
import android.widget.TableLayout;

public class Main {

  public static Button addButton(Context ctx, TableLayout parent, String text) {
    Button btn = new Button(ctx);
    btn.setText(text);//from   w w w.j ava  2 s .  c om
    parent.addView(btn);
    return btn;
  }

}

Related Tutorials