私は自分のアプリケーションでSwipeRefreshLayout
andを問題なく使用しています。WebView
ViewPager
コード内:
@Override
public Object instantiateItem(View collection, int position) {
currentArticle = newsList.get(position);
View webViewContainer = getActivity().getLayoutInflater().inflate(R.layout.view_pager_item, null);
WebView webview = (WebView) webViewContainer.findViewById(R.id.webview);
SetSettingForWebView(webview);
webview.loadUrl(currentArticle.getArticleURL());
SwipeRefreshLayout swipe = (SwipeRefreshLayout) webViewContainer.findViewById(R.id.swipe_container);
setSettingForSwipeLayout(swipe);
((ViewPager) collection).addView(webViewContainer, 0);
return webViewContainer;
}
を定義するかどうかに関係なく、エラーが発生しますSwipeRefreshLayout
。
これがエラーです。ご覧のとおり、私のコードとは関係ありませんが、これを解決する方法がわかりません
ログ:
05-25 21:55:59.804: E/AndroidRuntime(4665): FATAL EXCEPTION: main
05-25 21:55:59.804: E/AndroidRuntime(4665): Process: com.dimrix.test, PID: 4665
05-25 21:55:59.804: E/AndroidRuntime(4665): java.lang.NullPointerException
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.support.v4.widget.SwipeRefreshLayout.startRefresh(SwipeRefreshLayout.java:441)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.support.v4.widget.SwipeRefreshLayout.onTouchEvent(SwipeRefreshLayout.java:399)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.View.dispatchTouchEvent(View.java:7811)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2210)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1945)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1959)
05-25 21:55:59.804: E/AndroidRuntime(4665): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2169)
05-25 21:55:59.804: E/AndroidRuntime(4665): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1613)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.app.Activity.dispatchTouchEvent(Activity.java:2539)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.support.v7.app.ActionBarActivityDelegateICS$WindowCallbackWrapper.dispatchTouchEvent(ActionBarActivityDelegateICS.java:268)
05-25 21:55:59.804: E/AndroidRuntime(4665): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2117)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.View.dispatchPointerEvent(View.java:8005)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4300)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4179)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3714)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3764)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3733)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3844)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3741)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3901)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3714)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3764)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3733)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3741)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3714)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5973)
05-25 21:55:59.804: E/AndroidRuntime(4665): at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.ja