How to send image one activity to another activity? - android

I am new in android.i want to pass image in one activity to another activity.I tried many time.but my app gonna crash.plz edit my code with necessary changes.
Sender activity:
camera=(ImageButton)findViewById(R.id.camera);
gallery=(ImageButton)findViewById(R.id.gallery);
camera.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Intent i =new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA);
startActivityForResult(i, 50);
}
});
gallery.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Intent pickPhoto = new Intent(Intent.ACTION_PICK,
android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(pickPhoto , 40);
}
});
}
Receiver activity:
package com.androidlink.navigation_bottom;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ImageView;
public class Image_set_Activity extends AppCompatActivity
{
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_image_set_);
ImageView IV = (ImageView) findViewById(R.id.simpleImageView);
}
}

Try to override onActivityResult(). For further reading - https://developer.android.com/training/basics/intents/result

Try this code For sending the image
ImageView imageview = (ImageView) findViewById(R.id.Tab);
BitmapDrawable drawable = (BitmapDrawable) imageView.getDrawable();
Bitmap bitmap = drawable.getBitmap();
final byte[] arr = bitmap.getNinePatchChunk();
imageView.setOnClickListener(View v)
{
Intent intent = new Intent (MainActivity.this,bbb.class);
Intent.putExtra(“image”,arr);
startActivity(intent);
}
For getting the image
Intent I = getIntent();
byte[] arr1 = i.getByteArrayExtra(“image”);
Bitmap map = BitmapFactory.decodeByteArray(arr,0,arr.length);
imageView.setImageBitmap(map);

Related

send image as a bit map (By Intent or Sharedpreference)

I want to pass image in one activity to another activity.I tried many time.but my app gonna crash.plz edit my code with necessary changes.
Sender activity:
camera=(ImageButton)findViewById(R.id.camera);
gallery=(ImageButton)findViewById(R.id.gallery);
camera.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Intent i =new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA);
startActivityForResult(i, 50);
}
});
gallery.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Intent pickPhoto = new Intent(Intent.ACTION_PICK,
android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(pickPhoto , 40);
}
});
}
Receiver activity:
package com.androidlink.navigation_bottom;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ImageView;
public class Image_set_Activity extends AppCompatActivity
{
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_image_set_);
ImageView IV = (ImageView) findViewById(R.id.simpleImageView);
}
}
in onActivityResult
Bitmap photo = (Bitmap) data.getExtras().get("data");
Log.d("===uploadPhoto","camera : "+photo);
*//* Passing BITMAP to the Second Activity *//*
Intent intentCamera = new Intent(this, SecondAvtivity.class);
IntentCamera.putExtra("BitmapImage", photo);
startActivity(intentCamera);
in seconActivity
Bitmap fromCamera = getIntent().getParcelableExtra("BitmapImage");
imageView.setImageBitmap(fromCamera)
Try to Use This Code
Frist Classs
ImageView img=findViewById(R.id.imgId);
BitmapDrawable bmd= (BitmapDrawable) img.getDrawable();
Bitmap bt= bmd.getBitmap();
final byte[] imgarry = bt.getNinePatchChunk();
Intent intent = new Intent (FirstClass.this,SecondClass.class);
Intent.putExtra(“imgs”,imgarry);
startActivity(intent);
Second Class
Intent in = getIntent();
byte[] ary= in.getByteArrayExtra(“imgs”);
Bitmap bm= BitmapFactory.decodeByteArray(ary,0,ary.length);
imageView.setImageBitmap(bm);

Android studios - How to pass image from gallery to another activity

