• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

"Learn Java for Android Development" - is android development largely event driven?

 
atul khot
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
button presses / battery going low / out of network etc...

Is it largely event based way of things?

I am thinking in terms of a message queue of events - and these get pulled out - and acted upon...

Is this the right way to think about it?

--- regards atul
 
Jeffrey Friesen
Author
Ranch Hand
Posts: 67
5
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Atul,

Android uses events extensively throughout its architecture. Regarding button clicks, Android sends a button-click event. Your android.widget.Button instance (http://developer.android.com/reference/android/widget/Button.html) would install a click listener to respond to click events.

Android also uses broadcast notifications and intents.

Regarding battery going low, Android broadcasts battery and charging details, as explained at http://developer.android.com/training/monitoring-device-state/battery-monitoring.html.

Regarding network status, http://developer.android.com/training/monitoring-device-state/connectivity-monitoring.html has information on detecting whether or not you are connected to the network. It also discusses registering a broadcast receiver to respond to CONNECTIVITY_ACTION broadcasts from the ConnectivityManager.

All the best.

Jeff
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic