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 8881159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:17:24+00:00 2026-06-14T20:17:24+00:00

Hope you guys can help, I have a activity that has tabs, each tab

  • 0

Hope you guys can help, I have a activity that has tabs, each tab is a fragment.
I am using the Sherlockfragment library and trying to work out how to handle buttons in the layouts of the fragments.
My code currently is:

Add the tab to the tabs

 mTabsAdapter.addTab(mTabHost.newTabSpec("1").setIndicator("Page 1"),1.Fragment.class, null);

fragment class:

    public class 1 extends SherlockFragmentActivity {

     public static class Fragment extends SherlockFragment {
            Fragment newInstance(int num) {
            Fragment f = new Fragment();
            return f;
        }

        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);

        }

        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                Bundle savedInstanceState) {
            View v = inflater.inflate(R.layout.1, container, false);
            return v;
        }
    }

}

Then the layout is:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" >
        <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content">
        <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content" xmlns:android="http://schemas.android.com/apk/res/android">
            <TextView android:text="@string/page1" android:layout_width="wrap_content"  android:layout_height="wrap_content"  />
        </LinearLayout>
        </ScrollView>
<ImageButton
        android:id="@+id/btn_1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:src="@drawable/bt1" />
</RelativeLayout>

I couldn’t find any useful samples of this in the Sherlock samples, but if there is a sample that I have missed let me know.

  • 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-14T20:17:25+00:00Added an answer on June 14, 2026 at 8:17 pm

    Inside the onCreateView() of the fragment, you can access the different views in your fragment layout using findViewById(), and assign the different listeners to them calling the corresponding methods, for instance, setOnClickListener(). You can also store references to the different views as private variables inside the fragment, for later use.

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

Sidebar

Related Questions

I have a question that i hope you guys can help me with! This
I hope some of you guys can help me with this problem.... I have
Hope you guys can help me out. I have information coming into a serial
I hope you guys can help me with this one. So, I have a
I am stuck with a design problem that I hope you guys can help
i have a problem so hope you guys can help! I have a string
Hope you guys can help me. This is my situation. I have a stored
Hello all I have a question I hope you guys can help me with.
I'm really confused so I hope you guys can help me. I know how
I've run in to a problem I hope you guys can help me with.

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.