0

I have an Widget and activity which will configure widget. I want to start this activity when widget calls onUpdate method. How can I make this ? I tried this code and it doesn't work:

Intent intent = new Intent(context, ConfigureClass.class);
context.startActivity(intent);

SOLUTION:

    Intent configure = new Intent(context, CreateDatabase.class);
    configure.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(configure);
remes
  • 67
  • 2
  • 8
  • 1
    stackoverflow.com/questions/11269559/how-to-start-activity-from-android-appwidget Have you tried to add proper intent flags, etc? – Konstantin Loginov Nov 19 '16 at 22:52
  • 3
    "I want to start this activity when widget calls onUpdate method" -- starting an activity, just because you receive `onUpdate()`, is a really bad idea. Your app widget will be updated several times per day. The user will get very tired of your activity popping up frequently, interrupting what the user is doing. Beyond that, please explain, **in detail**, what "it doesn't work" means. – CommonsWare Nov 19 '16 at 22:55
  • no, my widget onUpdate method is calling just once ( android:updatePeriodMillis="0") – remes Nov 19 '16 at 23:02
  • thanks Konstantin :) – remes Nov 19 '16 at 23:03

0 Answers0