如何解决Editext在更多的数字在布局和获取值从? [英] How To Solve Editext in More Numbers in a Layout And Get Values From That?

查看:75
本文介绍了如何解决Editext在更多的数字在布局和获取值从?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看到这张照片:

我设计的android的数独,已经完成了布局这样的,所以81 Editext是存在的。我想在Editext所有的值,因此其难度声明和奶源81次点击的活动。您能否给我建议的方法是有效的处理我的问题?

I am designing a sudoku in android, have done the layout like this, so 81 Editext is there. I want to get all the values in the Editext so its difficult to declare and mange 81 views in activity. Can you suggest me a method which is effective for processing my problem?

推荐答案

我会建议你使用EDITTEXT的像这样的阵列

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<fiends.length;i++)
{
fields[i]=(EditText)findViewById(ids[i]);
}

要获取的值用同样的方式取一个数组,并保存这些值在数组中是这样的。 使用for循环,并从文本框获取值,并将其保存在二维数组中,我的价值观阵列宣布。我想你知道如何code,你真的想知道请评论事物的休息,我会发布的rest.thankü。我希望这会帮助你。

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.

这篇关于如何解决Editext在更多的数字在布局和获取值从?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