zoukankan      html  css  js  c++  java
  • 网络请求(listview json解析 数据库存储)【周五01.08】

    adapter
    MyBaseAdapter类

    1
    package com.cp.adapter; 2 3 import java.util.List; 4 5 import android.content.Context; 6 import android.view.LayoutInflater; 7 import android.view.View; 8 import android.view.ViewGroup; 9 import android.widget.BaseAdapter; 10 import android.widget.ImageView; 11 import android.widget.TextView; 12 13 import com.cp.day07zuoye.R; 14 import com.cp.vo.NewsList; 15 import com.lidroid.xutils.BitmapUtils; 16 17 public class MyBaseAdapter extends BaseAdapter{ 18 private Context con; 19 private List<NewsList> list; 20 //创建构造器获取上下文菜单和集合 21 public MyBaseAdapter(Context con,List<NewsList> list){ 22 this.con = con; 23 this.list = list; 24 } 25 @Override 26 public int getCount() { 27 return list.size(); 28 } 29 30 @Override 31 public Object getItem(int position) { 32 return null; 33 } 34 35 @Override 36 public long getItemId(int position) { 37 return 0; 38 } 39 40 @Override 41 public View getView(int position, View convertView, ViewGroup parent) { 42 ViewHolder holder = null; 43 if(convertView == null){ 44 holder = new ViewHolder(); 45 convertView = LayoutInflater.from(con).inflate(R.layout.list_item, null); 46 holder.image = (ImageView) convertView.findViewById(R.id.image); 47 holder.title = (TextView) convertView.findViewById(R.id.title); 48 holder.intro = (TextView) convertView.findViewById(R.id.intro); 49 convertView.setTag(holder); 50 }else{ 51 holder = (ViewHolder) convertView.getTag(); 52 } 53 NewsList news = list.get(position); 54 //利用BitmapUtils类加载图片到ImageView上 55 BitmapUtils bit = new BitmapUtils(con); 56 bit.display(holder.image, news.getPic()); 57 holder.title.setText(news.getTitle()); 58 holder.intro.setText(news.getIntro()); 59 return convertView; 60 } 61 //内部持有类 62 class ViewHolder{ 63 ImageView image; 64 TextView title; 65 TextView intro; 66 } 67 }
    MyCollBaseAdapter类
     1 package com.cp.adapter;
     2 
     3 import java.util.List;
     4 
     5 import android.content.Context;
     6 import android.view.LayoutInflater;
     7 import android.view.View;
     8 import android.view.ViewGroup;
     9 import android.widget.BaseAdapter;
    10 import android.widget.ImageView;
    11 import android.widget.TextView;
    12 
    13 import com.cp.day07zuoye.R;
    14 import com.cp.vo.Collection;
    15 import com.cp.vo.NewsList;
    16 import com.lidroid.xutils.BitmapUtils;
    17 
    18 public class MyCollBaseAdapter extends BaseAdapter{
    19     private Context con;
    20     private List<Collection> list;
    21 
    22     public MyCollBaseAdapter(Context con,List<Collection> list){
    23         this.con = con;
    24         this.list = list;
    25     }
    26     @Override
    27     public int getCount() {
    28         return list.size();
    29     }
    30 
    31     @Override
    32     public Object getItem(int position) {
    33         return null;
    34     }
    35 
    36     @Override
    37     public long getItemId(int position) {
    38         return 0;
    39     }
    40 
    41     @Override
    42     public View getView(int position, View convertView, ViewGroup parent) {
    43         ViewHolder holder = null;
    44         if(convertView == null){
    45             holder = new ViewHolder();
    46             convertView = LayoutInflater.from(con).inflate(R.layout.list_item, null);
    47             holder.image = (ImageView) convertView.findViewById(R.id.image);
    48             holder.title = (TextView) convertView.findViewById(R.id.title);
    49             holder.intro = (TextView) convertView.findViewById(R.id.intro);
    50             convertView.setTag(holder);
    51         }else{
    52             holder = (ViewHolder) convertView.getTag();
    53         }
    54         Collection news = list.get(position);
    55         BitmapUtils bit = new BitmapUtils(con);
    56         bit.display(holder.image, news.getPic());
    57         holder.title.setText(news.getTitle());
    58         holder.intro.setText(news.getIntro());
    59         return convertView;
    60     }
    61     class ViewHolder{
    62         ImageView image;
    63         TextView title;
    64         TextView intro;
    65     }
    66 }
    day07zuoye包
    MainActivity
      1 package com.cp.day07zuoye;
      2 
      3 import java.io.BufferedReader;
      4 import java.io.IOException;
      5 import java.io.InputStreamReader;
      6 import java.net.HttpURLConnection;
      7 import java.net.MalformedURLException;
      8 import java.net.URL;
      9 import java.util.List;
     10 
     11 import android.app.Activity;
     12 import android.content.Intent;
     13 import android.os.Bundle;
     14 import android.os.Handler;
     15 import android.os.Message;
     16 import android.view.Menu;
     17 import android.view.View;
     18 import android.widget.AdapterView;
     19 import android.widget.AdapterView.OnItemClickListener;
     20 import android.widget.ListView;
     21 
     22 import com.cp.adapter.MyBaseAdapter;
     23 import com.cp.vo.Collection;
     24 import com.cp.vo.MyData;
     25 import com.cp.vo.NewsList;
     26 import com.google.gson.Gson;
     27 import com.lidroid.xutils.DbUtils;
     28 import com.lidroid.xutils.exception.DbException;
     29 
     30 public class MainActivity extends Activity {
     31     //新闻地址
     32     public static final String NEWSURL = "http://api.sina.cn/sinago/list.json?channel=hdpic_story&adid=4ad30dabe134695c3d7c3a65977d7e72&from=6042095012&chwm=12050_0001&imei=867064013906290&uid=802909da86d9f5fc&p=1";
     33     private List<NewsList> news;
     34     Handler handler = new Handler(){
     35 
     36         public void handleMessage(android.os.Message msg) {
     37             MyData mydata = parseJson((String)msg.obj);
     38             news = mydata.getData().getList();
     39             insertData(news);
     40             MyBaseAdapter adapter = new MyBaseAdapter(MainActivity.this, news);
     41             newsList.setAdapter(adapter);
     42         };
     43     };
     44     private ListView newsList;
     45     @Override
     46     protected void onCreate(Bundle savedInstanceState) {
     47         super.onCreate(savedInstanceState);
     48         setContentView(R.layout.activity_main);
     49         init();
     50         
     51     }
     52     private void init() {
     53         //找到一个控件
     54         newsList = (ListView)findViewById(R.id.newsList);
     55         //在子线程中请求网络
     56         new Thread(){
     57             public void run() {
     58                 String json = getJsonFromHttp(NEWSURL);
     59                 Message msg = new Message();
     60                 msg.obj = json;
     61                 handler.sendMessage(msg);
     62             };
     63         }.start();
     64         //listView的条目监听
     65         newsList.setOnItemClickListener(new OnItemClickListener() {
     66 
     67             @Override
     68             public void onItemClick(AdapterView<?> arg0, View view, int position,
     69                     long arg3) {
     70                 //获取条目所对应的newslist对象
     71                 NewsList n = news.get(position);
     72                 //通过Bundle传递newslist对象
     73                 Intent intent = new Intent(MainActivity.this,NewsInformation.class);
     74                 Bundle b = new Bundle();
     75                 b.putSerializable("news", n);
     76                 intent.putExtras(b);
     77                 startActivity(intent);
     78             }
     79             
     80         });
     81         
     82     }
     83     
     84     //请求json数据
     85     public String getJsonFromHttp(String uri){
     86         URL url;
     87         StringBuffer sb = new StringBuffer();
     88         try {
     89             url = new URL(uri);
     90             HttpURLConnection httpUrl = (HttpURLConnection) url.openConnection();
     91             httpUrl.setRequestMethod("GET");
     92             httpUrl.setConnectTimeout(5000);
     93             httpUrl.setReadTimeout(5000);
     94             if(httpUrl.getResponseCode() == 200){
     95                 BufferedReader br = new BufferedReader(new InputStreamReader(httpUrl.getInputStream(),"utf-8"));
     96                 String str = "";
     97                 while((str = br.readLine()) != null){
     98                     sb.append(str);
     99                 }
    100             }
    101         } catch (MalformedURLException e) {
    102             e.printStackTrace();
    103         } catch (IOException e) {
    104             e.printStackTrace();
    105         }
    106         return sb.toString();
    107     }
    108     
    109     //解析json数据
    110     public MyData parseJson(String json){
    111         Gson g = new Gson();
    112         MyData mydata = g.fromJson(json, MyData.class);
    113         return mydata;
    114     }
    115 
    116     
    117     //创建并添加数据到数据库的方法
    118     public void insertData(List<NewsList> list){
    119         DbUtils db = DbUtils.create(MainActivity.this, "newsData");
    120         try {
    121             db.createTableIfNotExist(NewsList.class);
    122             db.createTableIfNotExist(Collection.class);
    123             db.saveAll(list);
    124         } catch (DbException e) {
    125             e.printStackTrace();
    126         }
    127     }
    128     
    129     @Override
    130     protected void onDestroy() {
    131         super.onDestroy();
    132         //Activity销毁时将newslist表中的数据清空
    133         DbUtils db = DbUtils.create(MainActivity.this, "newsData");
    134         try {
    135             db.deleteAll(NewsList.class);
    136         } catch (DbException e) {
    137             e.printStackTrace();
    138         }
    139     }
    140     
    141     
    142     
    143     
    144     
    145 
    146     @Override
    147     public boolean onCreateOptionsMenu(Menu menu) {
    148         // Inflate the menu; this adds items to the action bar if it is present.
    149         getMenuInflater().inflate(R.menu.activity_main, menu);
    150         return true;
    151     }
    152 
    153 }
    MyCollection
     1 package com.cp.day07zuoye;
     2 
     3 import java.util.List;
     4 
     5 import com.cp.adapter.MyBaseAdapter;
     6 import com.cp.adapter.MyCollBaseAdapter;
     7 import com.cp.vo.Collection;
     8 import com.lidroid.xutils.DbUtils;
     9 import com.lidroid.xutils.exception.DbException;
    10 
    11 import android.app.Activity;
    12 import android.os.Bundle;
    13 import android.view.Menu;
    14 import android.widget.ListView;
    15 
    16 public class MyCollection extends Activity {
    17 
    18     @Override
    19     protected void onCreate(Bundle savedInstanceState) {
    20         super.onCreate(savedInstanceState);
    21         setContentView(R.layout.activity_my_collection);
    22         init();
    23     }
    24 
    25     private void init() {
    26         ListView listView = (ListView)findViewById(R.id.myListView);
    27         //创建适配器
    28         MyCollBaseAdapter adapter = new MyCollBaseAdapter(MyCollection.this, findAllData());
    29         //加载适配器
    30         listView.setAdapter(adapter);
    31     }
    32     
    33     //查询收藏表全查
    34     public List<Collection> findAllData(){
    35         DbUtils db = DbUtils.create(MyCollection.this, "newsData");
    36         List<Collection> list = null;
    37         try {
    38             list =  db.findAll(Collection.class);
    39         } catch (DbException e) {
    40             // TODO Auto-generated catch block
    41             e.printStackTrace();
    42         }
    43         return list;
    44     }
    45 
    46 }
    NewsInformation
      1 package com.cp.day07zuoye;
      2 
      3 import java.lang.reflect.InvocationTargetException;
      4 import java.util.List;
      5 
      6 import org.apache.commons.beanutils.BeanUtils;
      7 
      8 import android.app.Activity;
      9 import android.content.Intent;
     10 import android.database.Cursor;
     11 import android.database.sqlite.SQLiteDatabase;
     12 import android.os.Bundle;
     13 import android.view.Menu;
     14 import android.view.View;
     15 import android.view.View.OnClickListener;
     16 import android.widget.Button;
     17 import android.widget.ImageView;
     18 import android.widget.TextView;
     19 import android.widget.Toast;
     20 
     21 import com.cp.helper.MyHelper;
     22 import com.cp.vo.Collection;
     23 import com.cp.vo.NewsList;
     24 import com.lidroid.xutils.BitmapUtils;
     25 import com.lidroid.xutils.DbUtils;
     26 import com.lidroid.xutils.db.sqlite.Selector;
     27 import com.lidroid.xutils.exception.DbException;
     28 
     29 public class NewsInformation extends Activity implements OnClickListener {
     30 
     31     private NewsList newslist;
     32 
     33     @Override
     34     protected void onCreate(Bundle savedInstanceState) {
     35         super.onCreate(savedInstanceState);
     36         setContentView(R.layout.activity_news_information);
     37         init();
     38     }
     39     private void init() {
     40         //获取控件
     41         ImageView image = (ImageView)findViewById(R.id.info_image);
     42         TextView infoTitle = (TextView)findViewById(R.id.info_title);
     43         TextView infoLongTitle = (TextView)findViewById(R.id.info_longtitle);
     44         TextView infoIntro = (TextView)findViewById(R.id.info_intro);
     45         Button collection = (Button)findViewById(R.id.collection);
     46         Button mine = (Button)findViewById(R.id.mine);
     47         Button back = (Button)findViewById(R.id.back);
     48         //注册监听
     49         collection.setOnClickListener(this);
     50         mine.setOnClickListener(this);
     51         back.setOnClickListener(this);
     52         //得到Intent
     53         Intent intent = getIntent();
     54         //得到Bundle
     55         Bundle b = intent.getExtras();
     56         //得到传递过来的对象
     57         newslist = (NewsList) b.getSerializable("news");
     58         //给各个控件赋值
     59         BitmapUtils bit = new BitmapUtils(NewsInformation.this);
     60         bit.display(image, newslist.getKpic());
     61         infoTitle.setText(newslist.getTitle());
     62         infoLongTitle.setText(newslist.getLong_title());
     63         infoIntro.setText(newslist.getIntro());
     64         
     65     }
     66     //按钮监听
     67     @Override
     68     public void onClick(View v) {
     69         switch(v.getId()){
     70         case R.id.collection:
     71             //点击收藏保存到收藏表中
     72             DbUtils db = DbUtils.create(NewsInformation.this, "newsData");
     73             try {
     74                 Collection  c = new Collection();
     75                 //commons-beanutils-1.8.3.jar
     76                 //BeanUtils.copyProperties(c,newslist);
     77                 c.setPic(newslist.getPic());
     78                 c.setTitle(newslist.getTitle());
     79                 c.setIntro(newslist.getIntro());
     80                 c.setId(newslist.getId());
     81                 //如果收藏过就吐司提示不再收藏
     82                 if(findData(c.getId())){
     83                     Toast.makeText(NewsInformation.this, "已经收藏过", 0).show();
     84                     return;
     85                 }
     86                 db.save(c);
     87                 Toast.makeText(NewsInformation.this, "收藏成功", 0).show();
     88             } catch (DbException e) {
     89                 e.printStackTrace();
     90             } 
     91             break;
     92         case R.id.mine:
     93             //跳转到我的收藏界面
     94             Intent intent = new Intent(NewsInformation.this,MyCollection.class);
     95             startActivity(intent);
     96             break;
     97         case R.id.back:
     98             //返回
     99             finish();
    100             break;
    101         }
    102     }
    103     
    104     
    105     //根据id查询数据库的方法
    106     public boolean findData(String id){
    107         boolean b = false;
    108         DbUtils db = DbUtils.create(NewsInformation.this, "newsData");
    109         MyHelper helper = new MyHelper(NewsInformation.this, "newsData", null, 1);
    110         SQLiteDatabase sdb = helper.getReadableDatabase();
    111         
    112         try {
    113             //Cursor c = (Cursor) db.findAll(Selector.from(Collection.class).where("id", "=", id));
    114             Cursor c = sdb.query("com_cp_vo_Collection", null, "id = ?", new String[]{id}, null, null, null);
    115             b = c.moveToNext();
    116         } catch (Exception e) {
    117             e.printStackTrace();
    118         }finally{
    119             sdb.close();
    120         }
    121         return b;
    122     }
    123     
    124     
    125 
    126 
    127     @Override
    128     public boolean onCreateOptionsMenu(Menu menu) {
    129         // Inflate the menu; this adds items to the action bar if it is present.
    130         getMenuInflater().inflate(R.menu.activity_news_information, menu);
    131         return true;
    132     }
    133 
    134 }
    helper包
    MyHelper类
    1
    package com.cp.helper; 2 3 import android.content.Context; 4 import android.database.sqlite.SQLiteDatabase; 5 import android.database.sqlite.SQLiteDatabase.CursorFactory; 6 import android.database.sqlite.SQLiteOpenHelper; 7 8 public class MyHelper extends SQLiteOpenHelper{ 9 10 public MyHelper(Context context, String name, CursorFactory factory, 11 int version) { 12 super(context, name, factory, version); 13 // TODO Auto-generated constructor stub 14 } 15 16 @Override 17 public void onCreate(SQLiteDatabase db) { 18 19 } 20 21 @Override 22 public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { 23 // TODO Auto-generated method stub 24 25 } 26 27 }
    vo
    Collection
      1 package com.cp.vo;
      2 
      3 import com.lidroid.xutils.db.annotation.Id;
      4 //收藏表类
      5 public class Collection {
      6     @Id
      7     private int n_id;
      8     private int articlePubDate;
      9     private String bpic;
     10     private String category;
     11     private int comment;
     12     private CommentCountInfo comment_count_info;
     13     private String comments;
     14     private String feedShowStyle;
     15     private String id;
     16     private String intro;
     17     private String kpic;
     18     private String link;
     19     private String long_title;
     20     private String pic;
     21     private MyPics pics;
     22     private long pubDate;
     23     private String source;
     24     private String title;
     25     public int getArticlePubDate() {
     26         return articlePubDate;
     27     }
     28     public void setArticlePubDate(int articlePubDate) {
     29         this.articlePubDate = articlePubDate;
     30     }
     31     public String getBpic() {
     32         return bpic;
     33     }
     34     public void setBpic(String bpic) {
     35         this.bpic = bpic;
     36     }
     37     public String getCategory() {
     38         return category;
     39     }
     40     public void setCategory(String category) {
     41         this.category = category;
     42     }
     43     public int getComment() {
     44         return comment;
     45     }
     46     public void setComment(int comment) {
     47         this.comment = comment;
     48     }
     49     public CommentCountInfo getComment_count_info() {
     50         return comment_count_info;
     51     }
     52     public void setComment_count_info(CommentCountInfo comment_count_info) {
     53         this.comment_count_info = comment_count_info;
     54     }
     55     public String getComments() {
     56         return comments;
     57     }
     58     public void setComments(String comments) {
     59         this.comments = comments;
     60     }
     61     public String getFeedShowStyle() {
     62         return feedShowStyle;
     63     }
     64     public void setFeedShowStyle(String feedShowStyle) {
     65         this.feedShowStyle = feedShowStyle;
     66     }
     67     public String getId() {
     68         return id;
     69     }
     70     public void setId(String id) {
     71         this.id = id;
     72     }
     73     public String getIntro() {
     74         return intro;
     75     }
     76     public void setIntro(String intro) {
     77         this.intro = intro;
     78     }
     79     public String getKpic() {
     80         return kpic;
     81     }
     82     public void setKpic(String kpic) {
     83         this.kpic = kpic;
     84     }
     85     public String getLink() {
     86         return link;
     87     }
     88     public void setLink(String link) {
     89         this.link = link;
     90     }
     91     public String getLong_title() {
     92         return long_title;
     93     }
     94     public void setLong_title(String long_title) {
     95         this.long_title = long_title;
     96     }
     97     public String getPic() {
     98         return pic;
     99     }
    100     public void setPic(String pic) {
    101         this.pic = pic;
    102     }
    103     public MyPics getPics() {
    104         return pics;
    105     }
    106     public void setPics(MyPics pics) {
    107         this.pics = pics;
    108     }
    109     public long getPubDate() {
    110         return pubDate;
    111     }
    112     public void setPubDate(long pubDate) {
    113         this.pubDate = pubDate;
    114     }
    115     public String getSource() {
    116         return source;
    117     }
    118     public void setSource(String source) {
    119         this.source = source;
    120     }
    121     public String getTitle() {
    122         return title;
    123     }
    124     public void setTitle(String title) {
    125         this.title = title;
    126     }
    127 }
    CommentCountInfo
     1 package com.cp.vo;
     2 
     3 import java.io.Serializable;
     4 
     5 public class CommentCountInfo implements Serializable {
     6     private int comment_status;
     7     private int praise;
     8     private int dispraise;
     9     private int qreply;
    10     private int show;
    11     private int total;
    12     public int getComment_status() {
    13         return comment_status;
    14     }
    15     public void setComment_status(int comment_status) {
    16         this.comment_status = comment_status;
    17     }
    18     public int getPraise() {
    19         return praise;
    20     }
    21     public void setPraise(int praise) {
    22         this.praise = praise;
    23     }
    24     public int getDispraise() {
    25         return dispraise;
    26     }
    27     public void setDispraise(int dispraise) {
    28         this.dispraise = dispraise;
    29     }
    30     public int getQreply() {
    31         return qreply;
    32     }
    33     public void setQreply(int qreply) {
    34         this.qreply = qreply;
    35     }
    36     public int getShow() {
    37         return show;
    38     }
    39     public void setShow(int show) {
    40         this.show = show;
    41     }
    42     public int getTotal() {
    43         return total;
    44     }
    45     public void setTotal(int total) {
    46         this.total = total;
    47     }
    48     @Override
    49     public String toString() {
    50         return "CommentCountInfo [comment_status=" + comment_status
    51                 + ", praise=" + praise + ", dispraise=" + dispraise
    52                 + ", qreply=" + qreply + ", show=" + show + ", total=" + total
    53                 + "]";
    54     }
    55     
    56 }
    MyContent
     1 package com.cp.vo;
     2 
     3 import java.util.List;
     4 
     5 public class MyContent {
     6     private String is_intro;
     7     private List<NewsList> list;
     8     public List<NewsList> getList() {
     9         return list;
    10     }
    11     public void setList(List<NewsList> list) {
    12         this.list = list;
    13     }
    14     public String getIs_intro() {
    15         return is_intro;
    16     }
    17     public void setIs_intro(String is_intro) {
    18         this.is_intro = is_intro;
    19     }
    20     @Override
    21     public String toString() {
    22         return "MyContent [is_intro=" + is_intro + ", list=" + list + "]";
    23     }
    24     
    25 }
    MyData
     1 package com.cp.vo;
     2 
     3 public class MyData {
     4     private MyContent data;
     5     private int status;
     6     public MyContent getData() {
     7         return data;
     8     }
     9     public void setData(MyContent data) {
    10         this.data = data;
    11     }
    12     public int getStatus() {
    13         return status;
    14     }
    15     public void setStatus(int status) {
    16         this.status = status;
    17     }
    18     @Override
    19     public String toString() {
    20         return "MyData [data=" + data + ", status=" + status + "]";
    21     }
    22     
    23     
    24 }
    MyPics
     1 package com.cp.vo;
     2 
     3 import java.io.Serializable;
     4 import java.util.List;
     5 
     6 public class MyPics implements Serializable{
     7     private List<Pics> list;
     8     private int picTemplate;
     9     private int total;
    10     public List<Pics> getList() {
    11         return list;
    12     }
    13     public void setList(List<Pics> list) {
    14         this.list = list;
    15     }
    16     public int getPicTemplate() {
    17         return picTemplate;
    18     }
    19     public void setPicTemplate(int picTemplate) {
    20         this.picTemplate = picTemplate;
    21     }
    22     public int getTotal() {
    23         return total;
    24     }
    25     public void setTotal(int total) {
    26         this.total = total;
    27     }
    28     @Override
    29     public String toString() {
    30         return "MyPics [list=" + list + ", picTemplate=" + picTemplate
    31                 + ", total=" + total + "]";
    32     }
    33     
    34 }
    NewsList
      1 package com.cp.vo;
      2 
      3 import java.io.Serializable;
      4 
      5 import com.lidroid.xutils.db.annotation.Id;
      6 
      7 public class NewsList implements Serializable {
      8     @Id
      9     private int n_id;
     10     private int articlePubDate;
     11     private String bpic;
     12     private String category;
     13     private int comment;
     14     private CommentCountInfo comment_count_info;
     15     private String comments;
     16     private String feedShowStyle;
     17     private String id;
     18     private String intro;
     19     private String kpic;
     20     private String link;
     21     private String long_title;
     22     private String pic;
     23     private MyPics pics;
     24     private long pubDate;
     25     private String source;
     26     private String title;
     27     public int getArticlePubDate() {
     28         return articlePubDate;
     29     }
     30     public void setArticlePubDate(int articlePubDate) {
     31         this.articlePubDate = articlePubDate;
     32     }
     33     public String getBpic() {
     34         return bpic;
     35     }
     36     public void setBpic(String bpic) {
     37         this.bpic = bpic;
     38     }
     39     public String getCategory() {
     40         return category;
     41     }
     42     public void setCategory(String category) {
     43         this.category = category;
     44     }
     45     public int getComment() {
     46         return comment;
     47     }
     48     public void setComment(int comment) {
     49         this.comment = comment;
     50     }
     51     public CommentCountInfo getComment_count_info() {
     52         return comment_count_info;
     53     }
     54     public void setComment_count_info(CommentCountInfo comment_count_info) {
     55         this.comment_count_info = comment_count_info;
     56     }
     57     public String getComments() {
     58         return comments;
     59     }
     60     public void setComments(String comments) {
     61         this.comments = comments;
     62     }
     63     public String getFeedShowStyle() {
     64         return feedShowStyle;
     65     }
     66     public void setFeedShowStyle(String feedShowStyle) {
     67         this.feedShowStyle = feedShowStyle;
     68     }
     69     public String getId() {
     70         return id;
     71     }
     72     public void setId(String id) {
     73         this.id = id;
     74     }
     75     public String getIntro() {
     76         return intro;
     77     }
     78     public void setIntro(String intro) {
     79         this.intro = intro;
     80     }
     81     public String getKpic() {
     82         return kpic;
     83     }
     84     public void setKpic(String kpic) {
     85         this.kpic = kpic;
     86     }
     87     public String getLink() {
     88         return link;
     89     }
     90     public void setLink(String link) {
     91         this.link = link;
     92     }
     93     public String getLong_title() {
     94         return long_title;
     95     }
     96     public void setLong_title(String long_title) {
     97         this.long_title = long_title;
     98     }
     99     public String getPic() {
    100         return pic;
    101     }
    102     public void setPic(String pic) {
    103         this.pic = pic;
    104     }
    105     public MyPics getPics() {
    106         return pics;
    107     }
    108     public void setPics(MyPics pics) {
    109         this.pics = pics;
    110     }
    111     public long getPubDate() {
    112         return pubDate;
    113     }
    114     public void setPubDate(long pubDate) {
    115         this.pubDate = pubDate;
    116     }
    117     public String getSource() {
    118         return source;
    119     }
    120     public void setSource(String source) {
    121         this.source = source;
    122     }
    123     public String getTitle() {
    124         return title;
    125     }
    126     public void setTitle(String title) {
    127         this.title = title;
    128     }
    129     
    130 }
    Pics
     1 package com.cp.vo;
     2 
     3 import java.io.Serializable;
     4 
     5 public class Pics implements Serializable {
     6     private String alt;
     7     private String kpic;
     8     private String pic;
     9     public String getAlt() {
    10         return alt;
    11     }
    12     public void setAlt(String alt) {
    13         this.alt = alt;
    14     }
    15     public String getKpic() {
    16         return kpic;
    17     }
    18     public void setKpic(String kpic) {
    19         this.kpic = kpic;
    20     }
    21     public String getPic() {
    22         return pic;
    23     }
    24     public void setPic(String pic) {
    25         this.pic = pic;
    26     }
    27     @Override
    28     public String toString() {
    29         return "Pics [alt=" + alt + ", kpic=" + kpic + ", pic=" + pic + "]";
    30     }
    31     
    32     
    33 }
  • 相关阅读:
    “校园知网”5月11日冲刺计划书
    “校园知网”5月10日冲刺计划书
    “校园知网”5月9日冲刺计划书
    学习进度
    “校园知网”5月8日冲刺计划书
    “校园知网”5月7日冲刺计划书
    “校园知网”5月6日冲刺计划书
    “校园知网”5月5日冲刺计划书
    “校园知网”5月4日冲刺计划书
    04-课后作业2-动手动脑及String类整理
  • 原文地址:https://www.cnblogs.com/biguncle/p/5114085.html
Copyright © 2011-2022 走看看