I rarely ask on stackoverflow, but I asked a questions recently and got a great answer! so I'll try again!
I've been working on a very simple photofilter app that adds the effect through code.
What I've been struggling with is to send a picture from whenever I open up gallery to choose a picture to another activity. I mean, I would like to choose a image from gallery, then send it to a preview activity.
Whenever I take a photo from the camera, it works and I get the photo with the added filter, but my problem is that whenever I choose an image from gallery, my app crashes. I tried to use URI instead but it didn't turn out well so I rather convert the picture I take to a bitmap and thereafter send it to the activity. Could anyone help me with this please?
Thank you!
MainAcitivty
package com.example.alek.leszealots;
import java.io.File;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.content.Intent;
import android.net.Uri;
public class MainActivity extends AppCompatActivity {
//Deklarasjoner for fremtidlig var
Button galleryButton;
Button cameraButton;
public static final int PICK_IMAGE = 1;
private static final int CAMERA_REQUEST = 1;
Bitmap thumbnail;
int CAPTURE_REQUEST;
Uri thumbFile;
File mTempFile;
int REQUEST_CODE_CHOOSE_PICTURE = 1;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Gjør klar menu knappene
galleryButton = (Button) findViewById(R.id.button);
cameraButton = (Button) findViewById(R.id.button2);
//Gallery knapp
galleryButton.setOnClickListener(new Button.OnClickListener() {
#Override
public void onClick(View view) {
/*Intent getIntent = new Intent(Intent.ACTION_GET_CONTENT);
getIntent.setType("image/*");
Intent pickIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
pickIntent.setType("image/*");
Intent chooserIntent = Intent.createChooser(getIntent, "Select Image");
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[] {pickIntent});
startActivityForResult(chooserIntent, PICK_IMAGE);*/
Intent photoPickerIntent = new Intent(Intent.ACTION_GET_CONTENT);
photoPickerIntent.setType("image/*");
photoPickerIntent.putExtra(Intent.EXTRA_LOCAL_ONLY, false);
startActivityForResult(Intent.createChooser(photoPickerIntent,"Complete Action Using"), PICK_IMAGE);
}
});
//Camera knapp
cameraButton.setOnClickListener(new Button.OnClickListener() {
#Override
public void onClick(View view) {
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, CAPTURE_REQUEST);
}
});
}
//Sender lagret bilde i bitmap til sendImage som deretter sender videre til NextActivity i extra
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
if (requestCode == CAPTURE_REQUEST) {
thumbnail = (Bitmap) data.getExtras().get("data");
sendImage();
}
else if (requestCode == PICK_IMAGE) {
thumbnail = (Bitmap) data.getExtras().get("data");
sendImage();
}
}
}
private void sendImage() {
Intent intent = new Intent(MainActivity.this, NextActivity.class);
intent.putExtra("image", thumbnail);
startActivity(intent);
}
}
NextActivity
package test.test;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.ColorMatrix;
import android.graphics.ColorMatrixColorFilter;
import android.graphics.Paint;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
public class NextActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_next);
ImageView imageView = (ImageView) findViewById(R.id.imageView);
//Ser ut som denne kan ta imot fra Gallery option også.
Bundle extras = getIntent().getExtras();
if (extras != null) {
Bitmap image = (Bitmap) extras.get("image");
if (image != null) {
imageView.setImageBitmap(changeBitmapContrastBrightness(image, 20, -255));
}
}
}
public static Bitmap changeBitmapContrastBrightness(Bitmap bmp, float contrast, float brightness)
{
ColorMatrix cm = new ColorMatrix(new float[]
{
contrast, 0, 0, 0, brightness,
0, contrast, 0, 0, brightness,
0, 0, contrast, 0, brightness,
0, 0, 0, 1, 0
});
Bitmap ret = Bitmap.createBitmap(bmp.getWidth(), bmp.getHeight(), bmp.getConfig());
Canvas canvas = new Canvas(ret);
Paint paint = new Paint();
paint.setColorFilter(new ColorMatrixColorFilter(cm));
canvas.drawBitmap(bmp, 0, 0, paint);
return ret;
}
}
activity_next
<ImageView
android:id="#+id/imageView"
android:layout_width="330dp"
android:layout_height="369dp"
app:srcCompat="#mipmap/ic_launcher"
tools:layout_editor_absoluteX="38dp"
tools:layout_editor_absoluteY="37dp" />
</android.support.constraint.ConstraintLayout>
activity_main
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="#+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
tools:layout_editor_absoluteX="105dp"
tools:layout_editor_absoluteY="189dp" />
</android.support.constraint.ConstraintLayout>
Edit:
https://pastebin.com/Ukc2Ui4g

Clear variable when Android back button is clicked

