diff --git a/app/app.iml b/app/app.iml
index fca0cd4..1cf2341 100644
--- a/app/app.iml
+++ b/app/app.iml
@@ -103,6 +103,7 @@
+
diff --git a/app/src/main/java/com/example/PersonalCenter/SearchServiceGet.java b/app/src/main/java/com/example/PersonalCenter/SearchServiceGet.java
index 4f0dd95..18cc3f3 100644
--- a/app/src/main/java/com/example/PersonalCenter/SearchServiceGet.java
+++ b/app/src/main/java/com/example/PersonalCenter/SearchServiceGet.java
@@ -1,8 +1,11 @@
package com.example.PersonalCenter;
import android.util.Log;
-import net.sf.json.JSONArray;
-import net.sf.json.JSONObject;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
@@ -26,7 +29,7 @@ public class SearchServiceGet {
String address="/rest/cmkg/question/hello";
- String Url = "http://114.116.199.154:5000"+address;
+ String Url = "http://114.116.199.154:5000/cmkg"+address;
String path = Url + "?name="+name;
URL url = null;
try {
@@ -50,19 +53,53 @@ public class SearchServiceGet {
System.out.println(response.toString());
//开始解析返回的数据
- JSONObject jo=JSONObject.fromObject(response.toString());
- code=jo.getInt("code");
- System.out.println("code==@@@@@@@@@@20"+code);
+// JSONObject jo=JSONObject.fromObject(response.toString());
+ org.json.JSONObject jo = null;
+ try {
+ jo = new org.json.JSONObject(response.toString());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ try {
+ code=jo.getInt("code");
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ System.out.println("code="+code);
if(code!=0){ //查询成功,在开始解析数据
System.out.println("code==@@@@@@@@@@20"+code);
- name_back=jo.getString("message");//查询的主语
+ try {
+ name_back=jo.getString("message");//查询的主语
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
//把data看作一个JSONObject,无论里面由多少元素,都转换为JSONArray,存在数组里
- JSONObject jo_data=jo.getJSONObject("data");
- JSONArray data_arr=null;
- jo_data.toJSONArray(data_arr);
+ JSONObject jo_data= null;
+
+ try {
+ jo_data = jo.getJSONObject("data");
+ if(jo_data==null) System.out.println(("jo_data==null"));
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ JSONArray data_arr=new JSONArray();
+ ArrayList datas=new ArrayList();
+ try {
+
+// jo_data.toJSONArray(data_arr);
+ datas.add(jo_data.toString());
+ data_arr=jo.getJSONArray("data");
+ System.out.println("data_arr======"+data_arr.length());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
//遍历data_arr,把里面的数据放入ArrayList content里
- for(int i=0;i> lists=new LinkedList<>();
+ Integer[] new_color;
if(SearchServiceGet.code==DiseaseToSymptom){
/**
* //返回的是病症
* 标题就是病的名字,内容就是病症。lists就是病名,list就是病症
*/
+ System.out.println("size="+SearchServiceGet.content.size());
for(int i=0;i list=new LinkedList<>();
list.add(new ContentData(SearchServiceGet.content.get(i)));
lists.add(list);
}
-
+ new_color=new Integer[1];
}else if(SearchServiceGet.code==DiseaseToMedicines){
/**
* //返回的是结解决的多种药品方法
@@ -73,10 +84,10 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
*/
List list=new LinkedList<>();
for(int i=0;i