Wednesday, 13 April 2011

Click the Button and open Image Gallery

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;

public class tuesdayAppli extends Activity {
    private static final int SELECT_PICTURE = 1;
/** Called when the activity is first created. */
Button button1;
    public void onCreate(Bundle savedInstanceState) {
        button1.setOnClickListener(new OnClickListener() {


public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent = new Intent();
"Select Picture"), SELECT_PICTURE);
        protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
          switch(requestCode) {
          case SELECT_PICTURE: // our request code
           if(resultCode == Activity.RESULT_OK)
           { // result was ok
           Uri selectedImage = data.getData();
           Intent i = new Intent(getApplicationContext(),ImageView.class);

               // ----------------- Problem Area -----------------
               // I would like to send the filename to the Intent object, and send it over.
               // However, the selectedImage.toString() method will return a
               // "content://" string instead of a file location.  How do I get a file
               // location from that URI object?
               i.putExtra("PICTURE_LOCATION", selectedImage.toString());

               // Start the activity outlined with the Intent above:


  1. hi saga,

    could u pls give me ur email address??

    is this image gallery taking images from net??

    where did u specify the url path??


  2. I simply want to say I’m very new to blogs and actually loved you’re blog site. Almost certainly I’m going to bookmark your blog post . You absolutely come with great well written articles. Thanks a lot for sharing your blog.
    android development course fees in chennai | android app development training in chennai|Android Training institute in chennai with placement

  3. Inspiring writings and I greatly admired what you have to say , I hope you continue to provide new ideas for us all and greetings success always for you..Keep update more information..

    rpa Training in Chennai

    rpa Training in bangalore

    rpa Training in pune

    blueprism Training in Chennai

    blueprism Training in bangalore

    blueprism Training in pune

    rpa online training

  4. UiPath Training in Bangalore by myTectra is one the best UiPath Training. myTectra is the market leader in providing Robotic Process Automation on UiPath
    ui path training in bangalore

  5. I am really happy with your blog because your article is very unique and powerful for new reader.
    Click here:
    selenium training in chennai
    selenium training in bangalore
    selenium training in Pune
    selenium training in pune
    Selenium Online Training