android - Exception on backpress fragment ..Searched but doesn't found any such -
-i having problem in fragment.. when press button or home button app crashes.. search google n stack overflow , not applicable mine.. can suggest
e/androidruntime(2285): fatal exception: main e/androidruntime(2285): process: com.iaboh, pid: 2285 e/androidruntime(2285): java.lang.runtimeexception: unable pause activity {}: android.util.androidruntimeexception: calling startactivity() outside of activity context requires flag_activity_new_task flag. want? e/androidruntime(2285): @ android.app.activitythread.performpauseactivity(activitythread.java:3048)
you not calling startactivity
using activity context. have 2 solutions.
solution 1
use activity context while calling startactivity()
solution 2
add intent. if want launch activity form non activity context. careful flag. per android documentation
when using flag, if task running activity starting, new activity not started; instead, current task brought front of screen state last in.
intent.setflags(intent.flag_activity_new_task);
Comments
Post a Comment