I need to create an Intent inside another Intent

Asked

Viewed 72 times

2

Created a Widget APP with 3 buttons.

In this code snippet assigns 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"));
        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://answall.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 would like to make a change to mine intents. Before each action of these I wanted first to direct my user to the MainActivity.

Click > Mainactivity > Clicked functionality.

1 answer

0

Seven a different Action or Extra on each of the intents and then on Mainactivity recover the same and do the necessary action based on what was captured.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.