I have an app where I would like to be able to click on a button, A, and show a certain set of information. Then click the back button and click on button B and show a different set of information. I have coded a test TextView into the Drinks.java file in order to begin the process by confirming what is being passed along. Currently whatever button I push first is getting stuck in the variable. So for example if I push button A, then push the back arrow and push button B, button A is still showing up in the textView. I tried making the Strings empty within the on click listener, to "clear them out" as it were, but that isn't working. Is there a way to wipe out what is in the variable and reassign something else? Or does my problem lie elsewhere?
Bar.java
import android.app.Activity;
import android.content.Context;
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;
import android.widget.TextView;
public class Bar extends Activity{
String setBarTest = MainActivity.setBar;
String barNameHolder, picHolder, barContactHolder, barPhoneHolder;
int imageInt, textInt1,textInt2, textInt3;
TextView setBarName, setBarContact,setBarPhone;
ImageView barPic;
Button viewAll, beer, wine, mixedDrinks, other, getTaxi;
static String setDrinkType = "";
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_bar);
Button viewAll = (Button)findViewById(R.id.btnviewAll);
Button beer = (Button)findViewById(R.id.btnBeer);
Button wine = (Button)findViewById(R.id.btnWine);
Button mixedDrinks = (Button)findViewById(R.id.btnMixedDrinks);
Button other = (Button)findViewById(R.id.btnOther);
Button getTaxi = (Button)findViewById(R.id.btnTaxi);
barPic = (ImageView) findViewById(R.id.barPic);
String picHolder = "drawable/"+setBarTest;
int imageInt = getResources().getIdentifier(picHolder, null, getPackageName());
barPic.setImageResource(imageInt);
setBarName = (TextView)findViewById(R.id.barName);
String barNameHolder = "#string/"+setBarTest;
int textInt1 = getResources().getIdentifier(barNameHolder, null, getPackageName());
setBarName.setText(textInt1);
setBarContact = (TextView)findViewById(R.id.barContact);
String barContactHolder = "#string/"+setBarTest+"Contact";
int textInt2 = getResources().getIdentifier(barContactHolder, null, getPackageName());
setBarContact.setText(textInt2);
setBarPhone = (TextView)findViewById(R.id.barPhone);
String barPhoneHolder = "#string/"+setBarTest+"Phone";
int textInt3 = getResources().getIdentifier(barPhoneHolder, null, getPackageName());
setBarPhone.setText(textInt3);
viewAll.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
Intent i = (new Intent(Bar.this, Drinks.class));
startActivity(i);
}
});
beer.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
setDrinkType = "";
setDrinkType = "Beer";
Intent i = (new Intent(Bar.this, Drinks.class));
startActivity(i);
}
});
wine.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
setDrinkType = "";
setDrinkType = "Wine";
Intent i = (new Intent(Bar.this, Drinks.class));
startActivity(i);
}
});
mixedDrinks.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
setDrinkType = "";
setDrinkType = "Mixed Drink";
Intent i = (new Intent(Bar.this, Drinks.class));
startActivity(i);
}
});
other.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
setDrinkType = "";
setDrinkType = "Other";
Intent i = (new Intent(Bar.this, Drinks.class));
startActivity(i);
}
});
getTaxi.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
Intent i = (new Intent(Bar.this, Taxi.class));
startActivity(i);
}
});
}
}
Drinks.java
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class Drinks extends Activity{
TextView drinkHolder;
public static String drinkType = Bar.setDrinkType;
String drinkTestHolder="";
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_drinks);
drinkTestHolder = drinkType;
drinkHolder = (TextView)findViewById(R.id.drinkTest);
//String barNameHolder = "#string/"+drinkType;
//int textInt1 = getResources().getIdentifier(barNameHolder, null, getPackageName());
drinkHolder.setText(drinkTestHolder);
}
}
Please, use instead for instance the intent sent to the launching Activity:
How do I get extra data from intent on Android?

Image passing from one activity to another using extras

