Android教程網
  1. 首頁
  2. Android 技術
  3. Android 手機
  4. Android 系統教程
  5. Android 游戲
 Android教程網 >> Android技術 >> 關於Android編程 >> Android開發之json解析案例詳解

Android開發之json解析案例詳解

編輯:關於Android編程

在Android開發中經常會訪問網絡,然後訪問網絡的時候,往往需要返回數據,但是在返回數據的過程中,往往返回的是Json數據或者xml數據,但本節講述關於訪問網絡返回json格式的數據並進行解析,進行詳細的講解:

在代碼中已經進行了詳細的說明,下面主要粘貼代碼:並進行簡單的說明:

 

1.此主Activity包含了主要的代碼,裡面包含了解析json數據的方法,由於本例較小,所有沒有分開,原則上應該是分類的。

[java]
package com.shine.yihutuandui; 
 
import java.io.ByteArrayOutputStream; 
import java.io.IOException; 
import java.io.InputStream; 
import java.net.HttpURLConnection; 
import java.net.URL; 
import java.util.ArrayList; 
import java.util.List; 
 
import org.json.JSONArray; 
import org.json.JSONException; 
import org.json.JSONObject; 
 
import android.os.Bundle; 
import android.os.Handler; 
import android.os.Message; 
import android.app.Activity; 
import android.content.res.AssetManager; 
import android.graphics.Bitmap; 
import android.graphics.BitmapFactory; 
import android.graphics.drawable.BitmapDrawable; 
import android.graphics.drawable.Drawable; 
import android.view.Menu; 
import android.view.Window; 
import android.view.WindowManager; 
import android.widget.Button; 
import android.widget.ListView; 
 
public class MainActivity extends Activity { 
 
    private Button back; 
    private ListView main_yihutuandui_lv; 
    private String display_info; 
    private List<HospitalTuanDuiBean> listarray; 
    private LVAdapter adapter; 
 
    Handler handler = new Handler() { 
        public void handleMessage(Message msg) { 
            switch (msg.what) { 
            case 301: 
                try { 
                    listarray = getTopBeansJson(getServiceDataJson()); 
                } catch (JSONException e) { 
                    e.printStackTrace(); 
                } 
                adapter = new LVAdapter(MainActivity.this, listarray); 
                main_yihutuandui_lv.setAdapter(adapter); 
                break; 
            default: 
                break; 
            } 
 
        } 
    }; 
 
    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
        super.onCreate(savedInstanceState); 
        this.requestWindowFeature(Window.FEATURE_NO_TITLE); 
        this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
                WindowManager.LayoutParams.FLAG_FULLSCREEN); 
        setContentView(R.layout.main); 
        init(); 
 
    } 
 
    private void init() { 
        main_yihutuandui_lv = (ListView) this 
                .findViewById(R.id.main_yihutuandui_lv); 
        back=(Button) this.findViewById(R.id.main_yihutuandui_back); 
 
    } 
 
    @Override 
    public boolean onCreateOptionsMenu(Menu menu) { 
        // Inflate the menu; this adds items to the action bar if it is present.  
        getMenuInflater().inflate(R.menu.main, menu); 
        return true; 
    } 
 
    @Override 
    protected void onResume() { 
        super.onResume(); 
        new Thread(new Runnable() { 
            @Override 
            public void run() { 
                display_info = getHttpData(); 
                System.out.println(display_info.toString() 
                        + "=======獲取的信息json=============="); 
                Message msg = new Message(); 
                msg.what = 301; 
                handler.sendMessage(msg); 
            } 
        }).start(); 
    } 
    //在assert文件夾下面獲取圖片  
    public Bitmap getAssertDrawable(String name) { 
        Bitmap bmp = null; 
        AssetManager am = MainActivity.this.getAssets(); 
        try { 
            InputStream is = am.open(name); 
            bmp = BitmapFactory.decodeStream(is); 
        } catch (IOException e) { 
            e.printStackTrace(); 
        } 
        return bmp; 
    } 
 
    //訪問網絡獲取String格式數據  
    private String getHttpData() { 
        String host_url = "http://10.0.1.163/shine/json.php"; 
        System.out.println("=======================+++++++++++++:" + host_url); 
        URL url = null; 
        ByteArrayOutputStream arrayOutputStream = null; 
        try { 
            url = new URL(host_url); 
            InputStream inputStream = null; 
            arrayOutputStream = new ByteArrayOutputStream(); 
            HttpURLConnection connection = (HttpURLConnection) url 
                    .openConnection(); 
            // 設置輸入輸出流  
            connection.setDoInput(true); 
            connection.setDoOutput(true); 
            connection.setReadTimeout(2000); 
            connection.setRequestMethod("GET"); 
            int responseCode = connection.getResponseCode(); 
            if (responseCode == 200) { 
                // 獲得輸入流  
                inputStream = connection.getInputStream(); 
                int len = 0; 
                byte[] data = new byte[1024]; 
 
                while ((len = inputStream.read(data)) != -1) { 
                    arrayOutputStream.write(data, 0, len); 
                } 
                inputStream.close(); 
 
            } 
        } catch (IOException e) { 
            e.printStackTrace(); 
 
        } 
        return new String(arrayOutputStream.toByteArray()); 
    } 
 
    public JSONObject getJSONObject(String str) throws JSONException { 
        return new JSONObject(str); 
    } 
 
    //把String格式數據轉換成JSONObject類型數據  
    public JSONObject getServiceDataJson() throws JSONException { 
        String strResult = display_info; 
        return getJSONObject(strResult); 
    } 
    //返回list數據  
    public List<HospitalTuanDuiBean> getTopBeansJson( 
            JSONObject jsonObjectrequest) { 
        List<HospitalTuanDuiBean> list = new ArrayList<HospitalTuanDuiBean>(); 
        JSONArray object; 
        try { 
            object = (JSONArray) jsonObjectrequest.get("Data"); 
            for (int i = 0; i < object.length(); i++) { 
                HospitalTuanDuiBean top = new HospitalTuanDuiBean(); 
                JSONObject temp = (JSONObject) object.get(i); 
                top.setDoctorteamnamep(temp.getString("doctorteamnamep") 
                        .toString()); 
                top.setDoctorteamname(temp.getString("doctorteamname") 
                        .toString()); 
                top.setDoctorgroupnamep(temp.getString("doctorgroupnamep") 
                        .toString()); 
                top.setDoctorgroupname(temp.getString("doctorgroupname") 
                        .toString()); 
                top.setDoctormynamep(temp.getString("doctormynamep").toString()); 
                top.setDoctormyname(temp.getString("doctormyname").toString()); 
 
                top.setNurseteamnamep(temp.getString("nurseteamnamep") 
                        .toString()); 
                top.setNurseteamname(temp.getString("nurseteamname").toString()); 
                top.setNursegroupnamep(temp.getString("nursegroupnamep") 
                        .toString()); 
                top.setNursegroupname(temp.getString("nursegroupname") 
                        .toString()); 
                top.setNursemynamep(temp.getString("nursemynamep").toString()); 
                top.setNursemyname(temp.getString("nursemyname").toString()); 
 
                top.setPatientbedno(temp.getString("patientbedno").toString()); 
                top.setPatientname(temp.getString("patientname").toString()); 
                list.add(top); 
            } 
        } catch (Exception e) { 
        } 
        return list; 
    } 
 

