Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i can't show image in my storage and ImageView i write same code like you but its haven't work #3

Open
jcredking opened this issue May 10, 2018 · 1 comment

Comments

@jcredking
Copy link

Button b1 = (Button)findViewById(R.id.imagebtn1);
b1.setOnClickListener(new View.OnClickListener() {
@OverRide
public void onClick(View v) {
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,"select image"),RESULT_LOAD_IMAGE);
}
});
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == RESULT_LOAD_IMAGE && requestCode== RESULT_OK && data.getData() !=null){
selectimage = data.getData();
try {
Bitmap bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(),selectimage);
imageE.setImageBitmap(bitmap);
selectImage();
} catch (IOException e) {
e.printStackTrace();
}
}

    super.onActivityResult(requestCode, resultCode, data);
}

public void selectImage(){
StorageReference imageReference = storageReference.child(firebaseAuth.getUid()).child("Image").child("Selected Imaage");
UploadTask uploadTask = imageReference.putFile(selectimage);
uploadTask.addOnFailureListener(new OnFailureListener() {
@OverRide
public void onFailure(@nonnull Exception e) {
Toast.makeText(nav.this,"Image cant slecting",Toast.LENGTH_SHORT).show();
}
}).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
@OverRide
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
Toast.makeText(nav.this,"Image Selected Sucessfuly",Toast.LENGTH_SHORT).show();
}
});
}

@jcredking
Copy link
Author

how to solve this ????

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant