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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:52:10+00:00 2026-05-26T04:52:10+00:00

What’s the best way of getting input from appwidget . I know that I

  • 0

What’s the best way of getting input from appwidget. I know that I can use setOnClickPendingIntent method from RemoteViews, but I don’t want that! Is there any alternative ways ?
P.S. When i’m trying to register onClick listener in Xml (<ImageView android:onClick="myHandler" ... />) it’s throws an exception.

W/AppWidgetHostView(  178): android.view.InflateException: Binary XML file line #11: Error inflating class android.widget.Button
W/AppWidgetHostView(  178):     at android.view.LayoutInflater.createView(LayoutInflater.java:513)
W/AppWidgetHostView(  178):     at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
W/AppWidgetHostView(  178):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
W/AppWidgetHostView(  178):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
W/AppWidgetHostView(  178):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
W/AppWidgetHostView(  178):     at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
W/AppWidgetHostView(  178):     at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
W/AppWidgetHostView(  178):     at android.widget.RemoteViews.apply(RemoteViews.java:900)
W/AppWidgetHostView(  178):     at android.appwidget.AppWidgetHostView.updateAppWidget(AppWidgetHostView.java:208)
W/AppWidgetHostView(  178):     at com.htc.launcher.LauncherAppWidgetHostView.updateAppWidget(LauncherAppWidgetHostView.java:116)
W/AppWidgetHostView(  178):     at android.appwidget.AppWidgetHost.updateAppWidgetView(AppWidgetHost.java:243)
W/AppWidgetHostView(  178):     at android.appwidget.AppWidgetHost$UpdateHandler.handleMessage(AppWidgetHost.java:72)
W/AppWidgetHostView(  178):     at android.os.Handler.dispatchMessage(Handler.java:99)
W/AppWidgetHostView(  178):     at android.os.Looper.loop(Looper.java:123)
W/AppWidgetHostView(  178):     at android.app.ActivityThread.main(ActivityThread.java:4595)
W/AppWidgetHostView(  178):     at java.lang.reflect.Method.invokeNative(Native Method)
W/AppWidgetHostView(  178):     at java.lang.reflect.Method.invoke(Method.java:521)
W/AppWidgetHostView(  178):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
W/AppWidgetHostView(  178):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
W/AppWidgetHostView(  178):     at dalvik.system.NativeStart.main(Native Method)
W/AppWidgetHostView(  178): Caused by: java.lang.reflect.InvocationTargetException
W/AppWidgetHostView(  178):     at android.widget.Button.<init>(Button.java:65)
W/AppWidgetHostView(  178):     at java.lang.reflect.Constructor.constructNative(Native Method)
W/AppWidgetHostView(  178):     at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
W/AppWidgetHostView(  178):     at android.view.LayoutInflater.createView(LayoutInflater.java:500)
W/AppWidgetHostView(  178):     ... 19 more
W/AppWidgetHostView(  178): Caused by: java.lang.IllegalStateException: The android:onClick attribute cannot be used within a restricted context
W/AppWidgetHostView(  178):     at android.view.View.<init>(View.java:2005)
W/AppWidgetHostView(  178):     at android.widget.TextView.<init>(TextView.java:335)
W/AppWidgetHostView(  178):     at android.widget.Button.<init>(Button.java:69)
W/AppWidgetHostView(  178):     ... 23 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-26T04:52:11+00:00Added an answer on May 26, 2026 at 4:52 am

    I know that I can use setOnClickPendingIntent method from RemoteViews, but I don’t want that!

    You do not have a choice. It is your only input option through API Level 10 (Gingerbread).

    For API Level 11 and higher (Honeycomb, etc.), you can create app widgets that contain ListView, GridView, and StackView. For those, you can provide another PendingIntent that will be invoked when items in the list (or grid or stack) are clicked. This will work similarly to setOnClickPendingIntent().

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

Sidebar

Related Questions

Does anyone know how can I replace this 2 symbol below from the string
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
I need to clean up various Word 'smart' characters in user input, including but
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text

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.