package com.shine.yihutuandui;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.app.Activity;
import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.view.Menu;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ListView;

public class MainActivity extends Activity {

 private Button back;
 private ListView main_yihutuandui_lv;
 private String display_info;
 private List<HospitalTuanDuiBean> listarray;
 private LVAdapter adapter;

 Handler handler = new Handler() {
  public void handleMessage(Message msg) {
   switch (msg.what) {
   case 301:
    try {
     listarray = getTopBeansJson(getServiceDataJson());
    } catch (JSONException e) {
     e.printStackTrace();
    }
    adapter = new LVAdapter(MainActivity.this, listarray);
    main_yihutuandui_lv.setAdapter(adapter);
    break;
   default:
    break;
   }

  }
 };

 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  this.requestWindowFeature(Window.FEATURE_NO_TITLE);
  this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
    WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setContentView(R.layout.main);
  init();

 }

 private void init() {
  main_yihutuandui_lv = (ListView) this
    .findViewById(R.id.main_yihutuandui_lv);
  back=(Button) this.findViewById(R.id.main_yihutuandui_back);

 }

 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
  // Inflate the menu; this adds items to the action bar if it is present.
  getMenuInflater().inflate(R.menu.main, menu);
  return true;
 }

 @Override
 protected void onResume() {
  super.onResume();
  new Thread(new Runnable() {
   @Override
   public void run() {
    display_info = getHttpData();
    System.out.println(display_info.toString()
      + "=======獲取的信息json==============");
    Message msg = new Message();
    msg.what = 301;
    handler.sendMessage(msg);
   }
  }).start();
 }
 //在assert文件夾下面獲取圖片
 public Bitmap getAssertDrawable(String name) {
  Bitmap bmp = null;
  AssetManager am = MainActivity.this.getAssets();
  try {
   InputStream is = am.open(name);
   bmp = BitmapFactory.decodeStream(is);
  } catch (IOException e) {
   e.printStackTrace();
  }
  return bmp;
 }

 //訪問網絡獲取String格式數據
 private String getHttpData() {
  String host_url = "http://10.0.1.163/shine/json.php";
  System.out.println("=======================+++++++++++++:" + host_url);
  URL url = null;
  ByteArrayOutputStream arrayOutputStream = null;
  try {
   url = new URL(host_url);
   InputStream inputStream = null;
   arrayOutputStream = new ByteArrayOutputStream();
   HttpURLConnection connection = (HttpURLConnection) url
     .openConnection();
   // 設置輸入輸出流
   connection.setDoInput(true);
   connection.setDoOutput(true);
   connection.setReadTimeout(2000);
   connection.setRequestMethod("GET");
   int responseCode = connection.getResponseCode();
   if (responseCode == 200) {
    // 獲得輸入流
    inputStream = connection.getInputStream();
    int len = 0;
    byte[] data = new byte[1024];

    while ((len = inputStream.read(data)) != -1) {
     arrayOutputStream.write(data, 0, len);
    }
    inputStream.close();

   }
  } catch (IOException e) {
   e.printStackTrace();

  }
  return new String(arrayOutputStream.toByteArray());
 }

 public JSONObject getJSONObject(String str) throws JSONException {
  return new JSONObject(str);
 }

 //把String格式數據轉換成JSONObject類型數據
 public JSONObject getServiceDataJson() throws JSONException {
  String strResult = display_info;
  return getJSONObject(strResult);
 }
 //返回list數據
 public List<HospitalTuanDuiBean> getTopBeansJson(
   JSONObject jsonObjectrequest) {
  List<HospitalTuanDuiBean> list = new ArrayList<HospitalTuanDuiBean>();
  JSONArray object;
  try {
   object = (JSONArray) jsonObjectrequest.get("Data");
   for (int i = 0; i < object.length(); i++) {
    HospitalTuanDuiBean top = new HospitalTuanDuiBean();
    JSONObject temp = (JSONObject) object.get(i);
    top.setDoctorteamnamep(temp.getString("doctorteamnamep")
      .toString());
    top.setDoctorteamname(temp.getString("doctorteamname")
      .toString());
    top.setDoctorgroupnamep(temp.getString("doctorgroupnamep")
      .toString());
    top.setDoctorgroupname(temp.getString("doctorgroupname")
      .toString());
    top.setDoctormynamep(temp.getString("doctormynamep").toString());
    top.setDoctormyname(temp.getString("doctormyname").toString());

    top.setNurseteamnamep(temp.getString("nurseteamnamep")
      .toString());
    top.setNurseteamname(temp.getString("nurseteamname").toString());
    top.setNursegroupnamep(temp.getString("nursegroupnamep")
      .toString());
    top.setNursegroupname(temp.getString("nursegroupname")
      .toString());
    top.setNursemynamep(temp.getString("nursemynamep").toString());
    top.setNursemyname(temp.getString("nursemyname").toString());

    top.setPatientbedno(temp.getString("patientbedno").toString());
    top.setPatientname(temp.getString("patientname").toString());
    list.add(top);
   }
  } catch (Exception e) {
  }
  return list;
 }

}

 

2.此類是復寫baseadapter類

[java]
package com.shine.yihutuandui; 
 
 
import java.util.List; 
 
import android.app.Dialog; 
import android.content.Context; 
import android.content.Intent; 
import android.sax.StartElementListener; 
import android.view.LayoutInflater; 
import android.view.View; 
import android.view.ViewGroup; 
import android.widget.BaseAdapter; 
import android.widget.Button; 
import android.widget.ImageView; 
import android.widget.TextView; 
 
public class LVAdapter extends BaseAdapter{ 
    private LayoutInflater mInflater; 
    private List<HospitalTuanDuiBean> list; 
    private Context context; 
     
    MainActivity main; 
    public LVAdapter() { 
        super(); 
    } 
    public LVAdapter(Context context,List<HospitalTuanDuiBean> list) { 
        super(); 
        this.context=context; 
        main=new MainActivity(); 
        this.list=list; 
        mInflater = LayoutInflater.from(context); 
    } 
     
    @Override 
    public int getCount() { 
        if (list!=null) { 
            return list.size(); 
        } 
        return 0;  
    } 
 
    @Override 
    public Object getItem(int arg0) { 
        return list.get(arg0); 
    } 
 
    @Override 
    public long getItemId(int arg0) { 
        return arg0; 
    } 
 
