Intent - mayurparmar2/AlarmDemo GitHub Wiki
louncActivity.java
Intent intent = new Intent(this, EditImageActivity.class);
someActivityResultLauncher.launch(intent);
ActivityResultLauncher<Intent> someActivityResultLauncher = registerForActivityResult(
new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback<ActivityResult>() {
@Override
public void onActivityResult(ActivityResult result) {
if (result.getResultCode() == Activity.RESULT_OK) {
// Here, no request code
}
}
});
content uri to path .java
Uri yourCustomUri = Uri.parse("content://media/picker/0/com.android.providers.media.photopicker/media/1000031959");
String[] projection = {"_data"};
Cursor cursor = null;
try {
cursor = getContentResolver().query(yourCustomUri, projection, null, null, null);
if (cursor != null && cursor.moveToFirst()) {
int columnIndex = cursor.getColumnIndexOrThrow(projection[0]);
String filePath = cursor.getString(columnIndex);
// Now you have the file path.
}
} catch (Exception e) {
// Handle exceptions or errors here.
} finally {
if (cursor != null) {
cursor.close();
}
}