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

  • Home
  • SEARCH
  • 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 9209781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:55:35+00:00 2026-06-18T00:55:35+00:00

I have implemented three tabs using ViewPager. In the right tab layout i have

  • 0

I have implemented three tabs using ViewPager. In the right tab layout i have one edit text widget, when users click on it keyboard comes up. If the user don’t close the keyboard manually and swipe to the middle or left tab the keyboard remains on screen. So how to avoid the keyboard in other two tabs where i don’t need it.

Edit: Here’s my code.

    class ViewPagerActivity extends Activity   {



/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

            setContentView(R.layout.main);

    MyPagerAdapter adapter = new MyPagerAdapter();
    ViewPager myPager = (ViewPager) findViewById(R.id.myfivepanelpager);
    myPager.setAdapter(adapter);
    myPager.setCurrentItem(1);
    TitlePageIndicator titleIndicator = (TitlePageIndicator) findViewById(R.id.titles);
    titleIndicator.setViewPager(myPager);


      } }

Second File: MyPagerAdapter.java

  class MyPagerAdapter extends PagerAdapter implements OnClickListener,
    OnLongClickListener, AdapterView.OnItemSelectedListener {

public Object instantiateItem(View collection, int position) {

    LayoutInflater inflater = (LayoutInflater) collection.getContext()
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    int resId = 0;
    View view;
    switch (position) {

    case 0:
        resId = R.layout.left;
        view = inflater.inflate(resId, null);
        break;
    case 1:


        resId = R.layout.main_c;

        view = inflater.inflate(resId, null);


        btn_no1 = (Button) view.findViewById(R.id.one);
        btn_no1.setOnClickListener(this);
                    ((ViewPager) collection).addView(view, 0);
        return view;
           case 2:
        resId = R.layout.right;

        view = inflater.inflate(resId, null);

        main_spinner = (Spinner) view.findViewById(R.id.spinner1);
        main_spinner.setOnItemSelectedListener(this);

        from_spinner = (Spinner) view.findViewById(R.id.spinner2);
        from_spinner.setOnItemSelectedListener(this);

        to_spinner = (Spinner) view.findViewById(R.id.spinner3);
        to_spinner.setOnItemSelectedListener(this);

        swap = (ImageButton) view.findViewById(R.id.swap_spinner);
        swap.setOnClickListener(this);
        ((ViewPager) collection).addView(view, 0);

        return view;


    }

    view = inflater.inflate(resId, null);

    ((ViewPager) collection).addView(view, 0);

    return view;
}

And TitlePageIndicator looks like this: TitlePageIndicator

  • 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-18T00:55:36+00:00Added an answer on June 18, 2026 at 12:55 am

    In my opinion this is not a serious problem. The user opens the keyboard for text input and will hide it when it’s no longer needed.

    Having a reference to your EditText object, this should hide the keyboard:

    InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    mgr.hideSoftInputFromWindow(editText.getWindowToken(), 0);
    

    Call the snippet above when leaving the right tab.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have implemented horizontal page view. One base page and three swipe pages. The
Friend's, I implemented tabhost in my application,i have three tabs defined in my activity
I have an application made by a UITabBar with three tabs. One of these
I have implemented the JQuery UI tabs and they work great, except for one
I am using view-pager.In that I have three tabs : 1. History , 2.
In my project I have the following three interfaces, which are implemented by classes
I have an Android application that I've been working on, and it's implemented using
My issue is simple. I have already implemented a tab system, and I'd probably
I am implementing tab layout in android. I am able to implement tabs however
I have an app with a tab bar and 3 tabs. The current location

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.