0

UPDATE: How to quit android application programmatically is useless as I do need to answer the below question, not how to start an activity or close the activity. I need to know if I can start an activity from a fragment and if not how to pass the value from the fragment to the class and do it from there.

Pretty new to this so I need directions please. I have a class which calls a camera fragment. I want that after a picture is taken and checked based upon some specific parameters, if and only if they are ok a new class is started and the previous one is closed.

Question:

I do the check for the picture taken inside the fragment. May I do startActivity(newIntent) inside the fragment or I need to pass the result of the check in someway to the class and call from there? If I can do it in the fragment, how can I do it? If I need to do it in the class, how can I pass to the class the result of the checks and where I can call startActivity() considering I call the fragment in onStart().

Thanks.

czane
  • 392
  • 1
  • 6
  • 18

1 Answers1

0

I solved my problem. I managed to open a new intent from within the fragment with the below code: Intent i = new Intent(getActivity(), myclass.class); getActivity().startActivity(i);

Thanks.

czane
  • 392
  • 1
  • 6
  • 18