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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:49:40+00:00 2026-05-25T19:49:40+00:00

http://developer.android.com/reference/android/view/View.html#attr_android:onClick Here it is said that For instance, if you specify android:onClick=sayHello, you must

  • 0

http://developer.android.com/reference/android/view/View.html#attr_android:onClick

Here it is said that

For instance, if you specify android:onClick=”sayHello”, you must declare a public void sayHello(View v) method of your context (typically, your Activity).

I’m intrested in “typically, your Activity”… And what if not typically? I’m creating a widget app so I don’t have an activity at all…

Almost forgot..
And the question is: where should I write that sayHello method?

  • 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-05-25T19:49:40+00:00Added an answer on May 25, 2026 at 7:49 pm

    Here’s the code which is responsible for the invacation:

    try {
        mHandler = getContext().getClass().getMethod(handlerName, View.class);
    } catch (NoSuchMethodException e) {
        throw new IllegalStateException("Could not find a method " +
            handlerName + "(View) in the activity", e);
    }
    

    So basiclly it searches in the class which implements the context for the given method. Usually the context is an activity.

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

Sidebar

Related Questions

Where can I find the values that InputType can has? I'm aware of http://developer.android.com/reference/android/text/InputType.html
Quick note: I'm using the SoundPool class http://developer.android.com/reference/android/media/SoundPool.html What I have here is a
http://developer.android.com/reference/android/widget/TextView.html#attr_android:password I can't find where in the android code it applied the android:password xml
here http://developer.android.com/reference/android/net/TrafficStats.html it says int UNSUPPORTED The return value to indicate that the device
From here : http://developer.android.com/reference/android/os/AsyncTask.html doInBackground(URL... urls) onProgressUpdate(Integer... progress) Are they a set of URL
In reviewing: http://developer.android.com/reference/android/graphics/Canvas.html I'm wondering translate(): preconcat the current matrix with the specified translation
The new Android 2.1 SDK (version 7) has a new class called SignalStrength: http://developer.android.com/reference/android/telephony/SignalStrength.html
What should I look at to get started? Is it Timer? http://developer.android.com/reference/java/util/Timer.html Or am
Looking at the example code in the docs http://developer.android.com/reference/android/content/Context.html#getExternalFilesDir%28java.lang.String%29 File path = getExternalFilesDir(Environment.DIRECTORY_PICTURES); It
The documentation at http://developer.android.com/reference/android/database/sqlite/SQLiteOpenHelper.html#getWritableDatabase%28%29 states: Database upgrade may take a long time, you should

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.