Pick an image from gallery and save it in db

All your problems with Audio, Video and Images.

Pick an image from gallery and save it in db

Postby andreider » Tue Nov 02, 2010 9:59 pm

I have a problem with image and db. I would like to pick an image from gallery and save it in my db. I use this code:
Code: Select all
editimg.setOnClickListener(new View.OnClickListener(){

                @Override
                public void onClick(View v) {
                    //open gallery         
                         Intent i = new Intent( Intent.ACTION_PICK, MediaStore.Images.Media.INTERNAL_CONTENT_URI );
                     startActivityForResult( i, IMAGE_FROM_GALLERY );
       
                        }}       
                );

Next i save the image in the db trought my method
Code: Select all
@Override
        protected void onActivityResult ( int requestCode, int resultCode, Intent data ) {

        if ( requestCode == IMAGE_FROM_GALLERY ) {

                        if ( resultCode == RESULT_OK ) {
                                Uri selectedImage = data.getData();
                                db.insertImg(selectedImage.toString());

                        }
                        ((ImageView)findViewById(R.id.image)).setImageURI(Uri.parse(MyDatabase.Match.IMAGE));

                        }


                super.onActivityResult( requestCode, resultCode, data );

i dont understand because this code dont run..i havent errors but the image dont appears
andreider
Freshman
Freshman
 
Posts: 2
Joined: Tue Nov 02, 2010 9:46 pm

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 22 guests