title: Android: click on widget event
body: <p>I am completly new to android programming and I try to get clicking on an android widget working:</p>
  
  <pre><code>public class MyWidget extends AppWidgetProvider {
  public void onUpdate(Context context, AppWidgetManager appWidgetManager,
          int[] appWidgetIds) 
  {
  // Loop through all widgets
  for(int i=0;i &lt; appWidgetIds.length;i++) {
      int appWigedid = appWidgetIds[i];
      // Create an intent to launce something
      Intent intent = new Intent(context,TestActivity.class);
      PendingIntent pendingintent = PendingIntent.getActivity(context, 0, intent, 0);
  
  
      // Get the layout for the app widget and attach on click listener
      RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.initial_layout);
      views.setOnClickPendingIntent(R.id.UselessMessage, pendingintent);
      views.setTextViewText(R.id.UselessMessage,"This text is useless");
      AppWidgetManager manager = AppWidgetManager.getInstance(context);
      manager.updateAppWidget(appWigedid,views);
  }
  }
  </code></pre>
  
  <p>my TestActivity class is just a stub because still trying to find out how it is called.</p>
  
  <pre><code>public class TestActivity extends Activity {
  @Override
  protected void onStart() {
      System.out.println("On Start called!");
  }
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      System.out.println("on create called!");
  };
  </code></pre>
  
  <p>}</p>
  
  <p>The setting of the Text works. But the onStart method of the TestAcitivity is never executed (other sysout messages work). When I tap on the widget android logs:</p>
  
  <pre><code>12-25 17:17:43.054  1279  1392 I ActivityManager: Starting activity: Intent { flg=0x10000000 cmp=org.rfc1149.android.simple/.TestActivity bnds=[120,272][360,371] }
  </code></pre>
  
  <p>which would suggest that the activity is created but the onCreate does not work.</p>