    @Override 
    public View getView(int arg0, View arg1, ViewGroup arg2) { 
        Hooker hooker; 
        if (arg1 == null) { 
            arg1 = mInflater.inflate(R.layout.listviewitem, null); 
            hooker = new Hooker(); 
            //主任教授  
            hooker.main_zhurenjiaoshou_pic=(ImageView) arg1.findViewById(R.id.main_zhurenjiaoshou_picture); 
            hooker.main_zhurenjiaoshou_name=(TextView) arg1.findViewById(R.id.main_zhurenjiaoshou_name); 
            //主治醫生  
            hooker.main_zhuzhiyisheng_pic=(ImageView) arg1.findViewById(R.id.main_zhuzhiyisheng_picture); 
            hooker.main_zhuzhiyisheng_name=(TextView) arg1.findViewById(R.id.main_zhuzhiyisheng_name); 
            //經治醫師  
            hooker.main_jingzhiyisheng_pic=(ImageView) arg1.findViewById(R.id.main_jingzhiyisheng_picture); 
            hooker.main_jingzhiyisheng_name=(TextView) arg1.findViewById(R.id.main_jingzhiyisheng_name); 
            //我的病人  
            hooker.main_wodebingren_position=(TextView) arg1.findViewById(R.id.main_wodebingren_position); 
            hooker.main_wodebingren_name=(TextView) arg1.findViewById(R.id.main_wodebingren_name); 
            //我的護士  
            hooker.main_wodehushi_pic=(ImageView) arg1.findViewById(R.id.main_wodehushi_picture); 
            hooker.main_wodehushi_name=(TextView) arg1.findViewById(R.id.main_wodehushi_name); 
            //組長護士  
            hooker.main_zhuzhanghushi_pic=(ImageView) arg1.findViewById(R.id.main_zhuzhanghushi_picture); 
            hooker.main_zhuzhanghushi_name=(TextView) arg1.findViewById(R.id.main_zhuzhanghushi_name); 
            //護士長  
            hooker.main_hushizhang_pic=(ImageView) arg1.findViewById(R.id.main_hushizhang_picture); 
            hooker.main_hushizhang_name=(TextView) arg1.findViewById(R.id.main_hushizhang_name); 
             
             
            arg1.setTag(hooker); 
        } else { 
            hooker = (Hooker) arg1.getTag(); 
        } 
        System.out.println("主任教授的照片:"+list.get(arg0).getDoctorteamnamep()); 
        //主任教授  
        hooker.main_zhurenjiaoshou_pic.setImageResource(R.drawable.a11); 
        hooker.main_zhurenjiaoshou_name.setText(list.get(arg0).getDoctorteamname()); 
        hooker.main_zhurenjiaoshou_pic.setOnClickListener(new View.OnClickListener() { 
            @Override 
            public void onClick(View v) { 
                DetailDialog dialog=new DetailDialog(context,R.style.Theme_NoTitleDialog); 
                dialog.show(); 
            } 
        }); 
        //主治醫生  
        hooker.main_zhuzhiyisheng_pic.setImageResource(R.drawable.a11); 
        hooker.main_zhuzhiyisheng_pic.setOnClickListener(new View.OnClickListener() { 
             
            @Override 
            public void onClick(View v) { 
                // TODO Auto-generated method stub  
                DetailDialog dialog=new DetailDialog(context,R.style.Theme_NoTitleDialog); 
                dialog.show(); 
            } 
        }); 
        hooker.main_zhuzhiyisheng_name.setText(list.get(arg0).getDoctorgroupname()); 
        //經治醫師  
        hooker.main_jingzhiyisheng_pic.setImageResource(R.drawable.a11); 
        hooker.main_jingzhiyisheng_name.setText(list.get(arg0).getDoctormyname()); 
        //我的病人  
        hooker.main_wodebingren_position.setText(list.get(arg0).getPatientbedno()); 
        hooker.main_wodebingren_name.setText(list.get(arg0).getPatientname()); 
        //我的護士  
        hooker.main_wodehushi_pic.setImageResource(R.drawable.a11); 
        hooker.main_wodehushi_name.setText(list.get(arg0).getNursemyname()); 
        //組長護士  
        hooker.main_zhuzhanghushi_pic.setImageResource(R.drawable.a11); 
        hooker.main_zhuzhanghushi_name.setText(list.get(arg0).getNursegroupname()); 
        //護士長  
        hooker.main_hushizhang_pic.setImageResource(R.drawable.a11); 
        hooker.main_hushizhang_name.setText(list.get(arg0).getNurseteamname()); 
          
        return arg1; 
    } 
     class Hooker { 
         //主任教授  
        public ImageView main_zhurenjiaoshou_pic; 
        public TextView main_zhurenjiaoshou_name; 
        //主治醫生  
        public ImageView main_zhuzhiyisheng_pic; 
        public TextView main_zhuzhiyisheng_name; 
        //經治醫師  
        public ImageView main_jingzhiyisheng_pic; 
        public TextView main_jingzhiyisheng_name; 
        //病人  
        public TextView main_wodebingren_position; 
        public TextView main_wodebingren_name; 
        //我的護士  
        public ImageView main_wodehushi_pic; 
        public TextView main_wodehushi_name; 
        //組長護士  
        public ImageView main_zhuzhanghushi_pic; 
        public TextView main_zhuzhanghushi_name; 
        //護士長  
        public ImageView main_hushizhang_pic; 
        public TextView main_hushizhang_name; 
     
    } 
      
      
      
     
 
 

package com.shine.yihutuandui;


import java.util.List;

import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.sax.StartElementListener;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

public class LVAdapter extends BaseAdapter{
 private LayoutInflater mInflater;
 private List<HospitalTuanDuiBean> list;
 private Context context;
 
 MainActivity main;
 public LVAdapter() {
  super();
 }
 public LVAdapter(Context context,List<HospitalTuanDuiBean> list) {
  super();
  this.context=context;
  main=new MainActivity();
  this.list=list;
  mInflater = LayoutInflater.from(context);
 }
 
 @Override
 public int getCount() {
  if (list!=null) {
   return list.size();
  }
  return 0;
 }

 @Override
 public Object getItem(int arg0) {
  return list.get(arg0);
 }

 @Override
 public long getItemId(int arg0) {
  return arg0;
 }

