Skip to content Skip to sidebar Skip to footer

App Crashes When Calling Startactivityforresult

I'm working on my first Android app, specifically in this case something to help me cook better. I have 2 activities that I'm currently struggling with, my MainActivity.java and wh

Solution 1:

Remove this line:

recipe.setFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);

You do not need it for startActivityForResult(), and it's what is causing your crash.

Solution 2:

Instead of:

startActivityForResult(recipe,R.integer.search_by_recipe);

Try this:

startActivityForResult(recipe, getResources().getInteger(R.integer.search_by_recipe));

Post a Comment for "App Crashes When Calling Startactivityforresult"