android studio版本:2023.3.1 patch2
例程:filesaveandread
其实我写这个都是我记录我要做后个数独小游戏,每一个都是为了解决一个问题。即是分享也是备忘,反正我什么都不会,就是一顿瞎改,不行就研究。这个应用场景三就是我这个小游戏的一部分。先看图:
我本来要实现的功能是:退出的时候自动保存退出时玩的状态,再打开的时候自动读取,这样就不会丢失上次玩的进度。 上图的读取和写入,本来是别的功能,现在临时做为读写功能。
这个游戏除了按钮外一共有90个textview,上面的81个为显示和解答数独题目用的,下面蓝色的9个数字为填写用的。这里仅仅是为了演示读写功能,所以很多功能没有写进来,不能解题也不能填写数字,textview的text都是事先设置好的。
关键代码就是读的部分:
private void readFileAndSplit(){
File file =new File(getFilesDir(),"10000.txt");//这个必须单独写,不能直接写到try里面,不知道为啥。
try(BufferedReader reader=new BufferedReader(new FileReader(file))){
String line=reader.readLine();//读取行
String[] parts=line.split(",");//split按照“,”分割,并写进part1数组
int b=0;//计数,为了同步设置textviews里面81个textview.
for(String a :parts){
textViews[b].setText(a);//同步修改相应位置textview的text.
b+=1;//计数加1
}
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
}
这部分代码没使用filehelper.java代码,那个代码好像实现不了,反正我不会,但"写"还是用了那个代码。
题外:其实在这个游戏里面,解题的时候原来的数字是不能修改的,只有空白的地方才可以修改。但上面parts数组除了数字以外的地方本来应该是空值,我想的是,parts数组本来就是string,所以解析出来肯定是个空值嘛(“”),实际不是,即不是空值也不是null,更不是数字。
写入文件的的数据是这样:
但解析完成赋值给textview的text后,这个值非空,在游戏的逻辑里面就无法编辑,游戏就没法玩了。所以我在实际的游戏的代码里是这样的。
try{
int num=Integer.parseInt(a);
textViews[b].setText(a);
b+=1;
} catch (NumberFormatException e) {
textViews[b].setText("");
b+=1;
}
我把parts里面的值解析出来后,把它转成整形数值,那个所谓的空值会出错,利用这个错误把空白的地方的text强制赋值空字符串(“”),在游戏里就正常了。
所以:字符串数组里面的“空值”,即不是"",也不是null,到底是啥?有懂的大婶麻烦指明。谢谢!
经过一天的学习,根据原因虽然还不知道,但找到了解决办法。在游戏里有一个需要判断两个textview的text是否相同的情况,之前使用的是textview1.gettext()==textview2.gettext()来判断,即使text相同,比较结果也是false。简单说原因是==比较的是地址,所以改成textview1.gettext().tostring().equals(textview2.gettext().tostring())就没问题了。equals()比较的是值 。
下面是代码,里面有很多没用的代码,而且这是个未完工的游戏,仅供参考。屎山代码,大婶勿喷。
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:id="@+id/textView"
android:layout_width="405dp"
android:layout_height="405dp"
android:layout_marginTop="100dp"
android:background="#CDE3ED"
android:text=""
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView11"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="110dp"
android:background="#FFff3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView12"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="110dp"
android:background="#FFff3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:autoSizeTextType="none"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView11"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView13"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="3dp"
android:layout_marginTop="110dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:autoSizeTextType="none"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.02"
app:layout_constraintStart_toEndOf="@+id/textView12"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView14"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="11dp"
android:layout_marginTop="110dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView13"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView15"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginTop="110dp"
android:layout_marginStart="8dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:autoSizeTextType="none"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView14"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView16"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="110dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:autoSizeTextType="none"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView15"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView17"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="11dp"
android:layout_marginTop="110dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView16"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView18"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="110dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:autoSizeTextType="none"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView17"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView19"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="110dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:autoSizeTextType="none"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView18"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView21"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="153dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView22"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="153dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView21"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView23"
android:layout_width="35dp"
android:layout_height="35dp"
android:text="3"
android:layout_marginStart="8dp"
android:layout_marginTop="153dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView22"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView24"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="11dp"
android:layout_marginTop="153dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView23"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView25"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="153dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView24"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView26"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="153dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView25"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView27"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="11dp"
android:layout_marginTop="153dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView26"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView28"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="153dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView27"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView29"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="153dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView28"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView31"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="197dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView32"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="197dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView31"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView33"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="197dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView32"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView34"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="11dp"
android:layout_marginTop="197dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView33"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView35"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="197dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView34"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView36"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="197dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView35"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView37"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="11dp"
android:layout_marginTop="197dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView36"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView38"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="197dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView37"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView39"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="197dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView38"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView41"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="244dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView42"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="244dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView41"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView43"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="244dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView42"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView44"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="11dp"
android:layout_marginTop="244dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView43"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView45"
android:layout_width="35dp"
android:layout_height="35dp"
android:text="5"
android:layout_marginStart="8dp"
android:layout_marginTop="244dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView44"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView46"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="244dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView45"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView47"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="11dp"
android:layout_marginTop="244dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView46"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView48"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="244dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView47"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView49"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="244dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView48"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView51"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="287dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView52"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="287dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView51"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView53"
android:layout_width="35dp"
android:layout_height="35dp"
android:text="9"
android:layout_marginStart="8dp"
android:layout_marginTop="287dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView52"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView54"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="11dp"
android:layout_marginTop="287dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView53"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView55"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="287dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView54"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView56"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="287dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView55"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView57"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="11dp"
android:layout_marginTop="287dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView56"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView58"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="287dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView57"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView59"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="287dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView58"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView61"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="330dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView62"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="330dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView61"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView63"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="330dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView62"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView64"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="11dp"
android:layout_marginTop="330dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView63"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView65"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="330dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView64"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView66"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="330dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView65"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView67"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="11dp"
android:layout_marginTop="330dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView66"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView68"
android:layout_width="35dp"
android:layout_height="35dp"
android:text="6"
android:layout_marginStart="8dp"
android:layout_marginTop="330dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView67"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView69"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="330dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView68"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView71"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="377dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView72"
android:layout_width="35dp"
android:layout_height="35dp"
android:text="9"
android:layout_marginStart="8dp"
android:layout_marginTop="377dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView71"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView73"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="377dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView72"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView74"
android:layout_width="35dp"
android:layout_height="35dp"
android:text="8"
android:layout_marginStart="11dp"
android:layout_marginTop="377dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView73"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView75"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="377dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView74"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView76"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="377dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView75"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView77"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="11dp"
android:layout_marginTop="377dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView76"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView78"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="377dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView77"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView79"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="377dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView78"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView81"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="420dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView82"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="420dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView81"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView83"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="420dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView82"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView84"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="11dp"
android:layout_marginTop="420dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView83"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView85"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="420dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView84"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView86"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="420dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView85"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView87"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="11dp"
android:layout_marginTop="420dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView86"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView88"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="420dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView87"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView89"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="420dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView88"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView91"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="463dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView92"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="463dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView91"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView93"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="463dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView92"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView94"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="11dp"
android:layout_marginTop="463dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView93"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView95"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="463dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView94"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView96"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="463dp"
android:background="#FFFF3B"
android:gravity="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView95"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView97"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="11dp"
android:layout_marginTop="463dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView96"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView98"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="463dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView97"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView99"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="463dp"
android:background="#FFFF3B"
android:gravity="center"
android:textAlignment="center"
android:textSize="25sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView98"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView1"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="520dp"
android:background="#03A9F4"
android:gravity="center"
android:text="1"
android:textAlignment="center"
android:textSize="25sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView2"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="520dp"
android:background="#03A9F4"
android:gravity="center"
android:text="2"
android:textAlignment="center"
android:textSize="25sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView1"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView3"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="520dp"
android:background="#03A9F4"
android:gravity="center"
android:text="3"
android:textAlignment="center"
android:textSize="25sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView2"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView4"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="11dp"
android:layout_marginTop="520dp"
android:background="#03A9F4"
android:gravity="center"
android:text="4"
android:textAlignment="center"
android:textSize="25sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView3"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView5"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="520dp"
android:background="#03A9F4"
android:gravity="center"
android:text="5"
android:textAlignment="center"
android:textSize="25sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView4"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView6"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="520dp"
android:background="#03A9F4"
android:gravity="center"
android:text="6"
android:textAlignment="center"
android:textSize="25sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView5"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView7"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="11dp"
android:layout_marginTop="520dp"
android:background="#03A9F4"
android:gravity="center"
android:text="7"
android:textAlignment="center"
android:textSize="25sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView6"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView8"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="520dp"
android:background="#03A9F4"
android:gravity="center"
android:text="8"
android:textAlignment="center"
android:textSize="25sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView7"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView9"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginStart="8dp"
android:layout_marginTop="520dp"
android:background="#03A9F4"
android:gravity="center"
android:text="9"
android:textAlignment="center"
android:textSize="25sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/textView8"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/textView100"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="20dp"
android:text="编辑完成"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView1" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="5dp"
android:text="重新编辑"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button1" />
<Button
android:id="@+id/button6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="20dp"
android:text="读取"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/button3"
app:layout_constraintTop_toBottomOf="@+id/textView7" />
<Button
android:id="@+id/button4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="5dp"
android:text="重 玩"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/button2"
app:layout_constraintTop_toBottomOf="@+id/button1" />
<Button
android:id="@+id/button5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="72dp"
android:text="写入"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/button3"
app:layout_constraintTop_toBottomOf="@+id/textView7" />
<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="20dp"
android:text="清 空"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/button1"
app:layout_constraintTop_toBottomOf="@+id/textView7" />
<View
android:id="@+id/view"
android:layout_width="2dp"
android:layout_height="405dp"
android:layout_marginStart="2dp"
android:layout_marginTop="102dp"
android:background="#000000"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/view1"
android:layout_width="2dp"
android:layout_height="405dp"
android:layout_marginStart="400dp"
android:layout_marginTop="102dp"
android:background="#000000"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/view2"
android:layout_width="2dp"
android:layout_height="405dp"
android:layout_marginStart="134dp"
android:layout_marginTop="102dp"
android:background="#000000"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/view14"
android:layout_width="1dp"
android:layout_height="405dp"
android:layout_marginStart="46dp"
android:layout_marginTop="102dp"
android:background="#000000"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/view15"
android:layout_width="1dp"
android:layout_height="405dp"
android:layout_marginStart="89dp"
android:layout_marginTop="102dp"
android:background="#000000"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/view16"
android:layout_width="1dp"
android:layout_height="405dp"
android:layout_marginStart="179dp"
android:layout_marginTop="102dp"
android:background="#000000"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/view17"
android:layout_width="1dp"
android:layout_height="405dp"
android:layout_marginStart="222dp"
android:layout_marginTop="102dp"
android:background="#000000"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/view18"
android:layout_width="1dp"
android:layout_height="405dp"
android:layout_marginStart="311dp"
android:layout_marginTop="102dp"
android:background="#000000"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/view19"
android:layout_width="1dp"
android:layout_height="405dp"
android:layout_marginStart="354dp"
android:layout_marginTop="102dp"
android:background="#000000"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/view3"
android:layout_width="2dp"
android:layout_height="405dp"
android:layout_marginStart="266dp"
android:layout_marginTop="102dp"
android:background="#000000"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/view8"
android:layout_width="398dp"
android:layout_height="1dp"
android:layout_marginStart="2dp"
android:layout_marginTop="148dp"
android:background="#000000"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/view9"
android:layout_width="398dp"
android:layout_height="1dp"
android:layout_marginStart="2dp"
android:layout_marginTop="192dp"
android:background="#000000"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/view10"
android:layout_width="398dp"
android:layout_height="1dp"
android:layout_marginStart="2dp"
android:layout_marginTop="282dp"
android:background="#000000"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/view11"
android:layout_width="398dp"
android:layout_height="1dp"
android:layout_marginStart="2dp"
android:layout_marginTop="325dp"
android:background="#000000"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/view12"
android:layout_width="398dp"
android:layout_height="1dp"
android:layout_marginStart="2dp"
android:layout_marginTop="416dp"
android:background="#000000"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/view13"
android:layout_width="398dp"
android:layout_height="1dp"
android:layout_marginStart="2dp"
android:layout_marginTop="458dp"
android:background="#000000"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/view4"
android:layout_width="398dp"
android:layout_height="2dp"
android:layout_marginStart="3dp"
android:layout_marginTop="102dp"
android:background="#000000"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/view5"
android:layout_width="398dp"
android:layout_height="2dp"
android:layout_marginStart="2dp"
android:layout_marginTop="236dp"
android:background="#000000"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/view6"
android:layout_width="398dp"
android:layout_height="2dp"
android:layout_marginStart="2dp"
android:layout_marginTop="370dp"
android:background="#000000"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/view7"
android:layout_width="398dp"
android:layout_height="2dp"
android:layout_marginStart="2dp"
android:layout_marginTop="506dp"
android:background="#000000"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
filehelper.java
package com.shudu.filesaveandread;
import android.content.Context;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
/**
* Created by Jay on 2015/9/1 0001.
*/
public class FileHelper {
private Context mContext;
public FileHelper() {
}
public FileHelper(Context mContext) {
super();
this.mContext = mContext;
}
/*
* 这里定义的是一个文件保存的方法,写入到文件中,所以是输出流
* */
public void save(String filename, String filecontent) throws Exception {
//这里我们使用私有模式,创建出来的文件只能被本应用访问,还会覆盖原文件哦
FileOutputStream output = mContext.openFileOutput(filename, Context.MODE_PRIVATE);
output.write(filecontent.getBytes()); //将String字符串以字节流的形式写入到输出流中
output.close(); //关闭输出流
}
/*
* 这里定义的是文件读取的方法
* */
public String read(String filename) throws IOException {
//打开文件输入流
FileInputStream input = mContext.openFileInput(filename);
byte[] temp = new byte[1024];
StringBuilder sb = new StringBuilder("");
int len = 0;
//读取文件内容:
while ((len = input.read(temp)) > 0) {
sb.append(new String(temp, 0, len));
}
//关闭输入流
input.close();
return sb.toString();
}
}
mainactivity.java
package com.shudu.filesaveandread;
import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
public TextView mytextview;
private static TextView[]textViews;//81个textview
private static TextView[][]textViewshang;//9行二维数组
private static TextView[][]textViewslie;//9列二维数组
private static TextView[][]textViewsgong;//9组二维数组
private static TextView[][] textViewhangliegong;
private static TextView[] anniushuzi;//1,2,3..。10数字的数组
private static TextView[] textViewshang1,textViewshang2,textViewshang3,textViewshang4,textViewshang5,textViewshang6,textViewshang7, textViewshang8, textViewshang9;
private static TextView[]textViewslie1,textViewslie2,textViewslie3,textViewslie4,textViewslie5,textViewslie6,textViewslie7, textViewslie8, textViewslie9;
private static TextView[]textviewgonh1,textviewgonh2,textviewgonh3,textviewgonh4,textviewgonh5,textviewgonh6, textviewgonh7, textviewgonh8,textviewgonh9;
private TextView textview1,textview2,textview3,textview4,textview5,textview6,textview7,textview8,textview9;
private TextView textview11,textview12,textview13,textview14,textview15,textview16,textview17,textview18,textview19;
private TextView textview21,textview22,textview23,textview24,textview25,textview26,textview27,textview28,textview29;
private TextView textview31,textview32,textview33,textview34,textview35,textview36,textview37,textview38,textview39;
private TextView textview41,textview42,textview43,textview44,textview45,textview46,textview47,textview48,textview49;
private TextView textview51,textview52,textview53,textview54,textview55,textview56,textview57,textview58,textview59;
private TextView textview61,textview62,textview63,textview64,textview65,textview66,textview67,textview68,textview69;
private TextView textview71, textview72, textview73, textview74, textview75, textview76, textview77, textview78, textview79;
private TextView textview81, textview82, textview83, textview84, textview85, textview86, textview87, textview88, textview89;
private TextView textview91, textview92, textview93, textview94, textview95, textview96, textview97, textview98, textview99;
private Button button1,button2,button3,button4,button5,button6;
private Context mContext;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
mContext = getApplicationContext();
setContentView(R.layout.activity_main);
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
return insets;
});
mytextview = (TextView) findViewById(R.id.textView100);//作为数据交换的中间textview
textview1 = (TextView) findViewById(R.id.textView1);
textview2 = (TextView) findViewById(R.id.textView2);
textview3 = (TextView) findViewById(R.id.textView3);
textview4 = (TextView) findViewById(R.id.textView4);
textview5 = (TextView) findViewById(R.id.textView5);
textview6 = (TextView) findViewById(R.id.textView6);
textview7 = (TextView) findViewById(R.id.textView7);
textview8 = (TextView) findViewById(R.id.textView8);
textview9 = (TextView) findViewById(R.id.textView9);
textview11 = (TextView) findViewById(R.id.textView11);
textview12 = (TextView) findViewById(R.id.textView12);
textview13 = (TextView) findViewById(R.id.textView13);
textview14 = (TextView) findViewById(R.id.textView14);
textview15 = (TextView) findViewById(R.id.textView15);
textview16 = (TextView) findViewById(R.id.textView16);
textview17 = (TextView) findViewById(R.id.textView17);
textview18 = (TextView) findViewById(R.id.textView18);
textview19 = (TextView) findViewById(R.id.textView19);
textview21 = (TextView) findViewById(R.id.textView21);
textview22 = (TextView) findViewById(R.id.textView22);
textview23 = (TextView) findViewById(R.id.textView23);
textview24 = (TextView) findViewById(R.id.textView24);
textview25 = (TextView) findViewById(R.id.textView25);
textview26 = (TextView) findViewById(R.id.textView26);
textview27 = (TextView) findViewById(R.id.textView27);
textview28 = (TextView) findViewById(R.id.textView28);
textview29 = (TextView) findViewById(R.id.textView29);
textview31 = (TextView) findViewById(R.id.textView31);
textview32 = (TextView) findViewById(R.id.textView32);
textview33 = (TextView) findViewById(R.id.textView33);
textview34 = (TextView) findViewById(R.id.textView34);
textview35 = (TextView) findViewById(R.id.textView35);
textview36 = (TextView) findViewById(R.id.textView36);
textview37 = (TextView) findViewById(R.id.textView37);
textview38 = (TextView) findViewById(R.id.textView38);
textview39 = (TextView) findViewById(R.id.textView39);
textview41 = (TextView) findViewById(R.id.textView41);
textview42 = (TextView) findViewById(R.id.textView42);
textview43 = (TextView) findViewById(R.id.textView43);
textview44 = (TextView) findViewById(R.id.textView44);
textview45 = (TextView) findViewById(R.id.textView45);
textview46 = (TextView) findViewById(R.id.textView46);
textview47 = (TextView) findViewById(R.id.textView47);
textview48 = (TextView) findViewById(R.id.textView48);
textview49 = (TextView) findViewById(R.id.textView49);
textview51 = (TextView) findViewById(R.id.textView51);
textview52 = (TextView) findViewById(R.id.textView52);
textview53 = (TextView) findViewById(R.id.textView53);
textview54 = (TextView) findViewById(R.id.textView54);
textview55 = (TextView) findViewById(R.id.textView55);
textview56 = (TextView) findViewById(R.id.textView56);
textview57 = (TextView) findViewById(R.id.textView57);
textview58 = (TextView) findViewById(R.id.textView58);
textview59 = (TextView) findViewById(R.id.textView59);
textview61 = (TextView) findViewById(R.id.textView61);
textview62 = (TextView) findViewById(R.id.textView62);
textview63 = (TextView) findViewById(R.id.textView63);
textview64 = (TextView) findViewById(R.id.textView64);
textview65 = (TextView) findViewById(R.id.textView65);
textview66 = (TextView) findViewById(R.id.textView66);
textview67 = (TextView) findViewById(R.id.textView67);
textview68 = (TextView) findViewById(R.id.textView68);
textview69 = (TextView) findViewById(R.id.textView69);
textview71 = (TextView) findViewById(R.id.textView71);
textview72 = (TextView) findViewById(R.id.textView72);
textview73 = (TextView) findViewById(R.id.textView73);
textview74 = (TextView) findViewById(R.id.textView74);
textview75 = (TextView) findViewById(R.id.textView75);
textview76 = (TextView) findViewById(R.id.textView76);
textview77 = (TextView) findViewById(R.id.textView77);
textview78 = (TextView) findViewById(R.id.textView78);
textview79 = (TextView) findViewById(R.id.textView79);
textview81 = (TextView) findViewById(R.id.textView81);
textview82 = (TextView) findViewById(R.id.textView82);
textview83 = (TextView) findViewById(R.id.textView83);
textview84 = (TextView) findViewById(R.id.textView84);
textview85 = (TextView) findViewById(R.id.textView85);
textview86 = (TextView) findViewById(R.id.textView86);
textview87 = (TextView) findViewById(R.id.textView87);
textview88 = (TextView) findViewById(R.id.textView88);
textview89 = (TextView) findViewById(R.id.textView89);
textview91 = (TextView) findViewById(R.id.textView91);
textview92 = (TextView) findViewById(R.id.textView92);
textview93 = (TextView) findViewById(R.id.textView93);
textview94 = (TextView) findViewById(R.id.textView94);
textview95 = (TextView) findViewById(R.id.textView95);
textview96 = (TextView) findViewById(R.id.textView96);
textview97 = (TextView) findViewById(R.id.textView97);
textview98 = (TextView) findViewById(R.id.textView98);
textview99 = (TextView) findViewById(R.id.textView99);
//81个位置
textViews = new TextView[]{
textview11,textview12,textview13,textview14,textview15,textview16,textview17,textview18,textview19,
textview21,textview22,textview23,textview24,textview25,textview26,textview27,textview28,textview29,
textview31,textview32,textview33,textview34,textview35,textview36,textview37,textview38,textview39,
textview41,textview42,textview43,textview44,textview45,textview46,textview47,textview48,textview49,
textview51,textview52,textview53,textview54,textview55,textview56,textview57,textview58,textview59,
textview61,textview62,textview63,textview64,textview65,textview66,textview67,textview68,textview69,
textview71,textview72,textview73,textview74,textview75,textview76,textview77,textview78,textview79,
textview81,textview82,textview83,textview84,textview85,textview86,textview87,textview88,textview89,
textview91,textview92,textview93,textview94,textview95,textview96,textview97,textview98,textview99
};
//行
textViewshang1 = new TextView[]{textview11,textview12,textview13,textview14,textview15,textview16,textview17,textview18,textview19};
textViewshang2 = new TextView[]{textview21,textview22,textview23,textview24,textview25,textview26,textview27,textview28,textview29};
textViewshang3 = new TextView[]{textview31,textview32,textview33,textview34,textview35,textview36,textview37,textview38,textview39};
textViewshang4 = new TextView[]{textview41,textview42,textview43,textview44,textview45,textview46,textview47,textview48,textview49};
textViewshang5 = new TextView[]{textview51,textview52,textview53,textview54,textview55,textview56,textview57,textview58,textview59};
textViewshang6 = new TextView[]{textview61,textview62,textview63,textview64,textview65,textview66,textview67,textview68,textview69};
textViewshang7 = new TextView[]{textview71,textview72,textview73,textview74,textview75,textview76,textview77,textview78,textview79};
textViewshang8 = new TextView[]{textview81,textview82,textview83,textview84,textview85,textview86,textview87,textview88,textview89};
textViewshang9 = new TextView[]{textview91,textview92,textview93,textview94,textview95,textview96,textview97,textview98,textview99};
//列
textViewslie1 = new TextView[]{textview11,textview21,textview31,textview41,textview51,textview61,textview71,textview81,textview91};
textViewslie2 = new TextView[]{textview12,textview22,textview32,textview42,textview52,textview62,textview72,textview82,textview92};
textViewslie3 = new TextView[]{textview13,textview23,textview33,textview43,textview53,textview63,textview73,textview83,textview93};
textViewslie4 = new TextView[]{textview14,textview24,textview34,textview44,textview54,textview64,textview74,textview84,textview94};
textViewslie5 = new TextView[]{textview15,textview25,textview35,textview45,textview55,textview65,textview75,textview85,textview95};
textViewslie6 = new TextView[]{textview16,textview26,textview36,textview46,textview56,textview66,textview76,textview86,textview96};
textViewslie7 = new TextView[]{textview17,textview27,textview37,textview47,textview57,textview67,textview77,textview87,textview97};
textViewslie8 = new TextView[]{textview18,textview28,textview38,textview48,textview58,textview68,textview78,textview88,textview98};
textViewslie9 = new TextView[]{textview19,textview29,textview39,textview49,textview59,textview69,textview79,textview89,textview99};
//宫
textviewgonh1 = new TextView[]{textview11,textview12,textview13,textview21,textview22,textview23,textview31,textview32,textview33};
textviewgonh2 = new TextView[]{textview14,textview15,textview16,textview24,textview25,textview26,textview34,textview35,textview36};
textviewgonh3 = new TextView[]{textview17,textview18,textview19,textview27,textview28,textview29,textview37,textview38,textview39};
textviewgonh4 = new TextView[]{textview41,textview42,textview43,textview51,textview52,textview53,textview61,textview62,textview63};
textviewgonh5 = new TextView[]{textview44,textview45,textview46,textview54,textview55,textview56,textview64,textview65,textview66};
textviewgonh6 = new TextView[]{textview47,textview47,textview49,textview57,textview58,textview59,textview67,textview68,textview69};
textviewgonh7 = new TextView[]{textview71,textview72,textview73,textview81,textview82,textview83,textview91,textview92,textview93};
textviewgonh8 = new TextView[]{textview74,textview75,textview76,textview84,textview85,textview86,textview94,textview95,textview96};
textviewgonh9 = new TextView[]{textview77,textview78,textview79,textview87,textview88,textview89,textview97,textview98,textview99};
textViewshang=new TextView[][]{textViewshang1,textViewshang2,textViewshang3,textViewshang4,textViewshang5,textViewshang6,textViewshang7,textViewshang8,textViewshang9};
textViewslie=new TextView[][]{textViewslie1,textViewslie2,textViewslie3,textViewslie4,textViewslie5,textViewslie6,textViewslie7,textViewslie8,textViewslie9};
textViewsgong=new TextView[][]{textviewgonh1,textviewgonh2,textviewgonh3,textviewgonh4,textviewgonh5,textviewgonh6,textviewgonh7,textviewgonh8,textviewgonh9};
textViewhangliegong=new TextView[][]{
textViewshang1,textViewshang2,textViewshang3,textViewshang4,textViewshang5,textViewshang6,textViewshang7,textViewshang8,textViewshang9,
textViewslie1,textViewslie2,textViewslie3,textViewslie4,textViewslie5,textViewslie6,textViewslie7,textViewslie8,textViewslie9,
textviewgonh1,textviewgonh2,textviewgonh3,textviewgonh4,textviewgonh5,textviewgonh6,textviewgonh7,textviewgonh8,textviewgonh9
};
anniushuzi=new TextView[]{textview1,textview2,textview3,textview4,textview5,textview6,textview7,textview8,textview9};
button1 = (Button) findViewById(R.id.button1);
button2 = (Button) findViewById(R.id.button2);
button3 = (Button) findViewById(R.id.button3);
button4 = (Button) findViewById(R.id.button4);
button5 = (Button) findViewById(R.id.button5);
button6 = (Button) findViewById(R.id.button6);
button1.setOnClickListener(this);
button2.setOnClickListener(this);
button3.setOnClickListener(this);
button4.setOnClickListener(this);
button5.setOnClickListener(this);
button6.setOnClickListener(this);
}
public void onClick(View view) {
switch (view.getId()){
case R.id.button1://编辑完成
for (TextView textView : textViews) {
if(textView.getText().toString()==""){
textView.setTextColor(Color.RED);
// settextviewcolor();
}
}
break;
case R.id.button2://重新编辑
for (TextView textView : textViews) {
//如果text为空或字体为红色清除text并将text设置为黑色
if(textView.getText().toString()=="" ||textView.getCurrentTextColor()==0xffff0000) {
textView.setText("");
textView.setTextColor(Color.BLACK);
// settextviewcolor();
}
}
break;
case R.id.button3://清空
for (TextView textView : textViews) {
textView.setText("");//清空text
textView.setTextColor(Color.BLACK);//设置text为黑色
textView.setBackgroundColor(Color.YELLOW);
// settextviewcolor();
}
break;
case R.id.button4://重玩
for (TextView textView : textViews) {
if(textView.getCurrentTextColor()==0xffff0000) {//只设置text为红色的text为空
textView.setText("");
// settextviewcolor();
}
}
break;
case R.id.button5://随机题目
save();
break;
case R.id.button6://清除
readFileAndSplit();
// mytextview.setText("");
// for (TextView textView : textViews) {
// textView.setBackgroundColor(Color.YELLOW);
// }
break;
}
}
@Override
public void onPointerCaptureChanged(boolean hasCapture) {
super.onPointerCaptureChanged(hasCapture);
}
public void save(){
StringBuilder stringBuilder=new StringBuilder();
FileHelper fHelper = new FileHelper(mContext);
for (TextView textView:textViews ){
String strings =textView.getText().toString();
stringBuilder.append(strings).append(",");
}
try {
String filename = "10000.txt";
fHelper.save(filename, stringBuilder.toString());
//System.out.println("文件名为:"+filename);
Toast.makeText(getApplicationContext(), "数据写入成功", Toast.LENGTH_SHORT).show();
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(getApplicationContext(), "数据写入失败", Toast.LENGTH_SHORT).show();
}
}
private void readFileAndSplit(){
File file =new File(getFilesDir(),"10000.txt");//这个必须单独写,不能直接写到try里面,不知道为啥。
try(BufferedReader reader=new BufferedReader(new FileReader(file))){
String line=reader.readLine();//读取行
String[] parts=line.split(",");//split按照“,”分割,并写进part1数组
int b=0;//计数,为了同步设置textviews里面81个textview.
for(String a :parts){
textViews[b].setText(a);//同步修改相应位置textview的text.
b+=1;//计数加1
}
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}