I need to create an intent within another intent

2

I created an APP Widget with 3 buttons.

This section of code assigns the button functions:

for (int i = 0; i < N; i++) {
        int appWidgetId = appWidgetIds[i];
        RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.activity_widget);

        Intent intent_busca = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.google.com.br"));
        PendingIntent pending_busca = PendingIntent.getActivity(context, 0, intent_busca, 0);

        Intent intent_exemplo = new Intent(context, ExemploActivity.class);
        PendingIntent pending_exemplo = PendingIntent.getActivity(context, 0, intent_exemplo, 0);

        Intent intent_stack = new Intent(Intent.ACTION_VIEW, Uri.parse("https://pt.stackoverflow.com"));
        PendingIntent pending_stack = PendingIntent.getActivity(context, 0, intent_stack, 0);


        views.setOnClickPendingIntent(R.id.widget_busca_btn, pending_busca);
        views.setOnClickPendingIntent(R.id.widget_exemplo_btn, exemplo_scan);
        views.setOnClickPendingIntent(R.id.widget_stack_btn, pending_stack);

        appWidgetManager.updateAppWidget(appWidgetId, views);
    }

However, I wanted to make a change to my intents . Before each such action I wanted to first direct my user to MainActivity .

  

Click > MainActivity > Functionality clicked.

    
asked by anonymous 19.05.2017 / 19:32

1 answer

0

Seven a different Action or Extra on each of the intents and then on the MainActivity retrieve the same and do the action required based on what was captured.

    
20.05.2017 / 02:37