Now it's time to explore Android for me. I have designed one ui which is shown below, The thing is I am getting confused with what should I do in the first frame in order to get 9x9 grid. Actually the same thing I developed in core java by placing 81 JTextFields in each cell using for loops and with the help of gridbaglayout and I got my application perfectly working. But in android how can I define my 9x9 cells in xml, so that it should accept numbers and entered numbers should be retrieved too in order to validate the sudoku rules. Following is my code and diagram. Can anyone suggest how to make the frame 1 to have 9x9 cells? If I use TextEdit in my xml file, it would be 81 textfields, and if I use Canvas(I am thinking, don't know whether it is possible), it seems to me impossible to make it accept numbers and to retrieve from that canvas board. I really appreciate if anyone could help. Please go easy, if it seems silly question(which I hope not, as I tried 2 days for it), as I am new to android. Thanks in advance.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<FrameLayout
android:id="@+id/fLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="2"
android:background="#0f0"
/>
<FrameLayout
android:id="@+id/fLayout2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="3"
android:background="#00f">
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/keypad"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:stretchColumns="*">
<TableRow >
<Button android:id="@+id/cancel"
android:text="cancel"
android:layout_span="3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
</TableRow>
<TableRow>
<Button android:id="@+id/submit"
android:text="validate"
android:layout_span="3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
</Button>
</TableRow>
</TableLayout>
</FrameLayout>
</LinearLayout>
Here is the UI
.
I suggest you to use Grid View
GridView is a ViewGroup that displays items in a two-dimensional, scrollable grid. The grid items are automatically inserted to the layout using a ListAdapter.