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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T14:14:00+00:00 2026-06-18T14:14:00+00:00

In the Android API Guides for checkboxes , they state that you can set

  • 0

In the Android API Guides for checkboxes, they state that you can set an attribute in a layout’s XML (android:onClick) to launch a designated method. The same is said in the guide for Buttons, but the guide for buttons also has this bit:

You can also declare the click event handler pragmatically rather than in an XML layout. This might be necessary if you instantiate the Button at runtime or you need to declare the click behavior in a Fragment subclass.

This raises the following question: Can you or can you not take advantage of the android:onClick attribute if the button or checkbox is found in a Fragment? If so, I would assume the method to be called would be declared in the Fragment, correct?

  • 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-18T14:14:02+00:00Added an answer on June 18, 2026 at 2:14 pm

    You can utilize the onClick attribute in fragments. However, since a Fragment is part of an Activity, the designated method will be launched in the Activity class, not in the fragment.

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

Sidebar

Related Questions

I want to find out if it is possible to create Android API's that
I want to build an small application in android API that will unable me
I set up a SearchWidget as described in the Android API Guide . It
I'm trying to use the Google Maps API v2 in an android project that
Note: PopupMenu is available with API level 11 and higher. http://developer.android.com/guide/topics/ui/menus.html#PopupMenu With that in
My Android application can be divided into a client UI layer and a API
I am developing an Android (API level 7) app in Eclipse 3.7.2. I have
I want to access Android API classes outside an Android project . For example
I'm using the cameraPreview sample coming with the Android API demos. The problem is,
I have with an blue tooth application from android api sample.I am displaying blue

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.