 @Override
 public View getView(int arg0, View arg1, ViewGroup arg2) {
  Hooker hooker;
  if (arg1 == null) {
   arg1 = mInflater.inflate(R.layout.listviewitem, null);
   hooker = new Hooker();
   //主任教授
   hooker.main_zhurenjiaoshou_pic=(ImageView) arg1.findViewById(R.id.main_zhurenjiaoshou_picture);
   hooker.main_zhurenjiaoshou_name=(TextView) arg1.findViewById(R.id.main_zhurenjiaoshou_name);
   //主治醫生
   hooker.main_zhuzhiyisheng_pic=(ImageView) arg1.findViewById(R.id.main_zhuzhiyisheng_picture);
   hooker.main_zhuzhiyisheng_name=(TextView) arg1.findViewById(R.id.main_zhuzhiyisheng_name);
   //經治醫師
   hooker.main_jingzhiyisheng_pic=(ImageView) arg1.findViewById(R.id.main_jingzhiyisheng_picture);
   hooker.main_jingzhiyisheng_name=(TextView) arg1.findViewById(R.id.main_jingzhiyisheng_name);
   //我的病人
   hooker.main_wodebingren_position=(TextView) arg1.findViewById(R.id.main_wodebingren_position);
   hooker.main_wodebingren_name=(TextView) arg1.findViewById(R.id.main_wodebingren_name);
   //我的護士
   hooker.main_wodehushi_pic=(ImageView) arg1.findViewById(R.id.main_wodehushi_picture);
   hooker.main_wodehushi_name=(TextView) arg1.findViewById(R.id.main_wodehushi_name);
   //組長護士
   hooker.main_zhuzhanghushi_pic=(ImageView) arg1.findViewById(R.id.main_zhuzhanghushi_picture);
   hooker.main_zhuzhanghushi_name=(TextView) arg1.findViewById(R.id.main_zhuzhanghushi_name);
   //護士長
   hooker.main_hushizhang_pic=(ImageView) arg1.findViewById(R.id.main_hushizhang_picture);
   hooker.main_hushizhang_name=(TextView) arg1.findViewById(R.id.main_hushizhang_name);
   
   
   arg1.setTag(hooker);
  } else {
   hooker = (Hooker) arg1.getTag();
  }
  System.out.println("主任教授的照片:"+list.get(arg0).getDoctorteamnamep());
  //主任教授
  hooker.main_zhurenjiaoshou_pic.setImageResource(R.drawable.a11);
  hooker.main_zhurenjiaoshou_name.setText(list.get(arg0).getDoctorteamname());
  hooker.main_zhurenjiaoshou_pic.setOnClickListener(new View.OnClickListener() {
   @Override
   public void onClick(View v) {
    DetailDialog dialog=new DetailDialog(context,R.style.Theme_NoTitleDialog);
    dialog.show();
   }
  });
  //主治醫生
  hooker.main_zhuzhiyisheng_pic.setImageResource(R.drawable.a11);
  hooker.main_zhuzhiyisheng_pic.setOnClickListener(new View.OnClickListener() {
   
   @Override
   public void onClick(View v) {
    // TODO Auto-generated method stub
    DetailDialog dialog=new DetailDialog(context,R.style.Theme_NoTitleDialog);
    dialog.show();
   }
  });
  hooker.main_zhuzhiyisheng_name.setText(list.get(arg0).getDoctorgroupname());
  //經治醫師
  hooker.main_jingzhiyisheng_pic.setImageResource(R.drawable.a11);
  hooker.main_jingzhiyisheng_name.setText(list.get(arg0).getDoctormyname());
  //我的病人
  hooker.main_wodebingren_position.setText(list.get(arg0).getPatientbedno());
  hooker.main_wodebingren_name.setText(list.get(arg0).getPatientname());
  //我的護士
  hooker.main_wodehushi_pic.setImageResource(R.drawable.a11);
  hooker.main_wodehushi_name.setText(list.get(arg0).getNursemyname());
  //組長護士
  hooker.main_zhuzhanghushi_pic.setImageResource(R.drawable.a11);
  hooker.main_zhuzhanghushi_name.setText(list.get(arg0).getNursegroupname());
  //護士長
  hooker.main_hushizhang_pic.setImageResource(R.drawable.a11);
  hooker.main_hushizhang_name.setText(list.get(arg0).getNurseteamname());
  
  return arg1;
 }
  class Hooker {
   //主任教授
  public ImageView main_zhurenjiaoshou_pic;
  public TextView main_zhurenjiaoshou_name;
  //主治醫生
  public ImageView main_zhuzhiyisheng_pic;
  public TextView main_zhuzhiyisheng_name;
  //經治醫師
  public ImageView main_jingzhiyisheng_pic;
  public TextView main_jingzhiyisheng_name;
  //病人
  public TextView main_wodebingren_position;
  public TextView main_wodebingren_name;
  //我的護士
  public ImageView main_wodehushi_pic;
  public TextView main_wodehushi_name;
  //組長護士
  public ImageView main_zhuzhanghushi_pic;
  public TextView main_zhuzhanghushi_name;
  //護士長
  public ImageView main_hushizhang_pic;
  public TextView main_hushizhang_name;
 
 }
 
 
 
 


}

 

 

3.

[java] view plaincopyprint?package com.shine.yihutuandui; 
 
import java.io.Serializable; 
 
public class HospitalTuanDuiBean implements Serializable{ 
 
    /**
     * javaBean信息
     */ 
    private static final long serialVersionUID = 1L; 
    private String patientname; 
    private String patientbedno; 
     
    private String nursemyname; 
    private String nursemynamep; 
    private String nursegroupname; 
    private String nursegroupnamep; 
    private String nurseteamname; 
    private String nurseteamnamep; 
     
     
    private String doctormyname; 
    private String doctormynamep; 
    private String doctorgroupname; 
    private String doctorgroupnamep; 
    private String doctorteamname; 
    private String doctorteamnamep; 
    public HospitalTuanDuiBean(String patientname, String patientbedno, 
            String nursemyname, String nursemynamep, String nursegroupname, 
            String nursegroupnamep, String nurseteamname, 
            String nurseteamnamep, String doctormyname, String doctormynamep, 
            String doctorgroupname, String doctorgroupnamep, 
            String doctorteamname, String doctorteamnamep) { 
        super(); 
        this.patientname = patientname; 
        this.patientbedno = patientbedno; 
        this.nursemyname = nursemyname; 
        this.nursemynamep = nursemynamep; 
        this.nursegroupname = nursegroupname; 
        this.nursegroupnamep = nursegroupnamep; 
        this.nurseteamname = nurseteamname; 
        this.nurseteamnamep = nurseteamnamep; 
        this.doctormyname = doctormyname; 
        this.doctormynamep = doctormynamep; 
        this.doctorgroupname = doctorgroupname; 
        this.doctorgroupnamep = doctorgroupnamep; 
        this.doctorteamname = doctorteamname; 
        this.doctorteamnamep = doctorteamnamep; 
    } 
    public HospitalTuanDuiBean() { 
        super(); 
        // TODO Auto-generated constructor stub  
    } 
    public String getPatientname() { 
        return patientname; 
    } 
    public void setPatientname(String patientname) { 
        this.patientname = patientname; 
    } 
    public String getPatientbedno() { 
        return patientbedno; 
    } 
    public void setPatientbedno(String patientbedno) { 
        this.patientbedno = patientbedno; 
    } 
    public String getNursemyname() { 
        return nursemyname; 
    } 
    public void setNursemyname(String nursemyname) { 
        this.nursemyname = nursemyname; 
    } 
    public String getNursemynamep() { 
        return nursemynamep; 
    } 
    public void setNursemynamep(String nursemynamep) { 
        this.nursemynamep = nursemynamep; 
    } 
    public String getNursegroupname() { 
        return nursegroupname; 
    } 
    public void setNursegroupname(String nursegroupname) { 
        this.nursegroupname = nursegroupname; 
    } 
    public String getNursegroupnamep() { 
        return nursegroupnamep; 
    } 
    public void setNursegroupnamep(String nursegroupnamep) { 
        this.nursegroupnamep = nursegroupnamep; 
    } 
    public String getNurseteamname() { 
        return nurseteamname; 
    } 
    public void setNurseteamname(String nurseteamname) { 
        this.nurseteamname = nurseteamname; 
    } 
    public String getNurseteamnamep() { 
        return nurseteamnamep; 
    } 
    public void setNurseteamnamep(String nurseteamnamep) { 
        this.nurseteamnamep = nurseteamnamep; 
    } 
    public String getDoctormyname() { 
        return doctormyname; 
    } 
    public void setDoctormyname(String doctormyname) { 
        this.doctormyname = doctormyname; 
    } 
    public String getDoctormynamep() { 
        return doctormynamep; 
    } 
    public void setDoctormynamep(String doctormynamep) { 
        this.doctormynamep = doctormynamep; 
    } 
    public String getDoctorgroupname() { 
        return doctorgroupname; 
    } 
    public void setDoctorgroupname(String doctorgroupname) { 
        this.doctorgroupname = doctorgroupname; 
    } 
    public String getDoctorgroupnamep() { 
        return doctorgroupnamep; 
    } 
    public void setDoctorgroupnamep(String doctorgroupnamep) { 
        this.doctorgroupnamep = doctorgroupnamep; 
    } 
    public String getDoctorteamname() { 
        return doctorteamname; 
    } 
    public void setDoctorteamname(String doctorteamname) { 
        this.doctorteamname = doctorteamname; 
    } 
    public String getDoctorteamnamep() { 
        return doctorteamnamep; 
    } 
    public void setDoctorteamnamep(String doctorteamnamep) { 
        this.doctorteamnamep = doctorteamnamep; 
    } 
     
 
     
     
     

package com.shine.yihutuandui;

import java.io.Serializable;

public class HospitalTuanDuiBean implements Serializable{

