我正在使用 sherlockFragment。
当我按下该片段上的按钮调用以使用 Intent 启动调用活动时,它导致了一个错误,但网络仍然加载。当我关闭通话活动时,错误再次出现。
我试过像这样替换最新的 android.support.v4.jar但错误仍然相同。
我试过以这种方式开始通话活动:
public class PlaceDetailsFragment extends SherlockFragment {
//blabla
public void browseWebPage(final String url){
getSherlockActivity().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(websiteUrl)));
}
}
而这种方式
public class PlaceDetailsFragment extends SherlockFragment {
//blabla
public void browseWebPage(final String url){
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(websiteUrl));
startActivity(intent);
}
}
但仍然有同样的错误 Logcat
05-20 11:37:28.971: E/AndroidRuntime(1819): FATAL EXCEPTION: main
05-20 11:37:28.971: E/AndroidRuntime(1819): java.lang.NullPointerException
05-20 11:37:28.971: E/AndroidRuntime(1819): at android.support.v4.app.FragmentManagerImpl.saveFragmentBasicState(FragmentManager.java:1576)
05-20 11:37:28.971: E/AndroidRuntime(1819): at android.support.v4.app.FragmentManagerImpl.saveAllState(FragmentManager.java:1617)
05-20 11:37:28.971: E/AndroidRuntime(1819): at android.support.v4.app.FragmentActivity.onSaveInstanceState(FragmentActivity.java:481)
05-20 11:37:28.971: E/AndroidRuntime(1819): at com.actionbarsherlock.app.SherlockFragmentActivity.onSaveInstanceState(SherlockFragmentActivity.java:127)
05-20 11:37:28.971: E/AndroidRuntime(1819): at android.app.Activity.performSaveInstanceState(Activity.java:1137)
05-20 11:37:28.971: E/AndroidRuntime(1819): at android.app.Instrumentation.callActivityOnSaveInstanceState(Instrumentation.java:1215)
05-20 11:37:28.971: E/AndroidRuntime(1819): at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:2951)
05-20 11:37:28.971: E/AndroidRuntime(1819): at android.app.ActivityThread.handleStopActivity(ActivityThread.java:3010)
05-20 11:37:28.971: E/AndroidRuntime(1819): at android.app.ActivityThread.access$900(ActivityThread.java:130)
05-20 11:37:28.971: E/AndroidRuntime(1819): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1222)
05-20 11:37:28.971: E/AndroidRuntime(1819): at android.os.Handler.dispatchMessage(Handler.java:99)
05-20 11:37:28.971: E/AndroidRuntime(1819): at android.os.Looper.loop(Looper.java:137)
05-20 11:37:28.971: E/AndroidRuntime(1819): at android.app.ActivityThread.main(ActivityThread.java:4745)
05-20 11:37:28.971: E/AndroidRuntime(1819): at java.lang.reflect.Method.invokeNative(Native Method)
05-20 11:37:28.971: E/AndroidRuntime(1819): at java.lang.reflect.Method.invoke(Method.java:511)
05-20 11:37:28.971: E/AndroidRuntime(1819): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
05-20 11:37:28.971: E/AndroidRuntime(1819): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
05-20 11:37:28.971: E/AndroidRuntime(1819): at dalvik.system.NativeStart.main(Native Method)
ACTION_VIEW 和 ACTION_CALL 出现了问题,有什么解决方案可以帮助我吗?