Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
Update Report_6.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ZYL618 authored Nov 28, 2020
1 parent 4072a2b commit f3eea38
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions students/net1814080903225/Report_6.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
# 一、实验目标 #

1. 掌握Android网络访问方法;

# 二、实验内容 #

1. 创建一个表示数据的XML或JSON文件;
2. 数据文件代码提交之后从GitHub获取文件URL;
3. 在应用中通过网络编程访问GitHub的数据文件;
4. 在应用中解析并显示文件所包含的数据;
5. 将应用运行结果截图。

# 三、实验步骤 #

1. 创建HttpClientActivity用于测试网络编程

2. 通过```getGitHubIssues()```方法来获取网络文件URL并建立链接

3. 通过```BufferedReader reader```进行文件读取

```java
private String getGitHubIssues() {
String gitApi = "https://api.github.com/repos/hzuapps/android-labs-2020/issues";
Expand Down Expand Up @@ -51,11 +45,8 @@
return jsonText;
}
```

完成操作后需要断开连接

4. 将指定URL内容在控制台中打印

```java
public void run() {
textView = findViewById(R.id.text1);
Expand All @@ -79,17 +70,10 @@
}
}
```



# 四、实验结果 #

![result1](https://raw.githubusercontent.com/ZYL618/android-labs-2020/master/students/net1814080903225/lab_6/result_1.png)

![result2](https://raw.githubusercontent.com/ZYL618/android-labs-2020/master/students/net1814080903225/lab_6/result_2.png)

![result3](https://raw.githubusercontent.com/ZYL618/android-labs-2020/master/students/net1814080903225/lab_6/result_3.png)

# 五、实验心得 #

本次实验网络编程,即通过相关API获取网络上的数据,此部分不属于我的项目范围之内,因此只是跟着老师给的例子进行了一些练习和理解,若要真正融汇贯通可能课下还需要花些功夫。

0 comments on commit f3eea38

Please sign in to comment.