 /**
  * javaBean信息
  */
 private static final long serialVersionUID = 1L;
 private String patientname;
 private String patientbedno;
 
 private String nursemyname;
 private String nursemynamep;
 private String nursegroupname;
 private String nursegroupnamep;
 private String nurseteamname;
 private String nurseteamnamep;
 
 
 private String doctormyname;
 private String doctormynamep;
 private String doctorgroupname;
 private String doctorgroupnamep;
 private String doctorteamname;
 private String doctorteamnamep;
 public HospitalTuanDuiBean(String patientname, String patientbedno,
   String nursemyname, String nursemynamep, String nursegroupname,
   String nursegroupnamep, String nurseteamname,
   String nurseteamnamep, String doctormyname, String doctormynamep,
   String doctorgroupname, String doctorgroupnamep,
   String doctorteamname, String doctorteamnamep) {
  super();
  this.patientname = patientname;
  this.patientbedno = patientbedno;
  this.nursemyname = nursemyname;
  this.nursemynamep = nursemynamep;
  this.nursegroupname = nursegroupname;
  this.nursegroupnamep = nursegroupnamep;
  this.nurseteamname = nurseteamname;
  this.nurseteamnamep = nurseteamnamep;
  this.doctormyname = doctormyname;
  this.doctormynamep = doctormynamep;
  this.doctorgroupname = doctorgroupname;
  this.doctorgroupnamep = doctorgroupnamep;
  this.doctorteamname = doctorteamname;
  this.doctorteamnamep = doctorteamnamep;
 }
 public HospitalTuanDuiBean() {
  super();
  // TODO Auto-generated constructor stub
 }
 public String getPatientname() {
  return patientname;
 }
 public void setPatientname(String patientname) {
  this.patientname = patientname;
 }
 public String getPatientbedno() {
  return patientbedno;
 }
 public void setPatientbedno(String patientbedno) {
  this.patientbedno = patientbedno;
 }
 public String getNursemyname() {
  return nursemyname;
 }
 public void setNursemyname(String nursemyname) {
  this.nursemyname = nursemyname;
 }
 public String getNursemynamep() {
  return nursemynamep;
 }
 public void setNursemynamep(String nursemynamep) {
  this.nursemynamep = nursemynamep;
 }
 public String getNursegroupname() {
  return nursegroupname;
 }
 public void setNursegroupname(String nursegroupname) {
  this.nursegroupname = nursegroupname;
 }
 public String getNursegroupnamep() {
  return nursegroupnamep;
 }
 public void setNursegroupnamep(String nursegroupnamep) {
  this.nursegroupnamep = nursegroupnamep;
 }
 public String getNurseteamname() {
  return nurseteamname;
 }
 public void setNurseteamname(String nurseteamname) {
  this.nurseteamname = nurseteamname;
 }
 public String getNurseteamnamep() {
  return nurseteamnamep;
 }
 public void setNurseteamnamep(String nurseteamnamep) {
  this.nurseteamnamep = nurseteamnamep;
 }
 public String getDoctormyname() {
  return doctormyname;
 }
 public void setDoctormyname(String doctormyname) {
  this.doctormyname = doctormyname;
 }
 public String getDoctormynamep() {
  return doctormynamep;
 }
 public void setDoctormynamep(String doctormynamep) {
  this.doctormynamep = doctormynamep;
 }
 public String getDoctorgroupname() {
  return doctorgroupname;
 }
 public void setDoctorgroupname(String doctorgroupname) {
  this.doctorgroupname = doctorgroupname;
 }
 public String getDoctorgroupnamep() {
  return doctorgroupnamep;
 }
 public void setDoctorgroupnamep(String doctorgroupnamep) {
  this.doctorgroupnamep = doctorgroupnamep;
 }
 public String getDoctorteamname() {
  return doctorteamname;
 }
 public void setDoctorteamname(String doctorteamname) {
  this.doctorteamname = doctorteamname;
 }
 public String getDoctorteamnamep() {
  return doctorteamnamep;
 }
 public void setDoctorteamnamep(String doctorteamnamep) {
  this.doctorteamnamep = doctorteamnamep;
 }
 

 
 
 
}

 

4.

[java] view plaincopyprint?<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.shine.yihutuandui" 
    android:versionCode="1" 
    android:versionName="1.0" > 
 
    <uses-sdk 
        android:minSdkVersion="8" 
        android:targetSdkVersion="17" /> 
 <uses-permission android:name="android.permission.INTERNET"/> 
    <application 
        android:allowBackup="true" 
        android:icon="@drawable/ic_launcher" 
        android:label="@string/app_name" 
        android:theme="@style/AppTheme" 
          android:persistent="true" 
         > 
        <activity 
            android:name="com.shine.yihutuandui.MainActivity" 
            android:label="@string/app_name" > 
            <intent-filter> 
                <action android:name="android.intent.action.MAIN" /> 
                 <category android:name="android.intent.category.HOME" /> 
                <category android:name="android.intent.category.LAUNCHER" /> 
            </intent-filter> 
        </activity> 
         <activity 
            android:name="com.shine.yihutuandui.DetailIntroduceActivity" 
            android:theme="@android:style/Theme.Translucent" 
            android:launchMode="singleInstance" 
            android:label="@string/app_name" > 
          <intent-filter> 
                <action android:name="com.shine.yihutuandui.DetailIntroduceActivity" /> 
     
            </intent-filter> 
        </activity> 
         
         
       
    </application> 
 
</manifest> 

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.shine.yihutuandui"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />
 <uses-permission android:name="android.permission.INTERNET"/>
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme"
          android:persistent="true"
         >
        <activity
            android:name="com.shine.yihutuandui.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
     <category android:name="android.intent.category.HOME" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
         <activity
            android:name="com.shine.yihutuandui.DetailIntroduceActivity"
            android:theme="@android:style/Theme.Translucent"
            android:launchMode="singleInstance"
            android:label="@string/app_name" >
          <intent-filter>
                <action android:name="com.shine.yihutuandui.DetailIntroduceActivity" />
 
            </intent-filter>
        </activity>
       
       
     
    </application>

</manifest>
5.

[java] view plaincopyprint?package com.shine.yihutuandui; 
 
import android.app.Dialog; 
import android.content.Context; 
import android.os.Bundle; 
//http://gundumw100.iteye.com/blog/1012461  
public class DetailDialog extends Dialog { 
     
