Android Question How to convert getIntent() to parseUri(...,...) ??? in an activity ? Android/Java


New Member
Hi I have this code in my sub-activity:

Intent intent = getIntent();
message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);

and the code is working ok, but the getIntent(); command is labeled as "deprecated", so I would like to replace it with parseUri, but my new code
does not work:

Uri imageUri = getIntent().getData();
Intent intent = (android.content.Intent) parseUri( imageUri.toString(), Intent.URI_INTENT_SCHEME);

can someone help me ?

here is complette source code:
for AndroidStudio2022/Java


Well-Known Member
Licensed User
Longtime User
this is a forum for development in b4x, not android studio. you should
probably try stackoverflow for help with android studio.

activity.getintent() is not deprecated. intent.getintent(string uri) is.
parseuri() creates an intent, which is not what you are trying to do.
you are trying to extract the data from an already existing intent.

b4x supports intents nicely. welcome to b4x
Upvote 0