Intents

https://fbombmedia.com/wp-content/uploads/2014/11/intent-filters@2x.pngAn Intent is an object that provides runtime binding between separate components, such as two activities. The Intent represents an app’s “intent to do something.” You can use intents for a wide variety of tasks, but in this lesson, your intent starts another

activity.

An intent is an abstract description of an operation to be performed. It can be used with startActivity to launch an Activity, broadcastIntent to send it to any interested BroadcastReceiver components, and startService(Intent) or bindService(Intent, ServiceConnection, int) to communicate with a background Service.

An Intent provides a facility for performing late runtime binding between the code in different applications. Its most significant use is in the launching of activities, where it can be thought of as the glue between activities. It is basically a passive data structure holding an abstract description of an action to be performed.

Developer Guides

For information about how to create and resolve intents, read the Intents and Intent Filters developer guide.

 

Η κλάση Intent

Ο ρόλος ενός intent είναι να ειδοποιηθεί το ActivityManagerService ότι ο χρήστης επιθυμεί να γίνει κάποια ενέργεια

Ένα intent είναι ένα αντικείμενο  της κλάσης Intent το οποίο περιέχει κάποιο περιεχόμενο (το μήνυμα του intent)

Μέσω των intents μπορούμε να ξεκινήσουμε την εκτέλεση των Activities, των Services και των Broadcast Receivers

Ένα activity μπορεί να εκτελεστεί με χρήση των

  •       Context.startActivity (Intent intent)
  •        Activity.startActivityForResult (Intent intent, int RequestCode)

Ένα service μπορεί να εκτελεστεί με χρήση της

  •       Context.startService (Intent service)

Μια εφαρμογή μπορεί να δημιουργήσει ένα broadcast μήνυμα με χρήση του intent

  •     Context.sendBroadcast(Intent intent),
  •     Context. sendOrderedBroadcast(Intent intent, String receiverPermission)
  •     Context. sendStickyBroadcast(Intent intent)

 

Περισσότερα εδώ

 

 

Κύλιση στην κορυφή