    private Context context; 
    public DetailDialog(Context context) { 
        super(context); 
        // TODO Auto-generated constructor stub  
    } 
    public DetailDialog(Context context, int theme) { 
        super(context, theme); 
        // TODO Auto-generated constructor stub  
        this.context=context; 
    } 
     
     
    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
        // TODO Auto-generated method stub  
        super.onCreate(savedInstanceState); 
        setContentView(R.layout.detailintroduceactivity); 
    } 
     
     
     
 

package com.shine.yihutuandui;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
//http://gundumw100.iteye.com/blog/1012461
public class DetailDialog extends Dialog {
 
 private Context context;
 public DetailDialog(Context context) {
  super(context);
  // TODO Auto-generated constructor stub
 }
 public DetailDialog(Context context, int theme) {
  super(context, theme);
  // TODO Auto-generated constructor stub
  this.context=context;
 }
 
 
 @Override
 protected void onCreate(Bundle savedInstanceState) {
  // TODO Auto-generated method stub
  super.onCreate(savedInstanceState);
  setContentView(R.layout.detailintroduceactivity);
 }
 
 
 

}

6.

[html] view plaincopyprint?<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="300dp" 
    android:layout_gravity="center" 
    android:background="#f3f1e2" 
    android:orientation="horizontal" > 
 
    <!-- 主任教授 --> 
 
    <LinearLayout 
        android:layout_width="0dp" 
        android:layout_height="fill_parent" 
        android:layout_weight="1" 
        android:orientation="vertical" > 
 
        <ImageView 
            android:id="@+id/main_zhurenjiaoshou_picture" 
            android:layout_width="150px" 
            android:layout_height="225px" 
            android:layout_marginTop="5px" 
            android:scaleType="fitXY" 
            android:src="@drawable/a11" /> 
 
        <TextView 
            android:id="@+id/main_zhurenjiaoshou_position" 
            android:layout_width="150px" 
            android:layout_height="40px" 
            android:gravity="center" 
            android:textSize="22sp" 
            android:textColor="#61a5ba" 
            android:text="主任教授" /> 
 
        <TextView 
            android:id="@+id/main_zhurenjiaoshou_name" 
            android:layout_width="150px" 
            android:layout_height="40px" 
            android:textColor="#808080" 
            android:gravity="center" 
            android:textSize="22sp" 
            android:text="王明明" /> 
    </LinearLayout> 
    <!-- 主治醫生 --> 
 
     <LinearLayout 
        android:layout_width="0dp" 
        android:layout_height="fill_parent" 
        android:layout_weight="1" 
         
        android:orientation="vertical" > 
 
        <ImageView 
            android:id="@+id/main_zhuzhiyisheng_picture" 
            android:layout_width="150px" 
            android:layout_height="225px" 
             android:layout_marginTop="5px" 
            android:scaleType="fitXY" 
            android:src="@drawable/a11" /> 
 
        <TextView 
            android:id="@+id/main_zhuzhiyisheng_position" 
            android:layout_width="150px" 
            android:layout_height="40px" 
            android:gravity="center" 
            android:textSize="22sp" 
            android:textColor="#61a5ba" 
            android:text="主治醫師" /> 
 
        <TextView 
            android:id="@+id/main_zhuzhiyisheng_name" 
            android:layout_width="150px" 
            android:layout_height="40px" 
            android:textColor="#808080" 
            android:gravity="center" 
            android:textSize="22sp" 
            android:text="王明明" /> 
    </LinearLayout> 
 
    <!-- 經治醫師 --> 
 <LinearLayout 
        android:layout_width="0dp" 
        android:layout_height="fill_parent" 
        android:layout_weight="1" 
        
        android:orientation="vertical" > 
 
        <ImageView 
            android:id="@+id/main_jingzhiyisheng_picture" 
            android:layout_width="150px" 
            android:layout_height="225px" 
             android:layout_marginTop="5px" 
            android:scaleType="fitXY" 
            android:src="@drawable/a11" /> 
 
        <TextView 
            android:id="@+id/main_jingzhiyisheng_position" 
            android:layout_width="150px" 
            android:layout_height="40px" 
            android:gravity="center" 
            android:textSize="22sp" 
            android:textColor="#61a5ba" 
            android:text="經治醫師" /> 
 
        <TextView 
            android:id="@+id/main_jingzhiyisheng_name" 
            android:layout_width="150px" 
            android:layout_height="40px" 
            android:textColor="#808080" 
            android:gravity="center" 
            android:textSize="22sp" 
            android:text="王明明" /> 
    </LinearLayout> 
 
    <!-- 病人 --> 
 
    <LinearLayout 
        android:layout_width="0dp" 
        android:layout_height="fill_parent" 
        android:layout_gravity="center" 
        android:gravity="center" 
        android:layout_weight="2" 
        android:orientation="horizontal" > 
 
        <TextView 
            android:id="@+id/main_wodebingren_position" 
            android:layout_width="80px" 
            android:layout_height="80px" 
            android:background="#faac02" 
            android:textSize="42sp" 
            android:gravity="center" 
            android:text="1" /> 
 
        <TextView 
            android:id="@+id/main_wodebingren_name" 
            android:layout_width="220px" 
            android:layout_height="80px" 
            android:gravity="center" 
             android:textSize="42sp" 
            android:background="#f3f1e2" 
            android:text="王明明" /> 
    </LinearLayout> 
 
    <!-- 我的護士 --> 
 
    <LinearLayout 
        android:layout_width="0dp" 
        android:layout_height="fill_parent" 
        android:layout_weight="1" 
         
        android:orientation="vertical" > 
 
        <ImageView 
            android:id="@+id/main_wodehushi_picture" 
            android:layout_width="150px" 
            android:layout_height="225px" 
             android:layout_marginTop="5px" 
            android:scaleType="fitXY" 
            android:src="@drawable/a11" /> 
 
        <TextView 
            android:id="@+id/main_wodehushi_position" 
            android:layout_width="150px" 
            android:layout_height="40px" 
            android:gravity="center" 
            android:textSize="22sp" 
            android:textColor="#61a5ba" 
            android:text="我的護士" /> 
 
        <TextView 
            android:id="@+id/main_wodehushi_name" 
            android:layout_width="150px" 
            android:layout_height="40px" 
            android:textColor="#808080" 
            android:gravity="center" 
            android:textSize="22sp" 
            android:text="王明明" /> 
    </LinearLayout> 
    <!-- 組長護士 --> 
 <LinearLayout 
        android:layout_width="0dp" 
        android:layout_height="fill_parent" 
        android:layout_weight="1" 
         
        android:orientation="vertical" > 
 
        <ImageView 
            android:id="@+id/main_zhuzhanghushi_picture" 
            android:layout_width="150px" 
            android:layout_height="225px" 
             android:layout_marginTop="5px" 
            android:scaleType="fitXY" 
            android:src="@drawable/a11" /> 
 
        <TextView 
            android:id="@+id/main_zhuzhanghushi_position" 
            android:layout_width="150px" 
            android:layout_height="40px" 
            android:gravity="center" 
            android:textSize="22sp" 
            android:textColor="#61a5ba" 
            android:text="組長護士" /> 
 
        <TextView 
            android:id="@+id/main_zhuzhanghushi_name" 
            android:layout_width="150px" 
            android:layout_height="40px" 
            android:textColor="#808080" 
            android:gravity="center" 
            android:textSize="22sp" 
            android:text="王明明" /> 
    </LinearLayout> 
    <!-- 護士長 --> 
 
