Lab4 - Intents and Permissions CMSC 436 Lab 4 Derek Juba...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
Intents and Permissions CMSC 436 Lab 4 Derek Juba
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Permissions Task 1- Detect whether wifi is enabled or disabled and report the state in a text message
Background image of page 2
Permissions First, try getting the wifi state and setting a text view based on it WifiManager wifiManager = (WifiManager)getSystemService(Context.WIFI_SERVICE); if (wifiManager.isWifiEnabled()) { wifiText.setText("Wifi Enabled"); } else { wifiText.setText("Wifi Not Enabled"); }
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Permissions Note that running this generates an error message The reason is that you need to give the app permission to access the wifi state Add a uses-permission tag in AndroidManifest.xml The permission you will need to set is "android.permission.ACCESS_WIFI_STATE"
Background image of page 4
Intents Task 2- Use an Intent to transfer some data from one activity to another First, add a button to start a new activity
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Intents Pressing the button should start a new activity which should display some values sent to it from the original activity
Background image of page 6
Intents There are two types of Intents- Explicit and
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 12

Lab4 - Intents and Permissions CMSC 436 Lab 4 Derek Juba...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online