How To Solve Editext in More Numbers in a Layout And Get Values From That?

后端 未结 3 1171
名媛妹妹
名媛妹妹 2021-01-22 17:17

See this picture:

I am designing a sudoku in android, have done the layout like this, so 81 Editext is there. I

3条回答
  •  终归单人心
    2021-01-22 17:57

    I would suggest you to use array of Edittext's like this

    EditText text1,text2,text3,text4,text5,text6,text7,text8,text9, text21,text22,text23,text24....text 99;
    EditText[] fields={text1,text2,text3,text4,text5,text6,text7,text8,text9, text21,text22,text23,text24....text 99};
    //Give your edittext ids in ids array like this
    int ids[]={R.id.text1,R.id.text2,R.id.text3.....R.id,text99};
    int values[9][9]={};
    
    for(int i=0;i

    To get values use the same way take an array and save those values in array like this. use for loop and get the values from the textfields and save it in the 2d array as i have declared in values array. I suppose you know how to code the rest of the thing you really want to know please comment, I'll post the rest.thank u.. I hope this will help you.

提交回复
热议问题