Mostly Android Flashcards
What are some of the things stored in the android manifest?
- Declares Package name
- Activities
- app name
- launcher icon
- permissions for the app
WHere are these defined: UI and Functionality
XML and Java Code (Activities)
Where in java code do you inflate the XML layout
In the onCreate method
With activity lifecycles, what are the four states?
Active, Visible, Hidden and Destroyed
in the activity stack, what’s the order? (Visible, Destroyed, Active and Hidden)
From top to bottom: Active-Visible-Hidden-Destroyed
When is the R class generated
When the application is compiled
What does the R class contain?
Contains access for all the resources in the res directory.
R.drawable.icon what is the datatype of this command?
A static Integer
How would you access Views? ie TextViews in XML
(TextView) findByView(R.id.textviewidname)
Can you find viewGroups the same way you find Views in java?
Yes, Viewgroups are just special types of View
how would you set up a button event listener with this code:
Button b =
(Button)findViewById(R.id.button1);
b.setOnClickListener(new View.OnClickListener() { public void onClick(View v){ // do something } });
How would you define onclick method in XML then access it from java
android:onClick=”onClick”
then java:
public void onclickSubmit(View v) { // some code }
How would you launch another activity from any given activity
With intents
launching an activity requires an explicit or implicit intent?
Explicit
When passing through data to a new intent, which method would you use?
intent.putExtra(“key”, value)