Would anyone tell me how to pass images from one activity to another activity using extras (the idea is). I am displaying a set of images in activity1 as a horizontal scroll view. When I click on an image it should be displayed in another activity (activity2) with totally different layout.
I'll be satisfied if the explanation is done with json as well I have tried this (http://www.vogella.com/tutorials/AndroidIntent/article.html) tutorial but can't really find the answer.
MAIN ACTIVITY:
package com.example.user.horizontal;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
public class MainActivity extends Activity implements OnClickListener {
ImageView Display;
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ImageView im1 = (ImageView) findViewById(R.id.image1);
ImageView im2 = (ImageView) findViewById(R.id.image2);
ImageView im3 = (ImageView) findViewById(R.id.image3);
ImageView im4 = (ImageView) findViewById(R.id.image4);
ImageView im5 = (ImageView) findViewById(R.id.image5);
ImageView im6 = (ImageView) findViewById(R.id.image6);
ImageView im7 = (ImageView) findViewById(R.id.image7);
im1.setOnClickListener(this);
im2.setOnClickListener(this);
im3.setOnClickListener(this);
im4.setOnClickListener(this);
im5.setOnClickListener(this);
im6.setOnClickListener(this);
im7.setOnClickListener(this);
}
public void onClick(View v) {
Intent clickimage = new Intent(this, OnClick.class);
switch (v.getId()) {
case R.id.image1:
Display.setImageResource(R.drawable.images1);
clickimage.putExtra("display1", "images1");
startActivity(clickimage);
break;
case R.id.image2:
Display.setImageResource(R.drawable.images2);
clickimage.putExtra("display2", "pic2filename");
startActivity(clickimage);
break;
case R.id.image3:
Display.setImageResource(R.drawable.images8);
clickimage.putExtra("display3", "pic3filename");
startActivity(clickimage);
break;
case R.id.image4:
Display.setImageResource(R.drawable.images4);
clickimage.putExtra("display4", "pic4filename");
startActivity(clickimage);
break;
case R.id.image5:
Display.setImageResource(R.drawable.images5);
clickimage.putExtra("display5", "pic5filename");
startActivity(clickimage);
break;
case R.id.image6:
Display.setImageResource(R.drawable.images6);
clickimage.putExtra("display6", "pic6filename");
startActivity(clickimage);
break;
case R.id.image7:
Display.setImageResource(R.drawable.images8);
clickimage.putExtra("display7", "pic7filename");
startActivity(clickimage);
break;
}
}
SECOND ACTIVITY :
package com.example.user.horizontal;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.widget.ImageView;
public class OnClick extends Activity{
private Bitmap mImage1;
private Bitmap mImage2;
private Bitmap mImage3;
private Bitmap mImage4;
private Bitmap mImage5;
private Bitmap mImage6;
private Bitmap mImage7;
private Bitmap mImage8;
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.onclick);
Bundle bundle = getIntent().getExtras();
String imageName = bundle.getString("display");
// click listeners
ImageView imageView = (ImageView)findViewById(R.id.image1);
mImage1 = BitmapFactory.decodeResource(getResources(), R.drawable.images1);
mImage2 = BitmapFactory.decodeResource(getResources(), R.drawable.images2);
mImage3 = BitmapFactory.decodeResource(getResources(), R.drawable.images4);
mImage4 = BitmapFactory.decodeResource(getResources(), R.drawable.images5);
mImage5 = BitmapFactory.decodeResource(getResources(), R.drawable.images6);
mImage6 = BitmapFactory.decodeResource(getResources(), R.drawable.images7);
mImage7 = BitmapFactory.decodeResource(getResources(), R.drawable.images8);
mImage8 = BitmapFactory.decodeResource(getResources(), R.drawable.images);
if(imageName.matches("images1")) {
String b = bundle.getString("b");
imageView.setImageBitmap(mImage1);
}
else if (imageName.matches("pic2filename")) {
imageView.setImageBitmap(mImage2);
}
else if (imageName.matches("pic3filename")) {
imageView.setImageBitmap(mImage3);
}
else if (imageName.matches("pic4filename")) {
imageView.setImageBitmap(mImage4);
}
else if (imageName.matches("pic2filename")) {
imageView.setImageBitmap(mImage5);
}
else if (imageName.matches("pic5filename")) {
imageView.setImageBitmap(mImage6);
}
else if (imageName.matches("pic6filename")) {
imageView.setImageBitmap(mImage7);
}
else if (imageName.matches("pic7filename")) {
imageView.setImageBitmap(mImage8);
}
}
}
I am new to Java and Android.
Try passing the image file path or image url to next activity using extras in android
Pass Bitmap using intent :
Intent intent = new Intent(this, NewActivity.class);
intent.putExtra("BitmapImage", bitmap);
and retrieve it on the other end:
Intent intent = getIntent();
Bitmap bitmap = (Bitmap) intent.getParcelableExtra("BitmapImage");
Don't pass images between activities.
You should pass the path to image in Intent and show it in your new Activity. This is a correct way to do it.

