0

Hi In my application i have one login form based on username display all the data in edittext same like that in database I have all the details with image.All the data display correctly and image not displaying for that I used this url

http://domainname/xxxxxxx/folder/a.jpg

But above image is displaying correctly But I want based on username I want to display which image is in database I want to display that image

can any one help me

String picture1= json.getString("picture");
                     studentpic1=(ImageView) findViewById(R.id.imageView1);

                        String image_url = "http://xxxxx/xxx/xxxx/".concat(picture1);
                        ImageLoader imgLoader = new ImageLoader(getApplicationContext());
                        imgLoader.DisplayImage(image_url, 0, studentpic1);
master123
  • 37
  • 1
  • 1
  • 6

3 Answers3

0

Dont directly save the image in the db.Store its path and at the time of retriving display the imaging via parsing the path

Anuj
  • 402
  • 8
  • 16
  • saving all the images in folder same like that I did but url How to mention that one I don't no – master123 Nov 27 '14 at 12:08
  • If u saving the path in the db then u can easily get the file from the path – Anuj Nov 27 '14 at 12:09
  • Not path directly image saving in database – master123 Nov 27 '14 at 12:14
  • In database a.jpg like this image I want to display that image in android imageview – master123 Nov 27 '14 at 12:21
  • thats what i am saying get the path of a.jpg and store it in the data base.While displaying the image in the imageView get that path from the database and parse it and show in the image view – Anuj Nov 27 '14 at 12:22
  • like that I did I created one folder In that it will save all the images and storing in database only like this imagename.jpg now how to mention that one I am asking – master123 Nov 27 '14 at 12:27
  • small doubt from json I am getting that name of the image and in url I wrote like this http://domainname/mainfolder/subfolder/".concat(String.valueOf(picture1)) – master123 Nov 27 '14 at 12:36
0

Please get the exact path and do something like this

File imgFile = new  File("/sdcard/Images/test_image.jpg");

if(imgFile.exists()){

    Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());

    ImageView myImage = (ImageView) findViewById(R.id.imageviewTest);

    myImage.setImageBitmap(myBitmap);

}
Anuj
  • 402
  • 8
  • 16
0

I think this example will helps you Click here

    public void onClick(View arg0) {

    if(btnretrive==arg0)
    {
            String[] col={"image"};
            c=db.query("tableimage", col, null, null, null, null, null);

            if(c!=null){
                c.moveToFirst();
                do{
                    img=c.getBlob(c.getColumnIndex("image"));
                   }while(c.moveToNext());
            }
            Bitmap b1=BitmapFactory.decodeByteArray(img, 0, img.length);

             imageview.setImageBitmap(b1);
             Toast.makeText(this, "Retrive successfully", Toast.LENGTH_SHORT).show();
        }
    }
krishnan muthiah pillai
  • 2,711
  • 2
  • 29
  • 35