• 6
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

I am getting this crash from multiple users when trying to get fragment manager. Any idea why the crash?

@Override
 public void onNoInternetError() {
   Log.i("base", "no internet error!");
   final FragmentTransaction ft = getFragmentManager().beginTransaction();
   final NoInternetFragment fragment = new NoInternetFragment();
   ft.replace(R.id.content_frame, fragment, "noInternetFragment");
   ft.addToBackStack(null);
   ft.commit();

Error

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'android.support.v4.app.p android.support.v4.app.k.a()' on a null object reference
       at com.abc.abc.fragments.ABCFragmentBase$1.onNoInternetError(ABCFragmentBase.java:112)
       at com.abc.abc.ui.components.NoInternetListener.showNoInternetFragment(NoInternetListener.java:14)
       at com.abc.abc.ServerManager.handleFailure(ServerManager.java:1875)
       at com.abc.abc.ServerManager.access$100(ServerManager.java:54)
       at com.abc.abc.ServerManager$33.onFailure(ServerManager.java:1220)
       at com.abc.sdk.JsonObjectRequest.deliverError(JsonObjectRequest.java:70)
       at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:108)
       at android.os.Handler.handleCallback(Handler.java:789)
       at android.os.Handler.dispatchMessage(Handler.java:98)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6944)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

from your code it seems like the getFragmentManager() call is returning null which probably means your fragment hasn't gone through onAttach() yet

you can add a flag for connection error and then after onAttach() display the relevant information

  • 1
Reply Report