Android Open Source - PictureBookReader Online Book Adapter

From Project

Back to project page PictureBookReader.


The source code is released under:

GNU General Public License

If you think the Android project PictureBookReader listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package net.uyghurdev.avaroid.picturebookreader;
/* www  . j  a  va2s .c o m*/
import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class OnlineBookAdapter extends BaseAdapter {
  private Activity activity;
  private ArrayList<Book> map;
  private static LayoutInflater inflater = null;
  public OnlineBookAdapter(Activity a, ArrayList<Book> books){
    activity = a;
    map = books;
    inflater = (LayoutInflater) activity

  public int getCount() {
    // TODO Auto-generated method stub
    return map.size();

  public Object getItem(int position) {
    // TODO Auto-generated method stub
    return map.get(position);

  public long getItemId(int position) {
    // TODO Auto-generated method stub
    return position;

  public View getView(int position, View convertView, ViewGroup parent) {
    // TODO Auto-generated method stub
    View vi = convertView;
    if (convertView == null) {
      vi = inflater.inflate(, null);
    TextView title=(TextView)vi.findViewById(;
    TextView author=(TextView)vi.findViewById(;
    TextView description=(TextView)vi.findViewById(;
    TextView size=(TextView)vi.findViewById(;
    ImageView bookCover = (ImageView)vi.findViewById(;
    author.setText(activity.getString( + " " + map.get(position).getAuthor());
    description.setText(activity.getString(R.string.description) + " " + map.get(position).getDescription());
    size.setText(activity.getString(R.string.size) + " " + map.get(position).getSize());
    if (new File("/sdcard/").exists()
        && new File("/sdcard/").isDirectory()) {
      ImageLoader imageLoader = new ImageLoader(activity);
      imageLoader.DisplayImage(Configs.BookImg + map.get(position).getCoverImg(),
          activity, bookCover);
    } else {
      bookCover.setImageBitmap(BitmapFactory.decodeFile(Configs.BookImg + map.get(position).getCoverImg()));
    return vi;

Java Source Code List