Unable to launch an activity from an AppWidget

by Karl Smith » Fri, 20 May 2011 09:53:37 GMT


Sponsored Links
 I have this code setup in my app widget and I have listed the activity
it should launch below. I can't for the life of me get the activity to
launch when the button is clicked. Nothing happens when I click on it.


public class MyAppWidget extends AppWidgetProvider
{
        public void onUpdate(Context context, AppWidgetManager
appWidgetManager, int[] appWidgetIds)
        {
        RemoteViews remoteViews = new
RemoteViews(context.getPackageName(), R.layout.main);


    Intent intent = new Intent(context, EditActivity.class);
                PendingIntent pendingIntent =
PendingIntent.getActivity(context, 0, intent,
Intent.FLAG_ACTIVITY_NEW_TASK);
 
remoteViews.setOnClickPendingIntent(R.id.btnEditConfiguration,
pendingIntent);

                appWidgetManager.updateAppWidget(thisWidget,
remoteViews);
            }
}

 public class EditActivity extends Activity
    {
         public void onCreate(Bundle savedInstanceState)
            {
                super.onCreate(savedInstanceState);
 
setContentView(R.layout.configure);
            }
    }

-- 



Unable to launch an activity from an AppWidget

by Karl Smith » Fri, 20 May 2011 09:53:38 GMT


 I have this code setup in my app widget and I have listed the activity
it should launch below. I can't for the life of me get the activity to
launch when the button is clicked. Nothing happens when I click on it.


public class MyAppWidget extends AppWidgetProvider
{
        public void onUpdate(Context context, AppWidgetManager
appWidgetManager, int[] appWidgetIds)
        {
public void onUpdate(Context context, AppWidgetManager
appWidgetManager, int[] appWidgetIds)
    {
        RemoteViews remoteViews = new
RemoteViews(context.getPackageName(), R.layout.main);


    Intent intent = new Intent(context, EditActivity.class);
                PendingIntent pendingIntent =
PendingIntent.getActivity(context, 0, intent,
Intent.FLAG_ACTIVITY_NEW_TASK);
 
remoteViews.setOnClickPendingIntent(R.id.btnEditConfiguration,
pendingIntent);

                appWidgetManager.updateAppWidget(thisWidget,
remoteViews);
            }
}

 public class EditActivity extends Activity
    {
         public void onCreate(Bundle savedInstanceState)
            {
                super.onCreate(savedInstanceState);
 
setContentView(R.layout.configure);
            }
    }

-- 


Sponsored Links


Re: Unable to launch an activity from an AppWidget

by Nikolay Elenkov » Fri, 20 May 2011 10:04:06 GMT


 


Are you updating the right widget?
Is btnEditConfiguration visible/enabled?
Does the Activity work when started from launcher?
Any suspicious messages in logcat?

-- 



Other Threads

1. Install a certificate on Android 1.

Hello, I need to install a certificate, however not find a way. I have
the file ".cer". How I can install the certificate on Android 1.5?

Thanks for your help

-- 

2. Sd card detection while camera application is running

How do I detect the SD card removal/insertion while the camera
application(default google Froyo app) is running??. when i boot up my
device and remove the sd card I am able to recieve an intent to the
broadcast reciever in the application indicating the removal of
sdcard. But,when I put the device to sleep (screen-off) , wake up the
device after some time and launch the camera application , I am not
able to get any intents to the camera app indicating insertion/removal
of sdcard. Can anyone Please help me out with this problem??.. Is
mediaScanner the problem??..

What triggers the detection of Sd card on android??



Thanks in advance

-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

3. Problem : Eclair Porting on SMDK6410 : Linux Kernel-2.6.29

4. pthread_attr_setinheritsched support in Android

5. Problem with gralloc and copybits

6. Robot Ijo tak berdaya di Kota Kuningan Jawa Barat!

7. Aplikasi buat install APK di sdcar