M
M
mitaichik2021-12-02 23:08:31
Android
mitaichik, 2021-12-02 23:08:31

Is there a tool to bind parameters from an intent to an activity/fragment?

Friends, hello everyone!

Is there any simple library for binding/injecting parameters behind an Intent in an Activity?
Preferably something native from Google.
Here they came up with some new DI - Hilt - maybe it has it (didn't find it)?

Something like

static void open(Context context, String code)
  {
    Intent intent = new Intent(context, TestActivity.class);
    intent.putExtra("code", code);
    context.startActivity(intent);
  }

        // ------------

        public class TestActivity extends BaseActivity
        {

          @InjectExtra
           protected String code;
         }


There is such a thing as self-writing, I wrote it about 8 years ago, on reflection.
Haven't they come up with something standard during this time?

Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg, 2021-12-03
@402d

Why would you? Do you have many different options?
Read about parceable . Instead of a bunch of extras, one object

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question