Android - I can't make a widget clickable to launch an intent
<p>I am new to Android development.</p>

<p>I have developed a very simple widget that was meant to interact with the user via an ImageButton.</p>

<p>What I am trying to do now is as follows. When a user taps the button (after adding the widget to their home screen), I want the phone to dial a certain telephone number.
A sort of speed dial for your home screen.</p>

<p>Unfortunately when I tap the button nothing happens.</p>

<p>This is the body of my SpeedDialAppWidgetProvider.onUpdate method:</p>

<pre><code> Log.d("", "beginning of onUpdate");

 final int N = appWidgetIds.length;

    for (int i=0; i&lt;N; i++) {
        int appWidgetId = appWidgetIds[i];

       Log.d("", "dealing with appWidgetId: " + appWidgetId);

        // Create an Intent to launch ExampleActivity
        Intent dialIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:1234567"));
        PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, dialIntent, 0); 


       Log.d("", "pendingIntent classname " + pendingIntent.getClass().getName());

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

       Log.d("", "remoteViews classname " + remoteViews.getClass().getName());

        // Tell the AppWidgetManager to perform an update on the current App Widget
        appWidgetManager.updateAppWidget(appWidgetId, remoteViews);   

        Log.d("", "end of onUpdate");
</code></pre>

<p>I can see the method is called and the result of the logging makes sense.</p>

<p>The speed_dial_appwidget.xml file is like this:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
androidrientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
&gt;

&lt;ImageButton id="@+id/dial_icon"
android:src="@drawable/speed_dial"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/&gt; 
&lt;/LinearLayout&gt;
</code></pre>

<p>Can you please help me with this?</p>

<p>Thanks in advance,
Dan</p>

<hr>

<p>Thanks for your answer.</p>

<p>Your point was valid. I then added this to my manifest:</p>

<pre><code>&lt;uses-permission android:name="android.permission.CALL_PHONE" /&gt;
</code></pre>

<p>But that didn't help.</p>

<p>The only errors I get are:</p>

<pre><code>05-23 18:41:08.932: ERROR/ActivityThread(655): Failed to find provider info for android.server.checkin
05-23 18:41:11.761: ERROR/ActivityThread(655): Failed to find provider info for android.server.checkin
05-23 18:41:14.372: ERROR/ActivityThread(655): Failed to find provider info for android.server.checkin
05-23 18:41:14.781: ERROR/ActivityThread(655): Failed to find provider info for android.server.checkin
05-23 18:41:43.892: ERROR/ActivityThread(676): Performing pause of activity that is not resumed: {com.android.launcher/com.android.launcher.Launcher}
05-23 18:41:43.892: ERROR/ActivityThread(676): java.lang.RuntimeException: Performing pause of activity that is not resumed: {com.android.launcher/com.android.launcher.Launcher}
05-23 18:41:43.892: ERROR/ActivityThread(676):     at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2809)
05-23 18:41:43.892: ERROR/ActivityThread(676):     at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2797)
05-23 18:41:43.892: ERROR/ActivityThread(676):     at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:2780)
05-23 18:41:43.892: ERROR/ActivityThread(676):     at android.app.ActivityThread.access$2000(ActivityThread.java:112)
05-23 18:41:43.892: ERROR/ActivityThread(676):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1699)
05-23 18:41:43.892: ERROR/ActivityThread(676):     at android.os.Handler.dispatchMessage(Handler.java:99)
05-23 18:41:43.892: ERROR/ActivityThread(676):     at android.os.Looper.loop(Looper.java:123)
05-23 18:41:43.892: ERROR/ActivityThread(676):     at android.app.ActivityThread.main(ActivityThread.java:3948)
05-23 18:41:43.892: ERROR/ActivityThread(676):     at java.lang.reflect.Method.invokeNative(Native Method)
05-23 18:41:43.892: ERROR/ActivityThread(676):     at java.lang.reflect.Method.invoke(Method.java:521)
05-23 18:41:43.892: ERROR/ActivityThread(676):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
05-23 18:41:43.892: ERROR/ActivityThread(676):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
05-23 18:41:43.892: ERROR/ActivityThread(676):     at dalvik.system.NativeStart.main(Native Method)
</code></pre>

<p>The strange thing is: even before adding the uses-permission tag, I didn't see any error message about not having enough permission.</p>

<p>I don't understand.</p>
