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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:22:40+00:00 2026-05-23T14:22:40+00:00

I have an widget, with an button and an imagebutton. I want that if

  • 0

I have an widget, with an button and an imagebutton.
I want that if you click the imagebutton, there opens an transparant activity with an edittext.
For example we fill in 01
Than when you click the normal button, it will load an webview that shows html file 01.html.
Is this possible?

The code i have is:

 package com.kerk.liedboek.widget;

 import android.app.Notification;
 import android.app.NotificationManager;
 import android.app.PendingIntent;
 import android.appwidget.AppWidgetManager;
 import android.appwidget.AppWidgetProvider;
 import android.content.Context;
 import android.content.Intent;
 import android.util.Log;
 import android.widget.RemoteViews;
 import android.widget.Toast;

  public class main extends AppWidgetProvider {

      public static String ACTION_WIDGET_CONFIGURE = "ConfigureWidget";
      public static String ACTION_WIDGET_RECEIVER = "ActionReceiverWidget";

      @Override 
      public void onUpdate(Context context, AppWidgetManager 
 appWidgetManager, 
        int[] appWidgetIds) { 
            Intent i = new Intent(context, edit.class); 
            PendingIntent pi = PendingIntent.getBroadcast(context,0, i,0); 
            RemoteViews rv = new RemoteViews(context.getPackageName(), 
 R.layout.main); 
            rv.setOnClickPendingIntent(R.id.button_one, pi); 

            Intent i2 = new Intent(context, webview.class); 
            PendingIntent pi2 = PendingIntent.getBroadcast(context,0, i2,0); 
            RemoteViews rv2 = new RemoteViews(context.getPackageName(), 
 R.layout.main); 
            rv2.setOnClickPendingIntent(R.id.button_two, pi2); 

    }
}

I’m new to android, and i now i’m an newb. But i hope you understand me and you can help me.
Gaauwe

Edit:

My logcat is:

07-09 14:19:31.070: ERROR/AndroidRuntime(381): FATAL EXCEPTION: main
07-09 14:19:31.070: ERROR/AndroidRuntime(381): java.lang.RuntimeException: Unable to instantiate receiver com.liedboek.widget.aantekening: java.lang.ClassCastException: com.liedboek.widget.aantekening
07-09 14:19:31.070: ERROR/AndroidRuntime(381): at android.app.ActivityThread.handleReceiver(ActivityThread.java:1773)
07-09 14:19:31.070: ERROR/AndroidRuntime(381): at android.app.ActivityThread.access$2400(ActivityThread.java:117)
07-09 14:19:31.070: ERROR/AndroidRuntime(381): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:981)
07-09 14:19:31.070: ERROR/AndroidRuntime(381): at android.os.Handler.dispatchMessage(Handler.java:99)
07-09 14:19:31.070: ERROR/AndroidRuntime(381): at android.os.Looper.loop(Looper.java:123)
07-09 14:19:31.070: ERROR/AndroidRuntime(381): at android.app.ActivityThread.main(ActivityThread.java:3683)
07-09 14:19:31.070: ERROR/AndroidRuntime(381): at java.lang.reflect.Method.invokeNative(Native Method)
07-09 14:19:31.070: ERROR/AndroidRuntime(381): at java.lang.reflect.Method.invoke(Method.java:507)
07-09 14:19:31.070: ERROR/AndroidRuntime(381): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
07-09 14:19:31.070: ERROR/AndroidRuntime(381): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
07-09 14:19:31.070: ERROR/AndroidRuntime(381): at dalvik.system.NativeStart.main(Native Method)
07-09 14:19:31.070: ERROR/AndroidRuntime(381): Caused by: java.lang.ClassCastException: com.liedboek.widget.aantekening
07-09 14:19:31.070: ERROR/AndroidRuntime(381): at android.app.ActivityThread.handleReceiver(ActivityThread.java:1764)
07-09 14:19:31.070: ERROR/AndroidRuntime(381): … 10 more
07-09 14:19:31.101: WARN/ActivityManager(69): Process com.liedboek.widget has crashed too many times: killing!

But my code is another code, but also an button widget:

package com.liedboek.widget;

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

 public class main extends AppWidgetProvider {

public static String ACTION_WIDGET_CONFIGURE = "ConfigureWidget";
public static String ACTION_WIDGET_RECEIVER = "ActionReceiverWidget";

@Override 
public void onUpdate(Context context, AppWidgetManager 
appWidgetManager, 
  int[] appWidgetIds) { 
    // Create an Intent to launch ExampleActivity
    Intent intent = new Intent(context, aantekening.class);
    PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);

    // Get the layout for the App Widget and attach an on-click listener
    // to the button
    RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.main);
    views.setOnClickPendingIntent(R.id.button_one, pendingIntent);

    // Tell the AppWidgetManager to perform an update on the current app widget
    appWidgetManager.updateAppWidget(appWidgetIds, views); 



  } 
 }
  • 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-23T14:22:41+00:00Added an answer on May 23, 2026 at 2:22 pm

    Instead of using getBroadcast you may want to use getActivity.

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

Sidebar

Related Questions

I have a widget that supposed to call an Activity of the main app
I have an widget with an button (R.id.button) When I click the button, it
I have a button widget that I had a successful rotation animation on but
I have a home screen widget with a button with a pendingIntent. Click it,
I have a button and on each click I want a different sound to
i have a button called ac and when i click on it, i want
So, I have three activities/screens. On the first screen, there's a button, that when
In my app i have a button that when click loads a new image
I have separate file with listener. I want to attach that listener to button,
I have a GtkMenu Widget and i am adding it to screen on button

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.