title: How to connect an android widget to my android application? both are my Android applications
body: <p>I want to combine my widget and one of my android application..</p>
  
  <p>Is it possible to do that?</p>
  
  <p>My plan is, once user open up my android widget, the widget will directly open up my android application?</p>
  
  <p>Is there any way how?</p>
  
  <p>I made some method here from my widget class:</p>
  
  <pre><code>public class ExampleAppWidgetProvider extends AppWidgetProvider {
  
  public void onUpdate(Context context, AppWidgetManager appWidgetManager,
  int[] appWidgetIds) {
  for (int i = 0; i &lt; appWidgetIds.length; i++) {
  int appWidgetId = appWidgetIds[i];
  
  Intent intent = startActivity(new Intent("com.xxx.yyy.widget.FlamingoActivity"));
  PendingIntent pendingIntent = PendingIntent.getActivity(context, 0,
  intent, 0);
  
  RemoteViews views = new RemoteViews(context.getPackageName(),
  R.layout.widget1);
  
  views.setOnClickPendingIntent(R.id.Image, pendingIntent);
  appWidgetManager.updateAppWidget(appWidgetId, views);
  }
  }
  </code></pre>
  
  <p>I tried to call the second app, FlamingoActivity, but its failing.. :(</p>
  
  <p><strong>NOT THE FULL SOLUTION:</strong></p>
  
  <p>I should change this line</p>
  
  <pre><code>Intent intent = startActivity(new Intent("com.xxx.yyy.widget.FlamingoActivity"));
  </code></pre>
  
  <p>to this:</p>
  
  <pre><code>Intent intent = new Intent(context, FlamingoActivity.class);
  </code></pre>