I am blocked my app exit without any notification when I select images but when I select forum photo or gallery did not crashed.
I use creativesdk
for photo edited.
screnshoot
package com.lamba.selfie;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.provider.MediaStore;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.widget.ImageView;
import com.aviary.android.feather.sdk.AviaryIntent;
public class MainActivity extends AppCompatActivity {
private ImageView mResultImageView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mResultImageView = (ImageView) findViewById(R.id.resultImageView);
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,
"Select Picture"), 0);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
switch (requestCode) {
case 0:
Uri selectedImageUri = data.getData();
Uri imageUri = Uri.parse(getPath(selectedImageUri));
Intent imageEditorIntent = new AviaryIntent.Builder(this)
.setData(imageUri)
.build();
startActivity(imageEditorIntent);
/*case 1:
startActivityForResult(imageEditorIntent, 1);
Uri mImageUri = data.getData();
mResultImageView.setImageURI(mImageUri);
break;*/
}
}
}
public String getPath(Uri uri) {
// just some safety built in
if (uri == null) {
// TODO perform some logging or show user feedback
return null;
}
// try to retrieve the image from the media store first
// this will only work for images selected from gallery
String[] projection = {MediaStore.Images.Media.DATA};
Cursor cursor = managedQuery(uri, projection, null, null, null);
if (cursor != null) {
int column_index = cursor
.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
return cursor.getString(column_index);
}
// this is our fallback here
return uri.getPath();
}
}
How could I fix it?