android how to add browse button?
<p>I followed <a href="http://androidhub4you.blogspot.com/2012/09/hello-friends-today-i-am-going-to-share.html" rel="nofollow">this tutorial</a>.</p>

<p>This help me to insert image in database. But this code insert hard coded same image again and again into database.</p>

<p>How do I modify this code to allow me to upload a photo of my choice from memory by click browse button and textview  of my own  choice?</p>

<pre><code>  import java.io.ByteArrayOutputStream;
  import java.util.ArrayList;
  import java.util.List;

   import android.app.Activity;
    import android.graphics.Bitmap;
    import android.graphics.BitmapFactory;
     import android.os.Bundle;
    import android.util.Log;
     import android.widget.ListView;

    public class SQLiteDemoActivity extends Activity {
     ArrayList&lt;Contact&gt; imageArry = new ArrayList&lt;Contact&gt;();
  ContactImageAdapter adapter;

    /** Called when the activity is first created. */
    @Override
     public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

     DataBaseHandler db = new DataBaseHandler(this);
    //get image from drawable
    Bitmap image = BitmapFactory.decodeResource(getResources(),
   R.drawable.facebook);

    //convert bitmap to byte
     ByteArrayOutputStream stream = new ByteArrayOutputStream();
    image.compress(Bitmap.CompressFormat.JPEG, 100, stream);
   byte imageInByte[] = stream.toByteArray();
    /**
    * CRUD Operations
   * */
     //Inserting Contacts
  Log.d("Insert: ", "Inserting ..");
   db.addContact(new Contact("FaceBook", imageInByte));
  //display main List view bcard and contact name

  //Reading all contacts from database
     List&lt;Contact&gt; contacts = db.getAllContacts();
  for (Contact cn : contacts) {
    String log = "ID:" + cn.getID() + " Name: " + cn.getName()
   + " ,Image: " + cn.getImage();

 //Writing Contacts to log
    Log.d("Result: ", log);
   //add contacts data in arrayList
    imageArry.add(cn);

    }
      adapter = new ContactImageAdapter(this, R.layout.screen_list,
    imageArry);
    ListView dataList = (ListView) findViewById(R.id.list);
   dataList.setAdapter(adapter);
  }
     }










       public class Contact {

// private variables
int _id;
String _name;
byte[] _image;

// Empty constructor
public Contact() {

}

// constructor
public Contact(int keyId, String name, byte[] image) {
this._id = keyId;
this._name = name;
this._image = image;

}

// constructor
public Contact(String contactID, String name, byte[] image) {
this._name = name;
this._image = image;

}

// constructor
public Contact(String name, byte[] image) {
this._name = name;
this._image = image;
}

// getting ID
public int getID() {
return this._id;
}

// setting id
public void setID(int keyId) {
this._id = keyId;
}

// getting name
public String getName() {
return this._name;
}

// setting name
public void setName(String name) {
this._name = name;
}

// getting phone number
public byte[] getImage() {
return this._image;
}

// setting phone number
public void setImage(byte[] image) {
this._image = image;
}









 import java.io.ByteArrayInputStream;
  import java.util.ArrayList;

  import android.app.Activity;
 import android.content.Context;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

  public class ContactImageAdapter extends ArrayAdapter&lt;Contact&gt;{
  Context context;
  int layoutResourceId;
  //BcardImage data[] = null;
 ArrayList&lt;Contact&gt; data=new ArrayList&lt;Contact&gt;();
 public ContactImageAdapter(Context context, int layoutResourceId, 
ArrayList&lt;Contact&gt;    data) {
super(context, layoutResourceId, data);
this.layoutResourceId = layoutResourceId;
this.context = context;
 this.data = data;
 }

 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
 View row = convertView;
 ImageHolder holder = null;
 if(row == null)
 {
 LayoutInflater inflater = ((Activity)context).getLayoutInflater();
 row = inflater.inflate(layoutResourceId, parent, false);
 holder = new ImageHolder();
 holder.txtTitle = (TextView)row.findViewById(R.id.txtTitle);
   holder.imgIcon = (ImageView)row.findViewById(R.id.imgIcon);
  row.setTag(holder);
 }
  else
 {
  holder = (ImageHolder)row.getTag();
  }
 Contact picture = data.get(position);
 holder.txtTitle.setText("facebook");
 //convert byte to bitmap take from contact class
 byte[] outImage=picture._image;
 ByteArrayInputStream imageStream = new ByteArrayInputStream(outImage);
 Bitmap theImage = BitmapFactory.decodeStream(imageStream);
  holder.imgIcon.setImageBitmap(theImage);
 return row;
  }
static class ImageHolder
  {
 ImageView imgIcon;
 TextView txtTitle;
 }
 } 






      import java.io.ByteArrayInputStream;
  import java.util.ArrayList;

 import android.app.Activity;
 import android.content.Context;
 import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

  public class ContactImageAdapter extends ArrayAdapter&lt;Contact&gt;{
 Context context;
  int layoutResourceId;
//BcardImage data[] = null;
 ArrayList&lt;Contact&gt; data=new ArrayList&lt;Contact&gt;();
 public ContactImageAdapter(Context context, int layoutResourceId, 
 ArrayList&lt;Contact&gt;    data) {
super(context, layoutResourceId, data);
this.layoutResourceId = layoutResourceId;
this.context = context;
  this.data = data;
  }

 @Override
  public View getView(int position, View convertView, ViewGroup parent) {
View row = convertView;
    ImageHolder holder = null;
    if(row == null)
    {
  LayoutInflater inflater = ((Activity)context).getLayoutInflater();
     row = inflater.inflate(layoutResourceId, parent, false);
   holder = new ImageHolder();
    holder.txtTitle = (TextView)row.findViewById(R.id.txtTitle);
    holder.imgIcon = (ImageView)row.findViewById(R.id.imgIcon);
      row.setTag(holder);
  }
   else
   {
    holder = (ImageHolder)row.getTag();
 }
   Contact picture = data.get(position);
    holder.txtTitle.setText("facebook");
  //convert byte to bitmap take from contact class
   byte[] outImage=picture._image;
   B yteArrayInputStream imageStream = new ByteArrayInputStream(outImage);
   Bitmap theImage = BitmapFactory.decodeStream(imageStream);
   holder.imgIcon.setImageBitmap(theImage);
   return row;
  }
  static class ImageHolder
    {
     ImageView imgIcon;
   TextView txtTitle;
  }
      }
</code></pre>
