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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:28:57+00:00 2026-05-24T16:28:57+00:00

I have written a click-able widget. I can see the widget. But I cann’t

  • 0

I have written a click-able widget. I can see the widget. But I cann’t detect click event in that widget. If I click on the widget then onReceive method should be called. but its not getting called. Can anyone guide me what may be the problem.

Source Code

import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.Context;
import android.content.Intent;
import android.widget.RemoteViews;

public class MyWidget extends AppWidgetProvider {
    public static int IDs[];
    Context context;
    @Override
    public void onReceive(Context context, Intent intent) {
        // TODO Auto-generated method stub
        super.onReceive(context, intent);

        System.out.println("...inside receive11....");

        if (intent.getAction().equals("com.fedorvlasov.lazylist.NEXT_CLICK")) {
            System.out.println("Back Button Clicked ::::::::::::  ");

            onUpdate(context, AppWidgetManager.getInstance(context), IDs);
            // views = new RemoteViews(context.getPackageName(), R.layout.main);
        }
        if (intent.getAction().equals(
                "com.fedorvlasov.lazylist.NEXT_CLICK_NEXT")) {
            System.out.println("Onion Button Clicked Button:::::::::::: ");

            onUpdate(context, AppWidgetManager.getInstance(context), IDs);
            // views = new RemoteViews(context.getPackageName(), R.layout.main);
        }
        if (intent.getAction()
                .equals("com.fedorvlasov.lazylist.TEXTVIEW_CLICK")) {
            System.out.println("Next Button Clicked ::::::::::::  ");

            onUpdate(context, AppWidgetManager.getInstance(context), IDs);
        }
        System.out.println("...out to receive11....");

    }

    @Override
    public void onUpdate(Context context, AppWidgetManager appWidgetManager,
            int[] appWidgetIds) {
        // TODO Auto-generated method stub
        super.onUpdate(context, appWidgetManager, appWidgetIds);
        IDs = appWidgetIds;
        this.context = context;
        System.out.println("...inside update....");
        RemoteViews remoteViews = new RemoteViews(context.getPackageName(),
                R.layout.mywidget);

        Intent buttonPrevious = new Intent(context, MyWidget.class);
        buttonPrevious.setAction("com.fedorvlasov.lazylist.NEXT_CLICK");
        PendingIntent pendingIntentButtonP = PendingIntent.getBroadcast(
                context, 0, buttonPrevious, 0);
        remoteViews.setOnClickPendingIntent(R.id.mywidget_left,
                pendingIntentButtonP);

        Intent buttonMiddle = new Intent(context, MyWidget.class);
        buttonMiddle.setAction("com.fedorvlasov.lazylist.TEXTVIEW_CLICK");
        PendingIntent pendingIntentButtonM = PendingIntent.getBroadcast(
                context, 0, buttonMiddle, 0);
        remoteViews.setOnClickPendingIntent(R.id.mywidget_middle,
                pendingIntentButtonM);

        Intent buttonNext = new Intent(context, MyWidget.class);
        buttonNext.setAction("com.fedorvlasov.lazylist.NEXT_CLICK_NEXT");
        PendingIntent pendingIntentButtonN = PendingIntent.getBroadcast(
                context, 0, buttonNext, 0);
        remoteViews.setOnClickPendingIntent(R.id.mywidget_right,
                pendingIntentButtonN);


    }
}

In Manifest file

<receiver android:name=".MyWidget" android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
                <action android:name="com.fedorvlasov.lazylist.NEXT_CLICK" />
                <action android:name="com.fedorvlasov.lazylist.NEXT_CLICK_NEXT" />
                <action android:name="com.fedorvlasov.lazylist.TEXTVIEW_CLICK" />
            </intent-filter>
            <meta-data android:name="android.appwidget.provider"
                android:resource="@xml/widget_info" android:process=":remote" />
        </receiver>
  • 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-24T16:28:59+00:00Added an answer on May 24, 2026 at 4:28 pm

    You have forgot to update the widget in onUpdate() method.

    write appWidgetManager.updateAppWidget(appWidgetIds, remoteViews); at the end of onUpdate() method

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

Sidebar

Related Questions

I have a modal dialog plugin written in jquery, that binds to the click
I have an OSX widget written using Dashcode. Currently any mouse drag event causes
I have written a simple memory game. You click on one of 16 cards
I have written a function that sorts a big scale of data. To test
I have written a function that extract the domain from hostname. e.g. www.domain.com ->
Greetings, We have an application written in .net 3.5 that uses wcf and also
I have written some code in java that will guess a number based on
I need to show an overlay on button click.To achieve this i have written
I have written a mapping application which can either use Google Maps or Open
I have a windows application that I need to be able to manipulate programatically.

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.