@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.btn_adharFrontUploadId:
pickImage();
loadAdharFrontImage();
break;
case btn_adharBackUploadId:
pickImage();
loadAdharBackImage();
break;
}
}
it displays two different images from device. I wrote the method as follows
private void loadAdharBackImage() {
new Thread() {
public void run() {
while (i++ < 1000) {
try {
runOnUiThread(new Runnable() {
@Override
public void run() {
iv_adharBack.setImageBitmap(decodedWebP);
}
});
sleep(300);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}.start();
}
private void loadAdharFrontImage() {
new Thread() {
public void run() {
while (i++ < 1000) {
try {
runOnUiThread(new Runnable() {
@Override
public void run() {
iv_adharFront.setImageBitmap(decodedWebP);
}
});
sleep(300);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}.start();
}
when i select the first image by clicking on first button, it loads the first imageview as usual, but when i click the second button, it loads the first selected image in the second imageview instantaneously, and upon select the second image, the first imageview also changes to the second selected image.Please give me a solution for this. i am very new to android and programming. Any help will be appreciated
Thank you for the support folks...finally i got answer. No need to use the runnable mentioned in my question. Here i can make the code to fetch images for different imageViews. Thanks again
Here i can use the same code to compress my images and load them to imageViews