Search code examples
androidandroid-activityandroid-annotations

Launching Activity from another App? (with AndroidAnnotations)


How can i launch an AndroidAnnotations Activity_ inside of an App (main) since external Activity (another App).

this is my current code:

Intent codeScannerActivity = new Intent(PACKAGE, CODE_SCANNER_ACTIVITY);
codeScannerActivity.putExtra("codeScannerType", CameraUtils.CODE_SCANNER_SINGLE);
startActivityForResult(codeScannerActivity, Core.ActivityResult.RequestCode.CODE_SCANNER);

where PACKAGE = "main.app.package"

and CODE_SCANNER_ACTIVITY = PACKAGE + ".activity.MyActivity_"

but logs throws:

android.content.ActivityNotFoundException: No Activity found to handle Intent { act=main.app.package dat=main.app.package.activity.MyActivity_ (has extras) }

Activity is defined in the Manifest's Main App with the Class "etc.MyActivity_".


Solution

  • I was creating wrong the Intent, this is the right way:

    Intent codeScannerActivity = new Intent();
    codeScannerActivity.setComponent(new ComponentName(PACKAGE, CODE_SCANNER_ACTIVITY));
    codeScannerActivity.putExtra("codeScannerType", CameraUtils.CODE_SCANNER_SINGLE);
    startActivityForResult(codeScannerActivity, Core.ActivityResult.RequestCode.CODE_SCANNER);