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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:03:52+00:00 2026-05-18T06:03:52+00:00

I’ve got the following Button declared in my main.xml <Button android:name=@+id/clickedStartService android:layout_height=wrap_content android:layout_width=wrap_content android:onClick=clickedStartService

  • 0

I’ve got the following Button declared in my main.xml

<Button android:name="@+id/clickedStartService"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:onClick="clickedStartService"
        android:text="Start"
        />
<Button android:name="@+id/clickedStopService"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:onClick="clickedStopService"
        android:text="Stop"
        />

And I have the following methods in the activity..

@Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
public void clickedStartService(View v)
    {
        startService(new Intent(this, LocalService.class));
    }

    public void clickedStopService(View v)
    {
        stopService(new Intent(this, LocalService.class));
    }

I’m getting the following error when I click the button. I have tried rebuilding the project in my IDE and have also restarted the emulator, but same error re-appears. I’ve followed the documentation on the Android developers site, and I’ve had this working in a separate project, I just can’t get it to work here..

ERROR/AndroidRuntime(335): FATAL EXCEPTION: main
        java.lang.IllegalStateException: Could not find a method clickedStartService(View) in the activity class com.jameselsey.observerpattern.MyApp for onClick handler on view class android.widget.Button
        at android.view.View$1.onClick(View.java:2059)
        at android.view.View.performClick(View.java:2408)
        at android.view.View$PerformClick.run(View.java:8816)
        at android.os.Handler.handleCallback(Handler.java:587)
        at android.os.Handler.dispatchMessage(Handler.java:92)
        at android.os.Looper.loop(Looper.java:123)
        at android.app.ActivityThread.main(ActivityThread.java:4627)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:521)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
        at dalvik.system.NativeStart.main(Native Method)
        Caused by: java.lang.NoSuchMethodException
        at java.lang.Class.getDeclaredMethods(Native Method)
        at java.lang.ClassCache.getDeclaredPublicMethods(ClassCache.java:166)
        at java.lang.ClassCache.getDeclaredMethods(ClassCache.java:179)
        at java.lang.ClassCache.findAllMethods(ClassCache.java:249)
        at java.lang.ClassCache.getFullListOfMethods(ClassCache.java:223)
        at java.lang.ClassCache.getAllPublicMethods(ClassCache.java:204)
        at java.lang.Class.getMethod(Class.java:984)
        at android.view.View$1.onClick(View.java:2052)
        ... 11 more
  • 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-18T06:03:53+00:00Added an answer on May 18, 2026 at 6:03 am

    XML click listeners were added in Android 1.6. Check your AndroidManifest to verify that your min SDK version isn’t set to cupcake (1.5, or API level 3) –

    If you’re using Eclipse with the ADT plugin, also check project properties > Android and check the build target, make sure it’s Donut or higher.

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

Sidebar

Related Questions

I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have a text area in my form which accepts all possible characters from

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.