See this picture:

I am designing a sudoku in android, have done the layout like this, so 81 Editext is there. I
Create edittexts dynamically.
In every iteration you are rewriting the ed variable, so when loop is finished ed only points to the last EditText instance you created.
You should store all references to all EditTexts:
EditText ed;
List allEds = new ArrayList();
for (int i = 0; i < count; i++) {
ed = new EditText(Activity2.this);
allEds.add(ed);
ed.setBackgroundResource(R.color.blackOpacity);
ed.setId(id);
ed.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT));
linear.addView(ed);
}
Now allEds list hold references to all EditTexts, so you can iterate it and get all the data.
getting data
String[] strings = new String[](allEds.size());
for(int i=0; i < allEds.size(); i++){
string[i] = allEds.get(i).getText().toString();
}
NOTE:
This is not results your design there may be some changes.but follow these procedure to get exact results. I think you must you use two for loops to get your edittexts in a gridview.