Android Development by fredyonge yo Flashcards
dp
Measurement for pixels
alpha
Level of transparency
String
Class (not primitive) made of chars
sp
text pixel measurement
public
java code for accessible across entire application
static
Method relates to whole class and not just instances
extends
java code for passing attributes
protected
java code for privately accessible to specific package
println
Java code stands for Print Line
“AS: create public View class called view that returns nothing > call it with clickFunction > Log ““info”” ““Button pressed”””
“public void clickFunction(View view) { Log.f(““Info””, ““Button Press””); }”
AS: finde das Suchfehld email
EditText email = (EditText) findViewById(R.id.email);
AS: get email ID text > parse to string > log email text
“Log.i(““Info””, email.getText().toString());”
Where do images get stored in Android Studio?
The drawable folder
AS: find image1 ID defniiere es als image
ImageView image = (ImageView) findViewById(R.id.image1);
AS: set image resource of image as image2
image.setImageResource(R.drawable.image2);
AS: get text > parse to string > parse to double
Double doubleName= Double.parseDouble(stringName.getText().toString());
“Java: create class called ““HelloWorld”” > print ““Hello World!”””
“public class HelloWorld { public static void main(String[] args) { System.out.println(““Hello World””); }}”
What are classes in Java?
Type of object definition
What are methods in Java?
A chunk of code that does something
What is the main method in Java?
A method that runs when Java is executed
“Java: Log ““Hello World”””
“System.out.println(““Hello World””);”
Java: 8 types of primitives > bit size > purpose
1- boolean(true or false)2- char(16-bit, unicode character)3- byte(8-bit, save mem in large array)4- short(16-bit, save mem large array)5- int(32-bit, number)6- float(32-bit, use for short decimals)7- double(64-bit, decimal number)8- long(64-bit, for large range values)
What does Java do when you put a primitive in a string?
Converts it to a string
Java: create Arrays of Integers
int[] numbers = {1, 2, 3, 4,};