Android ImageView content disapearing after showing

My application does this: takes a photo, then show the photo in an ImageView. The weird thing is that the photo is displayed for about a second (after taking it with the camera), and then the ImageView is empty again.
This is my code:
publish.xml
<ImageView
android:id="#+id/itemImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
PublishActivity.java
package ar.com.guiagratis;
import java.io.File;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;
public class PublishActivity extends Activity {
final int TAKE_PICTURE_REQUEST_CODE = 115;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.publish);
}
public void btnNextClick(View v) {
// TODO: disable all buttons
//Intent intent=new Intent(getApplicationContext(), TakePhotoActivity.class);
// startActivityForResult(intent, TAKE_PICTURE_RESULT_CODE);
Toast.makeText(getApplicationContext(), "Sacate una foto viteh", Toast.LENGTH_SHORT).show();
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
File photoFile = new File(Environment.getExternalStorageDirectory(), "Photo.png");
Uri imageUri = Uri.fromFile(photoFile);
intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
startActivityForResult(intent, TAKE_PICTURE_REQUEST_CODE);
}
#Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case TAKE_PICTURE_REQUEST_CODE:
if (resultCode == Activity.RESULT_OK) {
File photoFile = new File(Environment.getExternalStorageDirectory(), "Photo.png");
Uri imageUri = Uri.fromFile(photoFile);
// Image captured and saved to fileUri specified in the Intent
Toast.makeText(this, "Image saved to:\n" +
imageUri, Toast.LENGTH_LONG).show();
Bitmap myBitmap = BitmapFactory.decodeFile(imageUri.getPath());
BitmapDrawable ob = new BitmapDrawable(myBitmap);
ImageView myImage = (ImageView) findViewById(R.id.itemImage);
myImage.setBackgroundDrawable(ob);
Toast.makeText(getApplicationContext(), "Qué linda foto! ", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getApplicationContext(), "Hubo un problema al subir la imágen... ", Toast.LENGTH_SHORT).show();
}
}
}
}
Any help will be appreciated.
You're using setBackgroundDrawable(Drawable drawable) which sets the View's background.
If you want to change the ImageView's content you need to use
setImageDrawable(Drawable drawable)
or
setImageBitmap(Bitmap bm)
Ok, I finally found the problem. I was not aware that I need to use onSaveInstanceState and onRestoreInstanceState to store the values I don't want to loose from an Activity when I'm doing certain things, like initiating the Camera and taking a photo.
So I added this code:
#Override
public void onSaveInstanceState(Bundle savedInstanceState) {
super.onSaveInstanceState(savedInstanceState);
// Save UI state changes to the savedInstanceState.
// This bundle will be passed to onCreate if the process is
// killed and restarted.
savedInstanceState.putBoolean("photoUploaded", photoUploaded);
}
#Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
// Restore UI state from the savedInstanceState.
// This bundle has also been passed to onCreate.
photoUploaded = savedInstanceState.getBoolean("photoUploaded");
if (photoUploaded) {
File photoFile = new File(Environment.getExternalStorageDirectory(), "Photo.png");
Uri imageUri = Uri.fromFile(photoFile);
Bitmap myBitmap = BitmapFactory.decodeFile(imageUri.getPath());
BitmapDrawable ob = new BitmapDrawable(myBitmap);
ImageView myImage = (ImageView) findViewById(R.id.uploadedImage);
myImage.setBackgroundDrawable(ob);
}
}
and now is working.
Not sure how to do to make this question as solved.

Categories

Resources