[GUIDE] Using the Share Intent - Java for Android App Development

Hello everyone,
While making an app, I wanted to let the user be able to share some content (shameless plug: from a clearable EditText). So, I looked up how to do this.
In this thread, I will share (pun not even intended) with you how to use the Share Intent yourself, so that your users can also quickly involve anyone they know in what they're doing.
There are some things that I am going to assume you've done:
- You have made your base app
- You have a Button done and set up, only needing a method to execute the Share Intent.
Now, let's get to it!
Step 1 - The method:
First, you have to set up the method. As always, give it a nice and descriptive name, so everyone (including you later, believe me that you'll need it) knows what it does.
Of course, this just follows standard syntax. I'm going to name it share, because simple!
So, you'll get this:
Code:
private void share() {
// This is the method where we share some content
}
Step 2 - The Intent:
You want to make sure that Android recognises your Intent as being a Share Intent. Of course, because of the flexibility of Intents, this is also easily done. Just declare another parameter, which isn't the usual set of Classes.
My Intent will be called shareIntent.
Like so:
Code:
Intent shareIntent = new Intent(android.content.intent.ACTION_SEND);
Step 3 - The type:
When sharing content in Android, you have to let the system know what you're sharing. Naturally, it has to react differently to different types of content. An image can be handled by certain apps, while others can only handle text. Apart from that, the apps have to process the items differently.
This is done by declaring the MIME type, which are unique identifiers for different data types.
Some possible types are text/plain, image/gif and video/mp4.
In this case, we are going to share some text. This is done by adding the following line under the Intent declaration:
Code:
shareIntent.setType("text/plain");
With the setType method, you could target specific apps. However, this is obviously not a good idea. If a user doesn't have that app on their phone, it'll cause trouble. Therefore, just use the right type and let the user select the relevant application.
Step 4 - The Content:
Now for the real work. What are you sharing? Of course, text! But you have to give the Intent that text, because it won't just snuff it out by itself.
How do we do this? Simple, again.
Just create a String and use that. Of course, you can hard code a String in the Intent, but it's best to use a variable. After all, you're probably going to be sharing dynamic content.
This is done as follows, though you should really know this by now:
Code:
String sharedString = "Hey, we are sharing!";
Step 5 - The extras:
You have to also give the Intent its extra information. For this example, we'll be setting two types of extras: a subject and the body.
This way, there is flexibility. If the user chooses to share the text using an email application, the subject will also be used. If they don't, it won't be used.
This is done by adding the following lines to your sharing method:
Code:
shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "This is the subject");
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, sharedString);
Step 5 - The Chooser:
Whenever you share something, you see the Dialog pop up for you to select the app you want to use in your sharing the content. This is the next and last step in this guide, and is basically just starting the Intent with a special parameter.
Not every type of media can be shared to every app. When you share certain content, Android looks at what apps have declared themselves candidates for that MIME type.
So, if you are not seeing certain apps appear, check whether the app can work with that MIME type!
Start the Intent like this:
Code:
startActivity(Intent.createChooser(shareIntent, "Share via"));
Of course, the title to the chooser doesn't have to be "Share via". It can be any other text or variable (keep this in mind for apps that have translations!).
Facebook doesn't do this right! The facebook app doesn't do sharing right, so it will probably not show up in the list of apps that you might see when following the tutorial. To counteract this, target the app using the specific API.
Have fun sharing, and thanks for reading!
P.S.: Images can be added, should anyone want me to do so.

I also found this for the ActionBar very interesting: http://developer.android.com/reference/android/support/v7/widget/ShareActionProvider.html

nikwen said:
I also found this for the ActionBar very interesting: http://developer.android.com/reference/android/support/v7/widget/ShareActionProvider.html
Click to expand...
Click to collapse
True, the ShareActionProvider is quite nice but has one really big downside: You have to update it with the Intent BEFORE the user clicks the item, and there is no workaround. So if you want to generate an image when the user clicks share, you cannot use the ShareActionProvider.
And thanks for the guide OP!

SimplicityApks said:
True, the ShareActionProvider is quite nice but has one really big downside: You have to update it with the Intent BEFORE the user clicks the item, and there is no workaround. So if you want to generate an image when the user clicks share, you cannot use the ShareActionProvider.
And thanks for the guide OP!
Click to expand...
Click to collapse
Wouldn't it be possible to extend the class? Maybe it could be achieved that way.

