printerInit(PrinterName: String) throw Exception Message : Fragment WebViewFragment not attached to an activity

14 Views Asked by At

I have created an AAR library which contains my printing code. I also have an application which has main activity and a Fragment in it. Fragment from Main Activity initializes my printing module and uses it to handle printing. Sometimes fragment looses context from the activity and throws following error. WebViewFragment in ICallBack->printerInit(PrinterName: String) Message : throw Exception Message : Fragment WebViewFragment{635f1b6} (d40865f4-5738-48d3-879d-fcdab301d70b) not attached to an activity.

This happens on some devices but on some devices it works fine. What could be the solution? Any help/hint is really appreciated.

Thanks

how to resolved IllegalStateException: Fragment not attached to Activity

0

There are 0 best solutions below

Related Questions in ILLEGALSTATEEXCEPTION