Code example for GridView

Methods: setAdaptersetNumColumns

0
    @AfterViews 
    protected void afterViews() { 
        bus.register(ottoEventsReceiver = new OttoEventsReceiver()); 
        youScore.setText("0"); 
        himScore.setText("0"); 
        grid.setAdapter(new ArrayAdapter<String>(this, // 
                android.R.layout.simple_list_item_1, new String[] { // 
                "X", "O", " ", // 
                        " ", "X", "X", // 
                        "O", "O", "X" // 
                })); 
        grid.setNumColumns(3); 
    } 
 
    @Override 
    public void onBackPressed() { 
        finish(); 
        overridePendingTransition(// 
                R.anim.slide_in_from_left, // 
                R.anim.slide_out_to_right); 
Stop searching for code, let great code find you!  Add Codota to your java IDE