Example usage for android.widget TableLayout getContext

List of usage examples for android.widget TableLayout getContext

Introduction

In this page you can find the example usage for android.widget TableLayout getContext.

Prototype

@ViewDebug.CapturedViewProperty
public final Context getContext() 

Source Link

Document

Returns the context the view is running in, through which it can access the current theme, resources, etc.

Usage

From source file:org.brandroid.openmanager.fragments.DialogHandler.java

private static void fillShortcutsTable(TableLayout table) {
    final Context context = table.getContext();
    for (int sc : MenuUtils.getMenuShortcuts(context)) {
        TableRow tr = new TableRow(context);
        TextView tv1 = new TextView(context);
        tv1.setGravity(Gravity.RIGHT);/*from  w ww.j a v a 2s.c om*/
        tv1.setPadding(20, 0, 20, 0);
        char scc = (char) (sc + ('a' - KeyEvent.KEYCODE_A));
        tv1.setText("" + scc);
        TextView tv2 = new TextView(context);
        MenuItem item = MenuUtils.getMenuShortcut(sc);
        tv2.setText(item.getTitle());
        tr.addView(tv1);
        tr.addView(tv2);
        table.addView(tr);
    }
}