XAM1 - Android Flashcards
In Android everything is done with what?
- Activities
What does an Activity consist of?
- XML layout (axml)
- C# code file
How do you define app primary entry point?
- MainLauncher = true
Can you include java jar libraries in Xam Android apps?
- yes
- there are 2 methods
- one easier, one more complex
How do you associate Activity code behind to UI markup?
- SetContentView
How do you access controls on UI view?
- FindViewById
- ex FindViewById(Resource.Id.myButton)
What are Views?
- Sometimes called widgets
- ex TextView, EditText, Button
What are types of Layouts?
- LinearLayout (like StackLayout)
- GridLayout
- RelativeLayout
- NestedLayout (nest other layout types)
Where are layouts located?
- they are considered Resources so go under Resources folder in axml files
Properties on UI views should use what syntax?
- android: namespacing convention
What does compiling an Android app include?
- Java SDK (JDK)
- Android SDKs
- Mono.NET
Can you code against specific Android versions?
- yes
- use Android.OS.Build.VERSION.SdkInt checked against Android.OS.BuildVersionCodes.whatever enum
What is Context in Android?
- represents Android runtime environment surrounding your activity and also provides additional services
What is Explicit Intent?
- you are telling Android exactly what you want to load
- generally used to start Activity inside your APK
What is Implicit Intent?
- tell Android you need to do something and it will decide what to load
- often loads outside of your APK
- ex; I want to take a picture
What is an Intent?
- a request sent to Android telling it about activity you want
- pass it a Context (this, current Activity) and a Type (typeof(NewActivity))
How do you pass data between Activities?
- Bundles, key value pairs of simple types or serialized objects
- intent.PutExtra
How do you fire a new Activity?
- StartActivity or StartActivityWithResult
What are 3 return types for an Activity?
- no return
- success/fail
- success/fail with data
What happens when an Activity with result returns?
- fires OnActivityResult in source passes back RequestCode (INT)
How do you setup an Implicit Intent?
- use intent.SetAction to set action type
- use intent.SetData and intent.PutExtra to provide extra information per documentation
Can you verify an implicit intent is available at runtime?
- yes
- intent.ResolveActivity(PackageManager)