nikwen said:
Wouldn't it be possible to extend the class? Maybe it could be achieved that way.
Click to expand...
Click to collapse
Could work, but I have no idea what methods to override... I need to have a closer look at this.

Related

Detect Package Launch

I am working on an application and I need to be able to have a service that can detect when applications are opened, and take action based on that.
I have looked everywhere, and have not found a way to do so. I have read documentation on broadcast receivers, intent handlers, I found nothing.
I did however, find an app that can do so. App Protector. It allows password protecting certain applications.
Can anybody please point me in the right direction?
Thanks!
this is actually a very good question. a BroadcastReciever only gets Intents directed at it, and wouldnt see Intents for other classes and Packages.
ill be very interested to know the answer
killersnowman said:
this is actually a very good question. a BroadcastReciever only gets Intents directed at it, and wouldnt see Intents for other classes and Packages.
ill be very interested to know the answer
Click to expand...
Click to collapse
Well I was looking for a BroadcastReceiver that was sent out by the system to indicate that an app was opened, but I did not come across anything.
this isnt possible.. to be able to monitor all intents would make android extremely insecure
http://groups.google.com/group/android-developers/browse_thread/thread/54ddc9d36a24d77b
but there are ways to know when an application is launched. you just have to be creative.
this will give you a list of all the applications running.
Code:
ActivityManager am = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningAppProcessInfo> runningAppProcessInfo = am.getRunningAppProcesses();
however to know when an app is launched you would need a timed loop and then check between versions of the List to see if there is a new app. this would suck the juice and be inneficient
AppProtector seem to access the eventlog. maybe you could have a ContentObserver attached to the event log
http://developer.android.com/reference/android/util/EventLog.html
http://developer.android.com/reference/android/database/ContentObserver.html
killersnowman said:
this isnt possible.. to be able to monitor all intents would make android extremely insecure
http://groups.google.com/group/android-developers/browse_thread/thread/54ddc9d36a24d77b
but there are ways to know when an application is launched. you just have to be creative.
this will give you a list of all the applications running.
Code:
ActivityManager am = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningAppProcessInfo> runningAppProcessInfo = am.getRunningAppProcesses();
however to know when an app is launched you would need a timed loop and then check between versions of the List to see if there is a new app. this would suck the juice and be inneficient
AppProtector seem to access the eventlog. maybe you could have a ContentObserver attached to the event log
http://developer.android.com/reference/android/util/EventLog.html
http://developer.android.com/reference/android/database/ContentObserver.html
Click to expand...
Click to collapse
Interesting.
I also found this:
Code:
String str = ((ActivityManager.RunningTaskInfo)this.am.getRunningTasks(1).get(0)).topActivity.getPackageName();
It's one of the things App Protector uses
It starts a new intent, pointing to their application, and passing the parameters of the package you tried to run
Take a look at Tasker it can defiantly do this.
rujelus22 said:
Take a look at Tasker it can defiantly do this.
Click to expand...
Click to collapse
He doesn't want it for scripting, but for use in his own program.
From something awesome

Developer with a Marketing question!