     <LinearLayout 
        android:layout_width="0dp" 
        android:layout_height="fill_parent" 
        android:layout_weight="1" 
         
        android:orientation="vertical" > 
 
        <ImageView 
            android:id="@+id/main_hushizhang_picture" 
            android:layout_width="150px" 
            android:layout_height="225px" 
             android:layout_marginTop="5px" 
            android:scaleType="fitXY" 
            android:src="@drawable/a11" /> 
 
        <TextView 
            android:id="@+id/main_hushizhang_position" 
            android:layout_width="150px" 
            android:layout_height="40px" 
            android:gravity="center" 
            android:textSize="22sp" 
            android:textColor="#61a5ba" 
            android:text="護士長" /> 
 
        <TextView 
            android:id="@+id/main_hushizhang_name" 
            android:layout_width="150px" 
            android:layout_height="40px" 
            android:textColor="#808080" 
            android:gravity="center" 
            android:textSize="22sp" 
            android:text="王明明" /> 
    </LinearLayout> 
</LinearLayout> 

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="300dp"
    android:layout_gravity="center"
    android:background="#f3f1e2"
    android:orientation="horizontal" >

    <!-- 主任教授 -->

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="fill_parent"
        android:layout_weight="1"
        android:orientation="vertical" >

        <ImageView
            android:id="@+id/main_zhurenjiaoshou_picture"
            android:layout_width="150px"
            android:layout_height="225px"
            android:layout_marginTop="5px"
            android:scaleType="fitXY"
            android:src="@drawable/a11" />

        <TextView
            android:id="@+id/main_zhurenjiaoshou_position"
            android:layout_width="150px"
            android:layout_height="40px"
            android:gravity="center"
            android:textSize="22sp"
            android:textColor="#61a5ba"
            android:text="主任教授" />

        <TextView
            android:id="@+id/main_zhurenjiaoshou_name"
            android:layout_width="150px"
            android:layout_height="40px"
            android:textColor="#808080"
            android:gravity="center"
            android:textSize="22sp"
            android:text="王明明" />
    </LinearLayout>
    <!-- 主治醫生 -->

     <LinearLayout
        android:layout_width="0dp"
        android:layout_height="fill_parent"
        android:layout_weight="1"
       
        android:orientation="vertical" >

        <ImageView
            android:id="@+id/main_zhuzhiyisheng_picture"
            android:layout_width="150px"
            android:layout_height="225px"
             android:layout_marginTop="5px"
            android:scaleType="fitXY"
            android:src="@drawable/a11" />

        <TextView
            android:id="@+id/main_zhuzhiyisheng_position"
            android:layout_width="150px"
            android:layout_height="40px"
            android:gravity="center"
            android:textSize="22sp"
            android:textColor="#61a5ba"
            android:text="主治醫師" />

        <TextView
            android:id="@+id/main_zhuzhiyisheng_name"
            android:layout_width="150px"
            android:layout_height="40px"
            android:textColor="#808080"
            android:gravity="center"
            android:textSize="22sp"
            android:text="王明明" />
    </LinearLayout>

    <!-- 經治醫師 -->
 <LinearLayout
        android:layout_width="0dp"
        android:layout_height="fill_parent"
        android:layout_weight="1"
      
        android:orientation="vertical" >

        <ImageView
            android:id="@+id/main_jingzhiyisheng_picture"
            android:layout_width="150px"
            android:layout_height="225px"
             android:layout_marginTop="5px"
            android:scaleType="fitXY"
            android:src="@drawable/a11" />

        <TextView
            android:id="@+id/main_jingzhiyisheng_position"
            android:layout_width="150px"
            android:layout_height="40px"
            android:gravity="center"
            android:textSize="22sp"
            android:textColor="#61a5ba"
            android:text="經治醫師" />

        <TextView
            android:id="@+id/main_jingzhiyisheng_name"
            android:layout_width="150px"
            android:layout_height="40px"
            android:textColor="#808080"
            android:gravity="center"
            android:textSize="22sp"
            android:text="王明明" />
    </LinearLayout>

    <!-- 病人 -->

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="fill_parent"
        android:layout_gravity="center"
        android:gravity="center"
        android:layout_weight="2"
        android:orientation="horizontal" >

        <TextView
            android:id="@+id/main_wodebingren_position"
            android:layout_width="80px"
            android:layout_height="80px"
            android:background="#faac02"
            android:textSize="42sp"
            android:gravity="center"
            android:text="1" />

        <TextView
            android:id="@+id/main_wodebingren_name"
            android:layout_width="220px"
            android:layout_height="80px"
            android:gravity="center"
             android:textSize="42sp"
            android:background="#f3f1e2"
            android:text="王明明" />
    </LinearLayout>

    <!-- 我的護士 -->

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="fill_parent"
        android:layout_weight="1"
       
        android:orientation="vertical" >

        <ImageView
            android:id="@+id/main_wodehushi_picture"
            android:layout_width="150px"
            android:layout_height="225px"
             android:layout_marginTop="5px"
            android:scaleType="fitXY"
            android:src="@drawable/a11" />

        <TextView
            android:id="@+id/main_wodehushi_position"
            android:layout_width="150px"
            android:layout_height="40px"
            android:gravity="center"
            android:textSize="22sp"
            android:textColor="#61a5ba"
            android:text="我的護士" />

        <TextView
            android:id="@+id/main_wodehushi_name"
            android:layout_width="150px"
            android:layout_height="40px"
            android:textColor="#808080"
            android:gravity="center"
            android:textSize="22sp"
            android:text="王明明" />
    </LinearLayout>
    <!-- 組長護士 -->
 <LinearLayout
        android:layout_width="0dp"
        android:layout_height="fill_parent"
        android:layout_weight="1"
       
        android:orientation="vertical" >

        <ImageView
            android:id="@+id/main_zhuzhanghushi_picture"
            android:layout_width="150px"
            android:layout_height="225px"
             android:layout_marginTop="5px"
            android:scaleType="fitXY"
            android:src="@drawable/a11" />

        <TextView
            android:id="@+id/main_zhuzhanghushi_position"
            android:layout_width="150px"
            android:layout_height="40px"
            android:gravity="center"
            android:textSize="22sp"
            android:textColor="#61a5ba"
            android:text="組長護士" />

        <TextView
            android:id="@+id/main_zhuzhanghushi_name"
            android:layout_width="150px"
            android:layout_height="40px"
            android:textColor="#808080"
            android:gravity="center"
            android:textSize="22sp"
            android:text="王明明" />
    </LinearLayout>
    <!-- 護士長 -->

     <LinearLayout
        android:layout_width="0dp"
        android:layout_height="fill_parent"
        android:layout_weight="1"
       
        android:orientation="vertical" >

        <ImageView
            android:id="@+id/main_hushizhang_picture"
            android:layout_width="150px"
            android:layout_height="225px"
             android:layout_marginTop="5px"
            android:scaleType="fitXY"
            android:src="@drawable/a11" />

        <TextView
            android:id="@+id/main_hushizhang_position"
            android:layout_width="150px"
            android:layout_height="40px"
            android:gravity="center"
            android:textSize="22sp"
            android:textColor="#61a5ba"
            android:text="護士長" />

