Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8873337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:26:26+00:00 2026-06-14T18:26:26+00:00

I cannot find find FragmentPagerAdapter within Android.App. I do not want to use the

  • 0

I cannot find find FragmentPagerAdapter within Android.App.

I do not want to use the Fragment’s from Android.Support.V4.App, as my target API is
14 and higher (Android 4.0 and up). So, I want to just use plain of Android.App.Fragments,
and there associated classes.

I only have found it within Android.Support.V4.App, but this doesn’t suffice
for me b/c I’m trying to use Android.App.Fragment’s (not Android.Support.V4.App.Fragment’s)
and there related classes within Android.App (not Android.Support.V4.App), and my code wont
compile if I derive my pager from FragmentPagerAdapter if its from the Support library,
because of the resulting type mismatch’s between Android.App and Android.Support.V4.App.

Just as with the case here Cannot be cast to android.app.Fragment, is there a “normal” pager (PagerAdapter) class I should be using in
place of FragmentPagerAdapter or something (just like you derive from normal Activity, and
not FragmentActivity, when targeting API 11 or higher).

Here is the sample code I’m working with (its the FragmentPagerSupport.cs file within the Support4.sln solution from the MonoDroid examples found at https://github.com/xamarin/monodroid-samples/tree/master/Support4).

I’ve commented out the lines that referenced Android.Support.V4.App and replaced them with
code that references Android.App. There is no FramePagerAdapter outside of Android.Support.V4.App that I could find, and I really need it).

Thanks.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
//using Android.Support.V4.App;
//using Android.Support.V4.View;

namespace Support4
{
    [Activity (Label = "@string/fragment_pager_support")]
    [IntentFilter (new[]{Intent.ActionMain}, Categories = new[]{ "mono.support4demo.sample" })]
    //public class FragmentPagerSupport : FragmentActivity
        public class FragmentPagerSupport : Activity
    {
        const int NUM_ITEMS = 10;
        MyAdapter adapter;
        ViewPager pager;

        protected override void OnCreate (Bundle bundle)
        {
            base.OnCreate (bundle);

            SetContentView(Resource.Layout.fragment_pager);

            //adapter = new MyAdapter(SupportFragmentManager);
                        adapter = new MyAdapter(FragmentManager);

            pager = FindViewById<ViewPager>(Resource.Id.pager);
            pager.Adapter = adapter;

            var button = FindViewById<Button>(Resource.Id.goto_first);
            button.Click += (sender, e) => {
                pager.CurrentItem = 0;  
            };
            button = FindViewById<Button>(Resource.Id.goto_last);
            button.Click += (sender, e) => {
                pager.CurrentItem = NUM_ITEMS - 1;
            };
        }

                // ?????????????????????????????????????????????????
                // - where is FragmentPagerAdapter 
                // ?????????????????????????????????????????????????

        protected class MyAdapter : FragmentPagerAdapter 
        {
            public MyAdapter(FragmentManager fm) : base(fm)
            {
            }

            public override int Count {
                get {
                    return NUM_ITEMS;
                }
            }

            public override Fragment GetItem (int position)
            {
                return new ArrayListFragment(position);
            }


        }

        protected class ArrayListFragment : ListFragment
        {
            int num;

            public ArrayListFragment()
            {
            }

            public ArrayListFragment(int num)
            {
                var args = new Bundle();
                args.PutInt("num", num);
                Arguments = args;
            }

            public override void OnCreate (Bundle p0)
            {
                base.OnCreate (p0);

                num = Arguments != null ? Arguments.GetInt("num") : 1;
            }

            public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
            {
                var v = inflater.Inflate(Resource.Layout.fragment_pager_list, container, false);
                var tv = v.FindViewById<TextView>(Resource.Id.text);
                tv.Text = "Fragment #" + num;
                return v;
            }

            public override void OnActivityCreated (Bundle p0)
            {
                base.OnActivityCreated (p0);

                ListAdapter = new ArrayAdapter<string>(Activity, Android.Resource.Layout.SimpleListItem1, Cheeses.cheeseStrings);
            }

            public override void OnListItemClick(ListView l, View v, int position, long id) {
                Console.WriteLine ( "Item clicked: " + id);
            }
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T18:26:27+00:00Added an answer on June 14, 2026 at 6:26 pm

    There is one that is in android.support.v13.app.FragmentPagerAdapter, which should do what you want it to do. It’s a FragmentPagerAdapter for non-support fragments.

    Android Studio Installation

    Please add follow Gradle dependencies

    dependencies {
        compile 'com.android.support:support-v13:+'
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I cannot find anything on the api page from google, is this even possible?
I cannot find a way to get a Book's Ratings through the Books API
I cannot find where the sqlcmd is? i just want the prompt. please help!
Cannot find executable for CFBundle/CFPlugIn 0x432bfa0 (not loaded) Cannot find function pointer NewPlugIn for
I cannot find any documentation. All I want to do it set jQuerys default
I cannot find a way to use a first-class Type object (System.Type instance) as
I cannot find any information about the thread-safety of the waveOut API. After i
I cannot find out the regex to get param value from the part of
I cannot find an elegant way to get the return value from a stored
I cannot find any example on how to use the pattern= parameter in list.files

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.