Skip to content Skip to sidebar Skip to footer

Android - Swiping Between Activities

I'm developing android app for a local newspapers and atm I'm trying to implement swiping between articles. My main activity is HNappActivity and activity for article showing is Ac

Solution 1:

I didn't even read the code, the problem is that you're trying to swipe between activities. You should be trying to swipe between fragments, all fragments in the same activity.

see: http://developer.android.com/reference/android/support/v4/app/FragmentPagerAdapter.html http://developer.android.com/reference/android/support/v4/view/ViewPager.html

edit:

private WebView hnWebView;
    @Overridepublic View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        Viewv= inflater.inflate(R.layout.webViewFragment, null);
        hnWebView=(WebView)v.findViewById(R.id.webview);
        return v;
    }

Solution 2:

An alternative could be using a ViewPager http://developer.android.com/reference/android/support/v4/view/ViewPager.html

Here is a guide: http://android-developers.blogspot.se/2011/08/horizontal-view-swiping-with-viewpager.html

Post a Comment for "Android - Swiping Between Activities"