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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:39:22+00:00 2026-06-11T16:39:22+00:00

I use fragments, setOnClickListener – not called, I do not understand what is wrong

  • 0

I use fragments, setOnClickListener – not called, I do not understand what is wrong

public View onCreateView(LayoutInflater inflater, ViewGroup container,
          Bundle savedInstanceState) {

        View myFragmentView = inflater.inflate(R.layout.right_panel_1, container, true);

        Button buttonStart = (Button) myFragmentView.findViewById(R.id.ButtonStart);
        Button buttonFinish = (Button)myFragmentView.findViewById(R.id.buttonFinish);

        buttonStart.setOnClickListener(new View.OnClickListener() {

             public void onClick(View v) {

                ////

            }
        });

        buttonFinish.setOnClickListener(new View.OnClickListener() {


            public void onClick(View v) {

                ////
            }
        });

and layout right_panel_1.xml

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >


    <Button
        android:id="@+id/ButtonStart"
        android:layout_width="158dp"
        android:layout_height="72dp"
        android:gravity="center_vertical|center_horizontal"
        android:text="Start"
        android:textSize="@dimen/padding_large" />

    <Button
        android:id="@+id/buttonFinish"
        android:layout_width="match_parent"
        android:layout_height="72dp"
        android:gravity="center_vertical|center_horizontal"
        android:text="Finish"
        android:textSize="@dimen/padding_large" />
</LinearLayout>

<ScrollView
    android:id="@+id/scrollViewLog"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <TextView
        android:id="@+id/myLog"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</ScrollView>

  • 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-11T16:39:23+00:00Added an answer on June 11, 2026 at 4:39 pm

    You should probably try adding @Override above

    @Override
    public void onClick(View v)
    

    That’s the only part i see that’s missing at least 🙂

    there’s a tutorial on using fragments at http://neilgoodman.net/2012/03/12/working-with-fragments-on-android-part-2/ you can take a look at and try doing it from scratch

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

Sidebar

Related Questions

can i use fragments and map view in the same activity. I have seen
I am trying to understand how to use Fragments to create apps that adapt
I'm converting my Android application to use fragments. Previously, I had an activity that
I've just started converting my apps to use fragments. I have a ListView activity
i have about 60 fragments ListFragment , now i use each Listfragment with another
Is there are way to use fragments with the AccountAuthenticatorActivity when I'm using the
In Metro apps that use HTML it is recommended to use fragments to navigate
How can I use animation for transitions between fragments ? I tried FragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_CLOSE); FragmentTransaction.setCustomAnimations(android.R.anim.slide_in_left,
I have a very simple code where I use Action Bar with tab fragments.
In my tablet app I use many Fragments (of one class) next to eachother

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.