Using System Resources

Many resources included with the system are available to applications. All such resources are defined under the class "android.R". For example, you can display the standard application icon in a screen with the following code:

public class MyActivity extends Activity {

public void onStart() {

requestScreenFeatures(FEATURE_BADGE_IMAGE); super.onStart();

setBadgeResource(android.R.drawable.sym_def_app_icon);

In a similar way, this code will apply to your screen the standard "green background" visual treatment defined by the system:

public class MyActivity extends Activity {

public void onStart() {

super.onStart();

setTheme(android.R.style.Theme_Black);

0 0

Post a comment