1) findViewById(R.id.<type control name>);
Button myButton = (Button) findViewById(R.id.my_button);
noKids = (EditText) findViewById(R.id.xetKids);
This function use for create object of android control
R is reserve class R is a class that contains ONLY public constants.
(public static final). It is a generated class (by Android Plugin in Eclipse)
that reflects the various values you defined in the res file.
For instance, you should have something like: android:id="@+id/about_button"
****************************************************************************
2)Double.parseDouble(<string>);
Example
etKids = Double.parseDouble(noKids.getText().toString());
This function convert string to Double data type for mathematics calculation.
3)Toast()
Toast.makeText(context, text, duration).show();
Example
Toast.makeText(context,"Message saved as draft", duration).show();
This method is used to display some message to user screen.
******************************************************************************
No comments:
Post a Comment