• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Still not sure I understand the reason for intents

 
James Elsey
Ranch Hand
Posts: 228
Android IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Ankit Garg
Sheriff
Posts: 9519
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Monu Tripathi
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic