Basically all I want do is pick an image from the gallery and then the same image upload it to my Cloudinary account, I've seen the documentation from Cloudinary but I don't really understand how it works therefore don't know how to implement that in my code.
Here is the link where I got the information in case someone need it... https://github.com/cloudinary/cloudinary_java/tree/master/cloudinary-android
And this is what I have so far...
upload_image.class
public class edit_profile_activity extends AppCompatActivity
{
private static int RESULT_LOAD_IMG = 1;
String imgDecodableString;
public void loadImagefromGallery(View view)
{
Intent galleryIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(galleryIntent, RESULT_LOAD_IMG);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
try
{
if (requestCode == RESULT_LOAD_IMG && resultCode == RESULT_OK && null != data)
{
Uri selectedImage = data.getData();
String[] filePathColumn = { MediaStore.Images.Media.DATA };
Cursor cursor = getContentResolver().query(selectedImage,filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
imgDecodableString = cursor.getString(columnIndex);
cursor.close();
ImageView imgView = (ImageView) findViewById(R.id.circleImageView );
imgView.setImageBitmap(BitmapFactory.decodeFile(imgDecodableString));
} else {
Toast.makeText(this, "You haven't picked Image",Toast.LENGTH_LONG).show();
}
} catch (Exception e)
{
Toast.makeText(this, "Something went wrong", Toast.LENGTH_LONG) .show();
}
}
}
Any help will be appreciated