        <TextView
            android:id="@+id/main_hushizhang_name"
            android:layout_width="150px"
            android:layout_height="40px"
            android:textColor="#808080"
            android:gravity="center"
            android:textSize="22sp"
            android:text="王明明" />
    </LinearLayout>
</LinearLayout>
7

[html]
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="900px" 
    android:layout_height="600px" 
    android:background="#c3dfd1" 
    android:layout_gravity="center" 
    android:orientation="vertical" 
  > 
  <LinearLayout  
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal" 
  > 
  <TextView 
      android:layout_width="800px" 
      android:layout_height="wrap_content" 
      android:gravity="center" 
      android:textSize="26sp" 
      android:textColor="#098934" 
      android:text="詳細信息" 
      /> 
   
   <Button 
      android:id="@+id/main_yihutuandui_back" 
      android:layout_width="100px" 
      android:layout_height="100px" 
      android:layout_gravity="right" 
      android:text="返回" 
      /> 
   </LinearLayout> 
  <View 
      android:layout_width="fill_parent" 
      android:layout_height="5px" 
      android:background="#128790" 
      /> 
  <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:textSize="22sp" 
      android:text="發大水發大水發大水發大水發大水發大水發大水發大水發的說法發生的發的是發的撒" 
      /> 
</LinearLayout> 

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="900px"
    android:layout_height="600px"
    android:background="#c3dfd1"
    android:layout_gravity="center"
    android:orientation="vertical"
  >
  <LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
  >
  <TextView
      android:layout_width="800px"
      android:layout_height="wrap_content"
      android:gravity="center"
      android:textSize="26sp"
      android:textColor="#098934"
      android:text="詳細信息"
      />
 
   <Button
      android:id="@+id/main_yihutuandui_back"
      android:layout_width="100px"
      android:layout_height="100px"
      android:layout_gravity="right"
      android:text="返回"
      />
   </LinearLayout>
  <View
      android:layout_width="fill_parent"
      android:layout_height="5px"
      android:background="#128790"
      />
  <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:textSize="22sp"
      android:text="發大水發大水發大水發大水發大水發大水發大水發大水發的說法發生的發的是發的撒"
      />
</LinearLayout>
 

php返回json數據

[php]
<?php 
$array = array( 
  'patientname'=>'張天', 
  'patientbedno'=>'1', 
  'nursemyname'=>'艷蘭', 
  'nursemynamep'=>'a11.png', 
 'nursegroupname'=>'延華', 
  'nursegroupnamep'=>'a11.png', 
  'nurseteamname'=>'李芳', 
  'nurseteamnamep'=>'a11.png', 
   'doctormyname'=>'劉秀', 
  'doctormynamep'=>'a11.png', 
 'doctorgroupname'=>'張問', 
  'doctorgroupnamep'=>'a11.png', 
  'doctorteamname'=>'王國', 
  'doctorteamnamep'=>'a11.png', 
  ); 
  $array1 = array( 
  'patientname'=>'王明', 
  'patientbedno'=>'2', 
  'nursemyname'=>'艷蘭', 
  'nursemynamep'=>'a11.png', 
 'nursegroupname'=>'曲華', 
  'nursegroupnamep'=>'a11.png', 
  'nurseteamname'=>'蘭芳', 
  'nurseteamnamep'=>'a11.png', 
   'doctormyname'=>'劉秀', 
  'doctormynamep'=>'a11.png', 
 'doctorgroupname'=>'張得', 
  'doctorgroupnamep'=>'a11.png', 
  'doctorteamname'=>'王國', 
  'doctorteamnamep'=>'a11.png', 
  ); 
  $array2 = array( 
  'patientname'=>'得開', 
  'patientbedno'=>'3', 
  'nursemyname'=>'趙蘭', 
  'nursemynamep'=>'a11.png', 
 'nursegroupname'=>'曲延', 
  'nursegroupnamep'=>'a11.png', 
  'nurseteamname'=>'李蘭', 
  'nurseteamnamep'=>'a11.png', 
   'doctormyname'=>'劉秀', 
  'doctormynamep'=>'a11.png', 
 'doctorgroupname'=>'張得', 
  'doctorgroupnamep'=>'a11.png', 
  'doctorteamname'=>'王國', 
  'doctorteamnamep'=>'a11.png', 
  ); 
 foreach($array as $key=>$value){ 
$array[$key]=urlencode($value); 
 } 
 foreach($array1 as $key=>$value){ 
$array1[$key]=urlencode($value); 
 } 
 foreach($array2 as $key=>$value){ 
$array2[$key]=urlencode($value); 
 } 
echo "{\"status\":1,\"Data\":[".urldecode(json_encode($array)).",".urldecode(json_encode($array1)).",".urldecode(json_encode($array2))."]}" 
?> 

<?php
$array = array(
  'patientname'=>'張天',
  'patientbedno'=>'1',
  'nursemyname'=>'艷蘭',
  'nursemynamep'=>'a11.png',
 'nursegroupname'=>'延華',
  'nursegroupnamep'=>'a11.png',
  'nurseteamname'=>'李芳',
  'nurseteamnamep'=>'a11.png',
   'doctormyname'=>'劉秀',
  'doctormynamep'=>'a11.png',
 'doctorgroupname'=>'張問',
  'doctorgroupnamep'=>'a11.png',
  'doctorteamname'=>'王國',
  'doctorteamnamep'=>'a11.png',
  );
  $array1 = array(
  'patientname'=>'王明',
  'patientbedno'=>'2',
  'nursemyname'=>'艷蘭',
  'nursemynamep'=>'a11.png',
 'nursegroupname'=>'曲華',
  'nursegroupnamep'=>'a11.png',
  'nurseteamname'=>'蘭芳',
  'nurseteamnamep'=>'a11.png',
   'doctormyname'=>'劉秀',
  'doctormynamep'=>'a11.png',
 'doctorgroupname'=>'張得',
  'doctorgroupnamep'=>'a11.png',
  'doctorteamname'=>'王國',
  'doctorteamnamep'=>'a11.png',
  );
  $array2 = array(
  'patientname'=>'得開',
  'patientbedno'=>'3',
  'nursemyname'=>'趙蘭',
  'nursemynamep'=>'a11.png',
 'nursegroupname'=>'曲延',
  'nursegroupnamep'=>'a11.png',
  'nurseteamname'=>'李蘭',
  'nurseteamnamep'=>'a11.png',
   'doctormyname'=>'劉秀',
  'doctormynamep'=>'a11.png',
 'doctorgroupname'=>'張得',
  'doctorgroupnamep'=>'a11.png',
  'doctorteamname'=>'王國',
  'doctorteamnamep'=>'a11.png',
  );
 foreach($array as $key=>$value){
$array[$key]=urlencode($value);
 }
 foreach($array1 as $key=>$value){
$array1[$key]=urlencode($value);
 }
 foreach($array2 as $key=>$value){
$array2[$key]=urlencode($value);
 }
echo "{\"status\":1,\"Data\":[".urldecode(json_encode($array)).",".urldecode(json_encode($array1)).",".urldecode(json_encode($array2))."]}"
?>

 


 

  1. 上一頁:
  2. 下一頁:
熱門文章
閱讀排行版
Copyright © Android教程網 All Rights Reserved