I'm a programmer; I don't do Sales, I don't do Marketing LOL
I'm working on an app that has my partner and I debating on pretty much a daily basis. I'll try to explain best as possible without too much detail.
The app takes a pre-loaded database (a "template") from assets folder and loads into the app. Works fine. Thing is, there will be more templates, probably up to 20 for which we want to charge (we're talking small amounts here).
So, here is the debate we're having:
1. Create 20 apps with each having the one template. Easy as hell for me but goes against my programming standards as to why have 20 apps when ONE does the work? NOTE: Does not need any permissions
2. Create one app, ask user for template on startup, download from cloud. A little tougher, but not much. Problem here is that what if they want 2 templates? Or 5? We want to charge for each template. I could do "AppName +2" or "AppName +5"
versions and charge accordingly. NOTE: Max templates a user would have is probably 5.
3. In-app purchasing...I've read about this. Not so easy. You either hide content (and over bloat your app or code a mechanism that allows Joe to have in-app purchase app, but not Julie). Google makes clear note of this in their docs. NOTE: my bloat would be about a 7,000 row database on user's phone.
So, just looking for some other opinions...all comments welcome!
TIA,
Roots
From what I can understand, I think # 1 is the most tried and true method, as most launchers with themes work this way. The upside for you as far as making money is concerned is that there are people who want all their options, whether or not they will ever use them... I have been guilty of it myself with lp+ themes. I've paid for ones I'll never use, because it's there and most apps tend to be in the "impulse buy" price range.
I agree, #1 is your best option, it may require a lot more work as far as deploying goes, but it is the most reliable method.
Interesting! Thank you for your replies.
A little more information...the templates (e.g. database) will probably never change from initial download, so that update is a moot point.
One thing I didn't think about is creating and SAVING 20 keys!!! Yikes. I've lost those before...very bad situation when that happens. Not to mention 20 distinct package names.
One thing I didn't think about is creating and SAVING 20 keys!!! Yikes. I've lost those before...very bad situation when that happens. Not to mention 20 distinct package names.
Click to expand...
Click to collapse
You can sign all packages with the same key.
As of package names, all you need is to change the application package not the code packages. The ADT has a tool for renaming application packages.
1. Create 20 apps with each having the one template. Easy as hell for me but goes against my programming standards as to why have 20 apps when ONE does the work? NOTE: Does not need any permissions
Click to expand...
Click to collapse
Here is my suggestion, although I never tried it:
Create 20 apps for templates with no logic at all.
For each one of these apps:
(1) Put a single template file in the res/raw folder
(2) Create an Activity that doesn't do anything at all (call finish on onCreate).
(3) Set intent-filter for your null activity with android.intent.action.MAIN and your own custom category.
Create 1 main application with all application logic and code but with no templates at all (or just one default template).
(1) Search for installed templates using PackageManager.queryIntentActivities with an Intent that match Intent.ACTION_MAIN and your custom category.
(2) Read templates using Context.createPackageContext, getResources of the created context, getIdentifier to find the id of the template file and openRawResource to actually open it as an InputStream.
There are other methods to share resources, take look at android:sharedUserId.
Interesting concept, but if I read it right, I sill need 20 "dummy" apps to go with the main "driver".
I've got some time to mess with this because I have to implement drag and drop on some ListViews. I might just end-up coding the in-app purchase stuff.
EDIT: LOL, I can't wait till I can afford an iPad and port all my stuff to iOS

[Q] Editing an app

Hello,
I'm editing an app using APKGUI, mostly to modify the look to conform more to holo style. I would, however, like to modify it a little. It is a messaging app and i want to put pictures of those who sent the message next to the message (line in hangouts) but I can't get it to work by editing the XML. Is there any way to do this through APKGUI modifications or not?
Thanks.
Nickcu13 said:
Hello,
I'm editing an app using APKGUI, mostly to modify the look to conform more to holo style. I would, however, like to modify it a little. It is a messaging app and i want to put pictures of those who sent the message next to the message (line in hangouts) but I can't get it to work by editing the XML. Is there any way to do this through APKGUI modifications or not?
Thanks.
Click to expand...
Click to collapse
depends on the app but I would suspect not as you would need code to resolve from a content provider to then populate the item (ImageView) in the row. So that would be in the adapter code powering the listView in the app
deanwray said:
depends on the app but I would suspect not as you would need code to resolve from a content provider to then populate the item (ImageView) in the row. So that would be in the adapter code powering the listView in the app
Click to expand...
Click to collapse
is there any way to get into the code?
Nickcu13 said:
is there any way to get into the code?
Click to expand...
Click to collapse
yeah if it's not too obfuscated when decompiled and you know how to query a content provider and load images, maybe not doing said actions on the ui thread but on another thread.. use smart messenger instead when I'm done you will be able to create a UI to your own needs </shamelessplug>
deanwray said:
yeah if it's not too obfuscated when decompiled and you know how to query a content provider and load images, maybe not doing said actions on the ui thread but on another thread.. use smart messenger instead when I'm done you will be able to create a UI to your own needs </shamelessplug>
Click to expand...
Click to collapse
basically all i need to do is get to the coding of one section where the profile image is displayed, and copy the query into the new section. but i don't know how to do that or where to find it in the decompiled part. It's not a normal messaging app, it's more of a people discovery app with messaging haha.
Nickcu13 said:
basically all i need to do is get to the coding of one section where the profile image is displayed, and copy the query into the new section. but i don't know how to do that or where to find it in the decompiled part. It's not a normal messaging app, it's more of a people discovery app with messaging haha.
Click to expand...
Click to collapse
it is not really a copy paste and work job Or that would be like, 0.0001% probability of working
deanwray said:
it is not really a copy paste and work job Or that would be like, 0.0001% probability of working
Click to expand...
Click to collapse
and why is that?
Nickcu13 said:
and why is that?
Click to expand...
Click to collapse
cause you would possibly need the following, get the contact id from the row from xxx variable/data, construct the now unique uri to pass to a content resolver to lookup the image uri and or path, then get an instance of the row imageView (or whatever view was going to hold the image) then pass that to a loader/async/new thread along with the uri for that then to load in the background, then check that when loaded the imageView instance is still the same (due to the way android recycles views) before setting it back on the main ui thread.
So a recap on the variable/s
imageView
contact id source (of that row)
the instance and data tracking in a thread
so these things are not something you can find in one app or even from the same app and "paste" into another section.
hope that, well, makes enough sense to know it's not a copy paste thing
deanwray said:
cause you would possibly need the following, get the contact id from the row from xxx variable/data, construct the now unique uri to pass to a content resolver to lookup the image uri and or path, then get an instance of the row imageView (or whatever view was going to hold the image) then pass that to a loader/async/new thread along with the uri for that then to load in the background, then check that when loaded the imageView instance is still the same (due to the way android recycles views) before setting it back on the main ui thread.
So a recap on the variable/s
imageView
contact id source (of that row)
the instance and data tracking in a thread
so these things are not something you can find in one app or even from the same app and "paste" into another section.
hope that, well, makes enough sense to know it's not a copy paste thing
Click to expand...
Click to collapse
so if it does all that once, all i need to to is copy and paste it, then change the variables to be unique.
Nickcu13 said:
so if it does all that once, all i need to to is copy and paste it, then change the variables to be unique.
Click to expand...
Click to collapse
well no, each one of those happens for every row, also you would have to "find" the data and instances to make it happen. example would be simply finding the resource ident (integer) for the imageView and grabbing an instance of it. findViewById(R.id.someIDofImageView) but then to avoid constant findViewById lookups on recycled views you would use a viewholder pattern, that then you would create a new object class that would hold this (cause lookups for the same ident on the same row many times when scrolling would not be great)... and more stuff, and thats just for the imageView instance part... clearer ?
I guess my point would be it's more involved that you perhaps think it is. Specially if you know little or no android/java
deanwray said:
I guess my point would be it's more involved that you perhaps think it is. Specially if you know little or no android/java
Click to expand...
Click to collapse
Another thing not to forget is the APK signature. If you unpack, edit and repack an APK you must sign it, othewise the installation will fail.

Way to store Preferences

Hey Guys,
I am creating a app to rename other apps via xposed and the main code is written. Now I simply want to make a interface where you can define a app to rename and then enter a new name. For the beginning I thought about a Activity where you enter the Package Name and the desired name. Later on I want to use a list view to show all apps, from where you can choose one to rename(Like App Settings etc.). To show the renamed apps I want to use a ListView. Now I am stuck with a problem: My xposed code works with an array to check and rename. The list view can be used with an array or an arraylist, but I need a way to store the preferences(which are stored in a array).
Do you have a good idea or a sample how to realise this? And does somebody know a nice App List type of thing(I googled, but the project there aren't usable with my kind of approach.)
GalaxyInABox said:
Hey Guys,
I am creating a app to rename other apps via xposed and the main code is written. Now I simply want to make a interface where you can define a app to rename and then enter a new name. For the beginning I thought about a Activity where you enter the Package Name and the desired name. Later on I want to use a list view to show all apps, from where you can choose one to rename(Like App Settings etc.). To show the renamed apps I want to use a ListView. Now I am stuck with a problem: My xposed code works with an array to check and rename. The list view can be used with an array or an arraylist, but I need a way to store the preferences(which are stored in a array).
Do you have a good idea or a sample how to realise this? And does somebody know a nice App List type of thing(I googled, but the project there aren't usable with my kind of approach.)
Click to expand...
Click to collapse
Ah the data storage problem... I think we all came across this at least once . I suppose you read this guide on the different options available? Well there are actually three options: SharedPreferences, text or csv file and SQL.
The first one would need some work around and is probably the slowest. You would save a separate string directly into the SharedPreferences (maybe in a new file to avoid collisions?) with the array name and its index somehow in the key. That's just two methods of coding but not the nicest way to do it.
The text or csv file however is the more common way, here you'd save your array in one line of the file, each item separated with a ; or some other char. Needs a bit more coding and also the WRITE_EXTERNAL_STORAGE permission on preKitKat if I remember correctly.
The third one is the nicest and most modular one. Because it makes use of SQL it needs quite a bit of knowledge and some coding (but less than the text file).
I guess for simple things that you want to do it is better to stay away from SQL for now unless you know how to use it and use the SharedPreferences.
Edit: take a look at the answers to this question, they give you the code as well... And you can use StringSets in ICS and above if the order of your list doesn't matter !
I'd say go down the SQLite DB way, chances are that if you plan on expanding your coding knowledge and want to keep creating apps you'll be needing to learn this in the future anyway so why delay?
Google AndroidHive and look at their SQL tutorial - I used it when learning and found it very informative
Sent from my HTCSensation using Tapatalk
Thank you very much! As coming from windows, first of all I thought about SQL as well, but it seems oversized for the set of data i want to store. I also took a look at the stackoverflow thread you linked. It looks easy to implement, but the need to use an external class file made me look for another way. I found this one, which works pretty well for me, as I look forward to interchange the method of saving the data with a better one using the SharedPreferences(which actually should be really easy with my code).
Maybe you can tell me yet another thing: Is there a way of declaring an object(like the ArrayList) to make it accessible from every class except from giving every class(activity) it's own "load the preferences" and "save the preferences" code block or sending intents all over the place? This would make saving much easier and allow me to update the preferences during runtime and without a reboot
Edit: This was my answer to.SimplicityApks ^^ I'll take a closer look at SQL now, since you, Jonny, told me that it' nevertheless necessary.
GalaxyInABox said:
Thank you very much! As coming from windows, first of all I thought about SQL as well, but it seems oversized for the set of data i want to store. I also took a look at the stackoverflow thread you linked. It looks easy to implement, but the need to use an external class file made me look for another way. I found this one, which works pretty well for me, as I look forward to interchange the method of saving the data with a better one using the SharedPreferences(which actually should be really easy with my code).
Maybe you can tell me yet another thing: Is there a way of declaring an object(like the ArrayList) to make it accessible from every class except from giving every class(activity) it's own "load the preferences" and "save the preferences" code block or sending intents all over the place? This would make saving much easier and allow me to update the preferences during runtime and without a reboot
Edit: This was my answer to.SimplicityApks ^^ I'll take a closer look at SQL now, since you, Jonny, told me that it' nevertheless necessary.
Click to expand...
Click to collapse
Welcome
You mean you want to make your ArrayList, which is an instance variable in the activity, accessible to every other class within your package without having an instance of your activity at hands? Well the basic solution would be to make the ArrayList static. But that is not recommended because it won't be created and garbage collected at the same time as your activity and also it's not a nice way .
If you had an instance of the activity it would be just using a public getter for it, but without I'd put your ArrayList into a separate class following the Singleton pattern. That way you have only one global instance which contains the ArrayList.
Thanks again for your reply! I changed my mind about the ArrayList and created a method, where everything is stored in the SharedPreferences and the ArrayList's only purpose is the use with the ListView and Adapter. This way I don't have to write the ArrayList to the SharedPreferences and changes will be much easier to control. Although I had to implement another type of save/load method to interact with the class thats being loaded by xposed. That was needed because of the restriction that you can only load SharedPreferences with a context, which my class doesn't have. It's an inconvenient way, but it works

Intent filters

Ok so i used to be a very experienced actionscript user. But i recently wanted to get back into programming so im learning java now or rather trying to.
So im trying to understand the xml side of this so far and have some questions im hoping u guys can answer.
activities
So as i understand it an activity is a screen in an app. So for example the standard launcher on my phone has pages of apps on my main screens. Each one of those would be an activity? And then another activity for when i press the button to display all installed apps?
Have i understood that properly?
intent filters
This is where im getting confused. Ive googled it and read as much as i can find. As i read it, feel like someones explaining rocket science to a 5 year old.
The words component and instances is being thrown around enough that i got no clue whats even being said. What i have understood is it gives data to the activity.
So a best guess from my partwould be its telling it how the screens going to work or maybe like if theres going to be a button on it maybe. Or perhaps it means something different like just the properties sort of stuff like screen size or stuff of that nature.
As u guys can probably tell im confused beyond comprehension. I got no idea how good my grasp is of any of this. But if theres someone out there kind enough to dumb it down a bit so normal people can understand it. Id be very gratefull.
Bump
Bump
Hey,
unfortunately i cant answer your question. This is a part of android I don't understand too.
I think you should post your question again in the Question and Answer forum of XDA. http://forum.xda-developers.com/android/help maybe there is an developer who can help you.
Greetings
Thanks ill post there and see if it makes any difference
Android apps run in sandboxes. Consider a huge box partitioned into 'n' number of sections. Each partitions represent a place in android environment where app can reside. By sandboxing, app are given unique ID(UID) when they start a process. Only apps having same (UID) can access the app's resources so no malicious app can peek into the resources of other app.
If apps cannot see other resources, how could they communicate within apps? Thats where intent comes in. Intents are like post letters and android is the postman. You can either give:
1. Recipient address, here, the package name of the app for which the intent is to be sent and may include your data in the intent if there is any and the postman (android) delivers it to the right person (target app). This is also known as explicit intent because you know the target class to call
2. Intent filter - This is not as specific as the first one. Here, your app has to perform something using an external app but your app doesnt know of the other apps which could perform the action. So, this time it will go for a broadcast and say "Hey! I need to take a picture! All camera apps please come in" and the broadcast is sent by android which displays list of apps which respond to this broadcast. When the user chooses the app to perform the action, the app fires, performs the task for your app, return the data to your app in form of intent result.
To register an app to respond to this type of intent, the app specifies something called intent-filter in their manifest which says the android, in our example context "I can perform camera action". So next time intent for camera action is sent, the app is in the list of apps to perform action with. This type of intent in implicit intent as you let the android and user decide the app. You can also specify your own custom intent-filters apart from standard android ones.
vijai2011 said:
Android apps run in sandboxes. Consider a huge box partitioned into 'n' number of sections. Each partitions represent a place in android environment where app can reside. By sandboxing, app are given unique ID(UID) when they start a process. Only apps having same (UID) can access the app's resources so no malicious app can peek into the resources of other app.
If apps cannot see other resources, how could they communicate within apps? Thats where intent comes in. Intents are like post letters and android is the postman. You can either give:
1. Recipient address, here, the package name of the app for which the intent is to be sent and may include your data in the intent if there is any and the postman (android) delivers it to the right person (target app). This is also known as explicit intent because you know the target class to call
2. Intent filter - This is not as specific as the first one. Here, your app has to perform something using an external app but your app doesnt know of the other apps which could perform the action. So, this time it will go for a broadcast and say "Hey! I need to take a picture! All camera apps please come in" and the broadcast is sent by android which displays list of apps which respond to this broadcast. When the user chooses the app to perform the action, the app fires, performs the task for your app, return the data to your app in form of intent result.
To register an app to respond to this type of intent, the app specifies something called intent-filter in their manifest which says the android, in our example context "I can perform camera action". So next time intent for camera action is sent, the app is in the list of apps to perform action with. This type of intent in implicit intent as you let the android and user decide the app. You can also specify your own custom intent-filters apart from standard android ones.
Click to expand...
Click to collapse
Gave u a thanks fkr that very useful responce. Thank you. So if ive understood this right. If i want to take a picture for example the intent filter part basically calls out for an external app to perform the action. With intent filter so basically when an app asks u with that menu what app youd like to choose thats an intent filter? And implicent thats the same menu or android just chooses it for you? Im trying to picture it from the user-side
Recipient address seems straight forward. You know u need an app and what its called. So u dont even need the user to select anything.
scorpafied said:
Gave u a thanks fkr that very useful responce. Thank you. So if ive understood this right. If i want to take a picture for example the intent filter part basically calls out for an external app to perform the action. With intent filter so basically when an app asks u with that menu what app youd like to choose thats an intent filter? And implicent thats the same menu or android just chooses it for you? Im trying to picture it from the user-side
Recipient address seems straight forward. You know u need an app and what its called. So u dont even need the user to select anything.
Click to expand...
Click to collapse
Your understanding on implicit intent is correct. To make it even more short an precise,
An intent is an abstract definition of the operation to be performed by the app
Click to expand...
Click to collapse
When the target action is known, say you invoke a second activity of you app. You know the target action (the class name), that is your implicit intent. You decide what action to perform without user intervention here. Explicit usually needs user input for inter-app communication to take place.
Examples of few implicit intents:
Starting an activity
Starting a service
vijai2011 said:
Your understanding on implicit intent is correct. To make it even more short an precise,
When the target action is known, say you invoke a second activity of you app. You know the target action (the class name), that is your implicit intent. You decide what action to perform without user intervention here. Explicit usually needs user input for inter-app communication to take place.
Examples of few implicit intents:
Starting an activity
Starting a service
Click to expand...
Click to collapse
Ok cool. So recipient is when we choose the app. Intent is whwn they get a menu to choose it. And implicent is is when android chooses it for them.
Sounds simple enough. Thanks for all the help buddy
And would i be right in assuming that the actions we put in intent filters and the others in form it of stuff like when its triggered, how often and so forth?

Categories

Resources