Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
DigitalBug's avatar
DigitalBug
Protege
3 years ago

Can't get focus after Android popup

Hello. I use the standard Android overlay window to select an image.

After I select an image, the selection overlay is hidden and my app remains out of focus with the oculus dock open.
What am I doing wrong?

 

public class MyActivity extends AppCompatActivity 
{
	public static void PickImage(Activity activity)
	{
		Intent intent = new Intent(activity, MyActivity.class);
		activity.startActivity(intent);
	}

	ActivityResultLauncher<Intent> PickImage_ActivityResultLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(),
            new ActivityResultCallback<ActivityResult>() {
                @Override
                public void onActivityResult(ActivityResult result)
				{
                    if(result.getResultCode() == Activity.RESULT_OK) {
                    }
					finish();
                }
            });

	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
	
		Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
		intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, false);
		intent.addFlags(Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION);
		intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
		intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, false);
		intent.setType("image/*");
		intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
		PickImage_ActivityResultLauncher.launch(intent);
	}

}

 

 

1 Reply