diff --git a/Soft1614080902301/app/src/main/java/edu/androidlabs/hzuapps/tk/Main2Activity.java b/Soft1614080902301/app/src/main/java/edu/androidlabs/hzuapps/tk/Main2Activity.java
index 413960d4a..ffbcca579 100644
--- a/Soft1614080902301/app/src/main/java/edu/androidlabs/hzuapps/tk/Main2Activity.java
+++ b/Soft1614080902301/app/src/main/java/edu/androidlabs/hzuapps/tk/Main2Activity.java
@@ -1,13 +1,101 @@
package edu.androidlabs.hzuapps.tk;
+import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.Toast;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
public class Main2Activity extends AppCompatActivity {
+ private Button mButtonSave;
+ private Button mButtonDisplay;
+ private EditText mEditTextContent;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main2);
+ mEditTextContent = (EditText) findViewById(R.id.editText2);
+ mButtonSave = (Button) findViewById(R.id.button3);
+ mButtonSave.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+
+ //向内部存储写入数据
+ saveContent();
+ Toast.makeText(Main2Activity.this, "saved!", Toast.LENGTH_SHORT).show();
+
+ }
+ });
+ }
+
+ private String getContent() {
+ String s = null;
+ FileInputStream fis = null;
+ try {
+ //通过该方法从内部存储中的edit_data.txt文件中读取数据
+ fis = this.openFileInput("edit_data.txt");
+ int len = 0;
+ byte[] buf = new byte[1024];
+ while ((len = fis.read(buf)) != -1) {
+ s = new String(buf, 0, len, "UTF-8");
+
+ }
+
+
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ if (fis != null) {
+ try {
+ fis.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ return s;
+ }
+
+ //写入数据
+ private void saveContent() {
+ FileOutputStream fos = null;
+ String content = mEditTextContent.getText().toString();
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main2);
+ try {
+
+
+ //通过该方法向内部存储中写入数据,文件名为edit_data.txt,模式为MODE_PRIVATE,表示该文件操作权限为文本应用,另一个常用的权限MODE_APPEND表示在文件末尾添加内容
+ fos = this.openFileOutput("edit_data.txt", MODE_PRIVATE);
+ fos.write(content.getBytes());
+ fos.flush();
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ if (fos != null) {
+ try {
+ fos.close();
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ }
+ }
+
+ }
}
-}
+
+
+
diff --git a/Soft1614080902301/app/src/main/res/layout/activity_main.xml b/Soft1614080902301/app/src/main/res/layout/activity_main.xml
index 4525432c6..932db57ed 100644
--- a/Soft1614080902301/app/src/main/res/layout/activity_main.xml
+++ b/Soft1614080902301/app/src/main/res/layout/activity_main.xml
@@ -7,21 +7,12 @@
tools:context=".MainActivity"
tools:layout_editor_absoluteY="81dp">
-
-
@@ -29,12 +20,19 @@
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginBottom="126dp"
- android:layout_marginTop="126dp"
+ android:layout_marginTop="66dp"
android:text="下载图片"
- app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="@+id/button" />
+ app:layout_constraintTop_toBottomOf="@+id/button" />
+
+
\ No newline at end of file
diff --git a/Soft1614080902301/app/src/main/res/layout/activity_main2.xml b/Soft1614080902301/app/src/main/res/layout/activity_main2.xml
index b52f777fc..796489df3 100644
--- a/Soft1614080902301/app/src/main/res/layout/activity_main2.xml
+++ b/Soft1614080902301/app/src/main/res/layout/activity_main2.xml
@@ -6,4 +6,27 @@
android:layout_height="match_parent"
tools:context=".Main2Activity">
+
+
+
+
\ No newline at end of file
diff --git a/Soft1614080902301/app/src/main/res/layout/activity_main3.xml b/Soft1614080902301/app/src/main/res/layout/activity_main3.xml
index 0f2a16a72..a7506f162 100644
--- a/Soft1614080902301/app/src/main/res/layout/activity_main3.xml
+++ b/Soft1614080902301/app/src/main/res/layout/activity_main3.xml
@@ -6,4 +6,24 @@
android:layout_height="match_parent"
tools:context=".Main3Activity">
+
+
+
\ No newline at end of file
diff --git "a/Soft1614080902301/\345\256\236\351\252\214\344\272\224.md" "b/Soft1614080902301/\345\256\236\351\252\214\344\272\224.md"
new file mode 100644
index 000000000..b921dd4e9
--- /dev/null
+++ "b/Soft1614080902301/\345\256\236\351\252\214\344\272\224.md"
@@ -0,0 +1,30 @@
++# �����ʵ��
+ +
+ +## 1.ʵ��Ŀ��
+ +
+ + ������Android App�д洢����
+ +
+ +## 2.ʵ������
+ +
+ + ��1����Ӧ�ò��������ݱ��浽�ļ��洢��
+ + ��2��˵��ʹ�õ��ļ��洢��ʽ
+ + ��3�������н����ͼ
+ +
+ +## 3.ʵ�鲽��
+ +
+ +��1����activity_main2�½�һ��������ť��
+ +
+ +��2����activity_main2�����½�һ��EditTextviw�����������֣������Լ���Ҫ�鿴��ͼƬ��(eg:��Ů)
+ +
+ +��3����activity_main2��д�������ݵ��ڲ��洢�ռ�Ĵ���
+ +
+ +��4����������
+ +
+ +��5��git push �ύ
+ +
+ +## 4.ʵ����
+
+
+ +## 5.ʵ�����
+ +
+ +���ʵ���������˵�Ƚ��ѣ�����Java�Ƚϱ������Ը��ӵĴ�������IJ�������ͨ��ѯ�����ѺͰٶ����������ʵ�飬��ʵ���ס�
\ No newline at end of file
diff --git "a/Soft1614080902301/\345\256\236\351\252\214\344\272\2241.jpg" "b/Soft1614080902301/\345\256\236\351\252\214\344\272\2241.jpg"
new file mode 100644
index 000000000..a848fdade
Binary files /dev/null and "b/Soft1614080902301/\345\256\236\351\252\214\344\272\2241.jpg" differ
diff --git "a/Soft1614080902301/\345\256\236\351\252\214\344\272\2242.jpg" "b/Soft1614080902301/\345\256\236\351\252\214\344\272\2242.jpg"
new file mode 100644
index 000000000..67f1b31a6
Binary files /dev/null and "b/Soft1614080902301/\345\256\236\351\252\214\344\272\2242.jpg" differ
diff --git "a/Soft1614080902301/\345\256\236\351\252\214\344\272\2243 .jpg" "b/Soft1614080902301/\345\256\236\351\252\214\344\272\2243 .jpg"
new file mode 100644
index 000000000..6a8f22e10
Binary files /dev/null and "b/Soft1614080902301/\345\256\236\351\252\214\344\272\2243 .jpg" differ