


the created uri will be content:// instead of file:/// creating temporary read/write grant permission without user consent or involvement securing your app files and information you want to share We can use classic path using file:///, but in recent & coming versions of android it is a mistake, Android forces us to use fileprovider because of many reasons, the most ones: Let's exploring more of them now because we'll want them a lot in next tutorial parts.ġ- When you miss important part of message (intent), Android OS evaluates the most suitable property/method for it, simply Android OS try to fill the blank you missed It will fill it automatically & send your message, or pick a list of choices for user to select/fill manually, or if Android OS can't evaluate missed info: simply your app will CRASH!Įxample 1: intent says: Hey Android: show me the contact people number 100 in the list, note we don't specify the target app by setPackage, we let this on android to decide which target app or android requests the user to select the appropirate app.Īs you see we used fileprovider to fill the path of image. In previous part we simply exploring top most intent methods/properties, In fact there are more properties & methods intent has. So, Android os can modify your message or adding extra parameters/actions to your message to be deliverable. I am getting the entered value as a string then I have to pass this data.Intent (specific/intentional message between android apps) is not sent directly from your app to another app, It sent to android os which handle it & make decision for delivering it to another app. Then with the help of myEditText.getText().toString(). That is I have an editText where I am getting string whatever user types.

I know it is very basic question but unfortunately I am stuck here.Įdit: Here the string which I am trying to pass from one screen to the other is dynamic.

TODO here get the string stored in the string variable and do TextView userName = (TextView)findViewById(R.id.userName) Intent i = new Intent(FirstScreen.this, SecondScreen.class) Īnd then in the SecondScreen.java public void onCreate(Bundle savedInstanceState) Now, I want to send this data from one activity to another activity. Can someone please tell me how exactly to use getExtra() and putExtra() for intents? Actually I have a string variable, say str, which stores some string data.
