GoConqr has a new look! Let us know what you think.

Notes

Building your first app

PIKANSHU KUMAR Computer Studies GRE English 1 page

Content of the notes (1)

Page 1

View objects are usually UI widgets such as buttons or text fields.

ViewGroup objects are invisible view containers that define how the child views are laid out, such as in a grid or a vertical list.

Layouts are subclasses of the ViewGroup.

LinearLayout is a view group (a subclass of ViewGroup).

The default weight for all views is 0, so if you specify any weight value greater than 0 to only one view, then that view fills whatever space remains after all views are given the space they require.

The weight value is a number that specifies the amount of remaining space each view should consume, relative to the amount consumed by sibling views.

An Intent is an object that provides runtime binding between separate components (such as two activities). The Intent represents an app’s "intent to do something."

The Intent constructor takes two parameters:

A Context as its first parameter (this is used because the Activity class is a subclass of Context)

The Class of the app component to which the system should deliver the Intent (in this case, the activity that should be started).

An Intent can carry data types as key-value pairs called extras. Your key is a public constant EXTRA_MESSAGE because the next activity uses the key to retrieve the text value.

It's a good practice to define keys for intent extras using your app's package name as a prefix. This ensures the keys are unique, in case your app interacts with other apps.

The call getIntent() grabs the intent that started the activity. Every Activity is invoked by an Intent, regardless of how the user navigated there. The call getStringExtra() retrieves the data from the first activity.

Information

Description
GRE Computer Studies Note on Building your first app, created by PIKANSHU KUMAR on 01/03/2017.
Created by
PIKANSHU KUMAR
Views
4
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?