Tuesday, 14 July 2015

Lesson 1

Notes:

1) ViewGroups are containers like relativelayout or linear layouts.
    Views are the widgets like buttons, edittext, etc.
    Viewgroups define how views are to be presented.

2) Use string resources rather than hardcoding strings. It'll make the updation of strings much more simpler if needed, as all the strings will be located in a single XML file.

3) layout_weight. It's an attribute for a widget in a XML file.

   It gives proportions.

  Like a recipe is 2 parts lemon and 1 part soda. If you give a weight to one widget a 1 and another as  2. 1+2=3. So your first widget will have 1/3 of the remaining free space and the other will have 2/3.
Remember to set width as 0dp to avoid confusion.

4) Intents are defined as
Intent intent=new Intent(this,theactivitytobeinvoked.class);
intent.putExtra(keyvalue,actual value);
//define the keyvalue as a constant string so it doesn't collide with other app interactions

5) Receiving it at the other end

Intent intent=getIntent();
String string=intent.getStringExtra(theoriginalactivity.keyname);


No comments:

Post a Comment