Back to project page android-simlple-minefield.
The source code is released under:
Apache License
If you think the Android project android-simlple-minefield listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.trabo.minefield; /*from w w w .j a va 2 s . c o m*/ import android.content.Context; import android.util.AttributeSet; import android.widget.GridLayout; /** * @author Andriy Petruk <andrii.petruk{at}gmail.com> * @date 23.06.14. */ public class MinefieldView extends GridLayout { public MinefieldView(Context context) { super(context); } public MinefieldView(Context context, AttributeSet attrs) { super(context, attrs); } public MinefieldView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public void setAdapter(MinefieldAdapter minefieldAdapter) { removeAllViews(); int width = minefieldAdapter.getWidth(); int height = minefieldAdapter.getHeight(); setColumnCount(width); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { addView(minefieldAdapter.getView(y, x)); } } } }