WEBVIEW:
WebView is a view that can dynamically load web pages.For using webview , Go to Manifest file and add user-permission of internet as follows :
<user-permission android:name ="android.permission.INTERNET">
Example: One Activity passes the url and name of a newspaper’s website . The below given activity gets intent and WebView is initialized.
Intent data=getIntent();
String url=data.getStringExtra("keyUrl");
String newspaper=data.getStringExtra("keyNewspaper");
setTitle(newspaper);
webView.getSettings().setJavaScriptEnabled(true);
WebViewClient client=new WebViewClient();
webView.setWebViewClient(client);
webView.loadUrl(url);
CHECKBOX :
For including checkboxes in android, the class should implement OnCheckedChangedListener.
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
int id = buttonView.getId();
switch (id){
case R.id.checkBoxOne:
//stuff for checkbox One
break;
case R.id.checkBoxTwo:
//stuff for checkbox Two
break;
}
}
RadioButton :
Implements CompundButton.onCheckedChangedListener
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
int id = buttonView.getId();
switch (id){
case R.id.male :
//Code for male
case .id.female :
//Code for female
}
}
Rating Bar :
Implements onRatingChangedListener.
public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) {
Toast.makeText(this,"Rating: "+rating,Toast.LENGTH_LONG).show();
}
Spinner :
Touching the spinner displays a dropdown menu with all other available values.Data to be shown is fed to adapter which does the binding of data to the listview.
AutoCompleteTextView :
It shows a list of completion suggestions automatically while the user is typing.