aspose file tools*
The moose likes Android and the fly likes Still not sure I understand the reason for intents Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "Still not sure I understand the reason for intents" Watch "Still not sure I understand the reason for intents" New topic
Author

Still not sure I understand the reason for intents

James Elsey
Ranch Hand

Joined: Dec 21, 2007
Posts: 228

Hi,

I've been reading the documenation on Intents on the android site, but I'm still not sure I understand, or even see the benefits they bring.

If I want to pass state between activities, I would create a global object which I can have available everywhere, if I want to call another activity then I would embed it in a tab, so what benefits do intents give me?

I'm trying to think of them in a scenario that would actually help me, so I can understand better. For example I have some data displayed on my UI, from my activity. I want to refresh that data, how does an Intent help me do that?


Kind Regards, James. OCPJP 1.6 || My SCJP / OCJCP Study Notes
Interested in : SCJP, Google App Engine, Stripes, Android;|| My Bite-Size SCJP Study Blog
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9302
    
  17

For example I have some data displayed on my UI, from my activity. I want to refresh that data, how does an Intent help me do that?

Intents are for a completely different purpose. Read about Cursor.
If I want to pass state between activities, I would create a global object which I can have available everywhere

What if the activity you launch is not in your application?? Intents can be used to invoke activities which may not be a part of your own application...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Monu Tripathi
Rancher

Joined: Oct 12, 2008
Posts: 1369
    
    1

Still not sure I understand the reason for intents

It is important that you think beyond applications and understand the notion of Tasks. In Android, a set of Activities collaborate to help a user perform certain task(like taking a picture, uploading some picture some where etc.). A user may use different activities from same/different applications to perform these tasks.

Intents allow for a signaling mechanism and easy communication between activities that may be part of different applications - you can call something that already exists in the system and bring it to use in your application.

Intents are NOT so much for data manipulation but for signaling and message passing.


[List of FAQs] | [Android FAQ] | [Samuh Varta]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Still not sure I understand the reason for intents