Android onActivityResult called early

前端 未结 3 1180
不思量自难忘°
不思量自难忘° 2021-01-17 23:37

I have 2 Activities, each in seperate applications. Activity1 has a button the user can click and it calls the second activity using an intent in its onClick()

3条回答
  •  星月不相逢
    2021-01-18 00:18

    So here is the final solution that took care of it:

    I changed the intent for Activity1 to the following:

    Intent myIntent = new Intent();
    myIntent.setClassName("com.myProject", "com.myProject.Activity2");
    startActivityForResult(myIntent, 600);
    

    For some reason Android requires the fully qualified name for the second parameter in addition to the package name given by the first parameter. Now it works! :)

提交回复
热议问题