Wednesday, July 31, 2013

Show Activity in Portrait or Landscape mode only

In Android, some times  we need to show an Activity/Screen in portrait or Landscape mode only. Specially while developing game, we want a particular game to be played in Landscape or Portfrait mode only.

for this we need to set the  android:screenOrientation  attribute in manifest

To show the Screen/Activity in Landscape mode only

 <activity android:name=".MainActivity"
           android:screenOrientation="landscape"/>


To show the Screen/Activity in Portrait mode only.

 <activity android:name=".MainActivity"
           android:screenOrientation="portrait"/>

How to Set WallPaper in Android

In this tutorial I will explain how to set Wallpaper.

To Set the Wallpaper we must declare following permission in manifest file

 <uses-permission android:name="android.permission.SET_WALLPAPER" />
 <uses-permission android:name="android.permission.SET_WALLPAPER_HINTS"/>


If you use an Image to set as wallpaper, The image may not fit to the Screen, it may be smaller or larger than the device screen,  To overcome this problem or if we want that Image should to the screen for all the devices with different screen sizes, we need to use DisplayMatrics.


// get the Image to as Bitmap
Bitmap bitmap = BitmapFactory.decodeStream(getResources().openRawResource(R.id.image));

                DisplayMetrics metrics = new DisplayMetrics();
                getWindowManager().getDefaultDisplay().getMetrics(metrics);

                // get the height and width of screen
                int height = metrics.heightPixels;
                int width = metrics.widthPixels;
          
                WallpaperManager wallpaperManager = WallpaperManager.getInstance(this);
                 try {
                  wallpaperManager.setBitmap(bitmap);
               
                  wallpaperManager.suggestDesiredDimensions(width, height);
                    Toast.makeText(this, "Wallpaper Set", Toast.LENGTH_SHORT).show();
                 } catch (IOException e) {
                  e.printStackTrace();
                 }

Tuesday, July 30, 2013

Important Android Manifest Permission Details

Call Related Permissions


<uses-permission android:name="android.permission.CALL_PHONE" />
Allows an application to initiate a phone call without going through the Dialer user interface for the user to confirm the call being placed.

<uses-permission  android:name="android.permission.CALL_PRIVILEGED" />
Allows an application to call any phone number, including emergency numbers, without going through the Dialer user interface for the user to confirm the call being placed.

<uses-permission android:name="com.android.voicemail.permission.ADD_VOICEMAIL" />
Allows an application to add voicemails into the system.

<uses-permission android:name="android.permission.READ_PHONE_STATE" />
Allows read only access to phone state. You can get states like "Phone Ringing", "Call Received" etc using this permission.

Follow the post for running Example  of this Permission

<uses-permission android:name="android.permission.READ_CALL_LOG" />
Allows an application to read the user's call log . You can get the information like phone number, name, call duration, call type(incoming, outgoing, missed call) etc        
   



SMS/MMS related permissions

   
<uses-permission android:name="android.permission.RECEIVE_MMS" />
Allows an application to monitor incoming MMS messages, to record or perform processing on them.


<uses-permission android:name="android.permission.RECEIVE_SMS" />
This permission allows an application to Receive the SMS

Follow the post for running Example  of RECEIVE_SMS Permission

<uses-permission android:name="android.permission.READ_SMS" />
     This permission allows you read the SMS ,and get SMS Sender's number SMS Body, Sent time etc.

Follow the post for running Example  of READ_SMS Permission

<uses-permission android:name="android.permission.SEND_SMS" /> 
This permission allows an application to Recive the SMS

Follow the post for running Example  of  SEND_SMS Permission




Network/Internet/Location related permission


<uses-permission android:name="android.permission.INTERNET" />
Allows applications to open network sockets.With this permission your application can use 2G/3G internet .

Follow the post for running Example  of  INTERNET  Permission

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
Allows an app to access approximate location derived from network location sources such as cell towers and Wi-Fi.

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
Allows an app to access precise location from location sources such as GPS,
cell towers, and Wi-Fi.

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Allows applications to access information about networks

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
Allows applications to access information about Wi-Fi networks



   

Media Related Permissions



<uses-permission android:name="android.permission.CAMERA" />
Required to be able to access the camera device

<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
Allows an application to modify global audio settings

<uses-permission android:name="android.permission.RECORD_AUDIO" />
this permision allows you to record some audio or sound

Phonebook Related Permissions:


<uses-permission android:name="android.permission.READ_CONTACTS" />
Allows an application to read the user's contacts data.You can get Name, Number, etc of a Saved Contact

Follow the post for running Example  of this Permission

<uses-permission android:name="android.permission.WRITE_CONTACTS" />
Allows an application to add a new Contact in Phonebook

<uses-permission android:name="android.permission.READ_PROFILE" />
Allows an application to read the user's personal profile data.

 

 

SD Card related Permissions


<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Allows an application to read from external storage/SD card.

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Allows an application to write to external storage

Follow the post for running Example  of this Permission

 

 

Other Important Manifest Permissions


<uses-permission android:name="android.permission.BATTERY_STATS" />
Allows an application to collect battery statistics

<uses-permission android:name="android.permission.BLUETOOTH" />
Allows applications to connect to paired bluetooth devices

<uses-permission android:name="android.permission.READ_CALENDAR" />
Allows an application to read the user's calendar data.

<uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS" />
Allows an application to read (but not write) the user's browsing history and bookmarks

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
Allows an application to receive Boot_Completed broadcast

Follow the post for running Example  of this Permission

<uses-permission android:name="com.android.alarm.permission.SET_ALARM" />
Allows an application to broadcast an Intent to set an alarm for the user.

Follow the post for running Example  of this SET_ALARM Permission

<uses-permission android:name="android.permission.SET_WALLPAPER" />
Allows an Application to set the Wallpaper
Running Example : How to Set an Image as Wallpaper.

<uses-permission android:name="android.permission.VIBRATE" />
Allows an application to Vibrate the phone

Follow the post for running Example  of  VIBRATE Permission






Common Android Topics

Monday, July 29, 2013

Fill or Populate ListView with SQLiteDataBase

In this post I will describe how to connect ListView with database.
ListView can be populated by ArrayAdapter, Custom Adapter, ArrayList etc


Have a look at my previous post
Populating ListView with Custom Adapter
Populating ListView with ArrayList


ListView with DataBase Example


In this example I have created a listView  and populated it with DataBAse.
Each of the ListView item contain two views
TextView SMS Sender : to show SMS Sender Number
TextView SMSBody : to show the SMS Body/content

Here the ListView shows the all the SMSes with Sender Number and SMSBody.


Add the following permission in your manifest file to read the SMS..
   <uses-permission android:name="android.permission.READ_SMS"/>
   <uses-permission android:name="android.permission.WRITE_SMS"/>


listview_activity_main.xml


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#D1FFFF"
    android:orientation="vertical">
   
   
    <ListView
        android:id="@+id/listViewSMS"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:dividerHeight="0.1dp"
        android:divider="#0000CC"
        >
    </ListView>
   
  </LinearLayout>



listview_each_item.xml


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/textViewSMSSender"
        android:paddingLeft="2dp"
        android:textSize="20dp"
        android:textStyle="bold"
        android:textColor="#0000FF"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="TextView" />

    <TextView
        android:id="@+id/textViewMessageBody"
        android:paddingLeft="5dp"
        android:textColor="#5C002E"
        android:textSize="17dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="TextView" />

</LinearLayout>
   
  </LinearLayout>




ListViewWithDatabaseActivity 


public class ListViewWithDatabaseActivity extends Activity
{

   
        ListView listViewPhoneBook;
        Context context;
         @Override
        protected void onCreate(Bundle savedInstanceState)
         {
                 super.onCreate(savedInstanceState);
                 setContentView(R.layout.listview_activity_main);
                 context=this;
                 //get the ListView Reference
                 listViewSMS=(ListView)findViewById(R.id.listViewSMS);
                

                  //arrayColumns is the column name in your cursor where you're getting the data 
                  // here we are displaying  SMSsender Number i.e. address and SMSBody i.e. body

                  String[] arrayColumns = new String[]{"address","body"};
                  //arrayViewID contains the id of textViews
                  // you can add more Views as per Requirement
                  // textViewSMSSender is connected to "address" of arrayColumns
                  // textViewMessageBody is connected to "body"of arrayColumns

                  int[] arrayViewIDs = new int[]{R.id.textViewSMSSender,R.id.textViewMessageBody};
                    
                    
                  Cursor cursor;
                  
                    cursor = getContentResolver().query(Uri.parse("content://sms/inbox"), null, null, null, null);
                  
                // create an Adapter with arguments layoutID, Cursor, Array Of Columns, and Array of ViewIds which is to be Populated
                  
                 SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, R.layout.listview_each_item, cursor, arrayColumns, arrayViewIDs);
                 listViewSMS.setAdapter(adapter);
                
                
                
                 // To handle the click on List View Item
                 listViewSMS.setOnItemClickListener(new OnItemClickListener()
                {
                   
                                public void onItemClick(AdapterView<?> arg0, View v,int position, long arg3)
                                {
                                    // when user clicks on ListView Item , onItemClick is called
                                    // with position and View of the item which is clicked
                                    // we can use the position parameter to get index of clicked item

                                    TextView textViewSMSSender=(TextView)v.findViewById(R.id.textViewSMSSender);
                                    TextView textViewSMSBody=(TextView)v.findViewById(R.id.textViewMessageBody);
                                    String smsSender=textViewSMSSender.getText().toString();
                                    String smsBody=textViewSMSBody.getText().toString();
                                  
                                    // Show The Dialog with Selected SMS
                                    AlertDialog dialog = new AlertDialog.Builder(context).create();
                                    dialog.setTitle("SMS From : "+smsSender);
                                    dialog.setIcon(android.R.drawable.ic_dialog_info);
                                    dialog.setMessage(smsBody);
                                    dialog.setButton(DialogInterface.BUTTON_POSITIVE, "OK",
                                            new DialogInterface.OnClickListener() {
                                        public void onClick(DialogInterface dialog, int which)
                                        {
                                      
                                                dialog.dismiss();
                                                return;
                                    }  
                                    });
                                    dialog.show();
                                }
                               
                            });
             }
 }


ListView with Custom Adapter


Thursday, July 25, 2013

Android TabWidget Example

Android TabHost  provides a nice way to present multiple thing on a Single Screen. These  things are presented by Tabs.

In order to use tabs we need to set 2 things to Tab
1: Tab Indicator : Text to show on Tab,  done by  setIndicator("Tab Name");
2: TAB Content: The activity that will be opened when user selects/clicks particular tab, done by  setContent(activityObject);

main.xml


Android TabHost

<?xml version="1.0" encoding="utf-8"?>

<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
         android:layout_width="fill_parent"
         android:layout_height="fill_parent"
          android:id="@android:id/tabhost">
        
        <LinearLayout
                android:id="@+id/LinearLayout01"
                android:orientation="vertical"
                android:layout_height="fill_parent"
                android:layout_width="fill_parent">
               
                <TabWidget
                    android:id="@android:id/tabs"
                    android:layout_height="wrap_content"
                    android:layout_width="fill_parent">
                </TabWidget>
               
                <FrameLayout
                    android:id="@android:id/tabcontent"
                    android:layout_height="fill_parent"
                     android:layout_width="fill_parent">
                </FrameLayout>
               
        </LinearLayout>

</TabHost>


TabActivity.java


public class MainActivity extends TabActivity
{
            /** Called when the activity is first created. */
            @Override
            public void onCreate(Bundle savedInstanceState)
            {
                    super.onCreate(savedInstanceState);
                    setContentView(R.layout.main);

                    // create the TabHost that will contain the Tabs
                    TabHost tabHost = (TabHost)findViewById(android.R.id.tabhost);


                    TabSpec tab1 = tabHost.newTabSpec("First Tab");
                    TabSpec tab2 = tabHost.newTabSpec("Second Tab");
                    TabSpec tab3 = tabHost.newTabSpec("Third tab");

                   // Set the Tab name and Activity

                   // that will be opened when particular Tab will be selected
                    tab1.setIndicator("Tab1");
                    tab1.setContent(new Intent(this,Tab1Activity.class));
                   
                    tab2.setIndicator("Tab2");
                    tab2.setContent(new Intent(this,Tab2Activity.class));

                    tab3.setIndicator("Tab3");
                    tab3.setContent(new Intent(this,Tab3Activity.class));
                   
                    /** Add the tabs  to the TabHost to display. */
                    tabHost.addTab(tab1);
                    tabHost.addTab(tab2);
                    tabHost.addTab(tab3);

            }
}


Tab1Activity.java

public class Tab1Activity  extends Activity
{
        @Override
        public void onCreate(Bundle savedInstanceState)
        {
            super.onCreate(savedInstanceState);
           
            TextView  tv=new TextView(this);
            tv.setTextSize(25);
            tv.setGravity(Gravity.CENTER_VERTICAL);
            tv.setText("This Is Tab1 Activity");
           
            setContentView(tv);
        }
}

Tab2Activity.java

public class Tab2Activity  extends Activity
{
        @Override
        public void onCreate(Bundle savedInstanceState)
        {
            super.onCreate(savedInstanceState);
           
            TextView  tv=new TextView(this);
            tv.setTextSize(25);
            tv.setGravity(Gravity.CENTER_VERTICAL);
            tv.setText("This Is Tab2 Activity");
           
            setContentView(tv);
        }
}

Tab3Activity.java

public class Tab3Activity  extends Activity
{
        @Override
        public void onCreate(Bundle savedInstanceState)
        {
            super.onCreate(savedInstanceState);
           
            TextView  tv=new TextView(this);
            tv.setTextSize(25);
            tv.setGravity(Gravity.CENTER_VERTICAL);
            tv.setText("This Is Tab3 Activity");
           
            setContentView(tv);
        }
}




Android TabHost






 

New Advance Topics:                   Android LiveWallpaer Tutorial
Android ImageSwitcher                    Android TextSwitcher                                Android ViewFlipper
Android Gesture Detector               Handling/Detecting Swipe Events                Gradient Drawable
Detecting Missed Calls                    Hide Title Bar                                           GridView Animation
Android AlarmManager                 Android BootReceiver                       Vibrate Phone In a Desirable Pattern    
Developing for Different Screen Sizes           Showing Toast for Longer Time       Publishing your App
How to publish Android App on Google Play
Android TextWatcher                               Android ExpandableListView

 Beginning With Android
      Android : Introduction(What is Android)                                                              Configuring Eclipse for Android Development
     Creating Your First Android Project                                           Understanding Android Manifest File of your android app

 Advance Android Topics                                                              Customizing Android Views


Working With Layouts                                                                Working With Views

Understanding Layouts in Android                                                   Using Buttons and EditText in Android
Working with Linear Layout (With Example)                                     Using CheckBoxes in Android
Nested Linear Layout (With Example)                                              Using AutoCompleteTextView in Android                                                                                          Grid View
Relative Layout In Android                                                               ListView
Table Layout                                                                                   Android ProgressBar
Frame Layout(With Example)                                                          Customizing ProgressBar
Absolute Layout                                                                             Customizing Radio Buttons
Grid Layout                                                                                    Customizing Checkboxes In Android

Android Advance Views
Android Spinner                                                                           Android GalleryView
Android TabWidget                                                                      Android ExpandableListView

Android Components                                                                 Dialogs In Android

Activity In Android                                                                    Working With Alert Dialog
Activity Life Cycle                                                                    Adding Radio Buttons In Dialog
Starting Activity For Result                                                       Adding Check Boxes In Dialog
Sending Data from One Activity to Other in Android                    Creating Customized Dialogs in Android
Returning Result from Activity                                                   Creating Dialog To Collect User Input
Android : Service                                                                     DatePicker and TimePickerDialog
BroadcastReceiver                                                                   Using TimePickerDialog and DatePickerDialog In android

Menus In Android                                                                ListView:
Creating Option Menu                                                               Populating ListView With DataBase
Creating Context Menu In Android                                              Populating ListView with ArrayList
                                                                                               ListView with Custom Adapter

Toast                                                                                      Working With SMS
Customizing Toast In Android                                                       How to Send SMS in Android
Customizing the Display Time of Toast                                        How To Receive SMS
Customizing Toast At Runtime                                                  Accessing Inbox In Android
Adding Image in Toast
Showing Toast for Longer Time


TelephonyManager                                                            Storage: Storing Data In Android
Using Telephony Manager In Android                                          SharedPreferences In Android
                                                                                              Reading and Writing files to Internal Stoarage

Working With Incoming Calls                                       DataBase :  Introduction of SQLiteDataBase
How To Handle Incoming Calls in Android                                Working With Database in Android
How to Forward an Incoming Call In Android                            Creating Table In Android
CALL States In Android                                                          Inserting, Deleting and Updating Records In Table in Android


Miscellaneous
Notifications In Android
How To Vibrate The Android Phone
Sending Email In Android
Opening a webpage In Browser
How to Access PhoneBook In Android
Prompt User Input with an AlertDialog
How to Hide Title Bar In Android
How to show an Activity in Landscape or Portrait Mode only.
How to Set an Image as Wallpaper.






Android Spinner Example


According to official documentation "Spinners provide a quick way to select one value from a set". In the default state, a spinner shows its currently selected value. Touching the spinner displays a dropdown menu with all other available values, from which the user can select a new one.

So Spinner provide a way to choose/select an option from multiple available options.

The Syntax to add a spinner in layout

<Spinner
    android:id="@+id/planets_spinner"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" />
 

Spinner Example


In this example we are giving Easy,Medium,Hard and Too Hard options to users through
 Spinner and user selects an options, We show the user selected option in Toast.

The Spinner's item are populated form an ArrayAdapter, 
So we need to create an ArrayAdapter and set to Spinner.

Add Click Listener to Spinner

We need to add a click Listener to Spinner to handle the click event when User selects an option

main.xml

Android Spinner
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" 
    android:background="#B2CCCC"
    android:orientation="vertical">
    
    <TextView
        android:id="@+id/textView1"
        android:layout_marginTop="50dp"
        android:layout_marginLeft="5dp"
        android:textStyle="bold"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Select The Difficulty Level"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <Spinner
        android:id="@+id/spinner1"
        android:layout_marginTop="15dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
           
</LinearLayout>  

MainActivity.java

public class MainActivity extends Activity 
{
 

 ArrayList<String> difficultyLevelOptionsList = new ArrayList<String>();
 TextView txtView1;

    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
  Spinner spinner = (Spinner) findViewById(R.id.spinner1); 
    
  difficultyLevelOptionsList.add("Easy");
  difficultyLevelOptionsList.add("Medium");
  difficultyLevelOptionsList.add("Hard");
  difficultyLevelOptionsList.add("Too Hard");
 
  // Create the ArrayAdapter
  ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(MainActivity.this
            ,android.R.layout.simple_spinner_item,difficultyLevelList);
  
                 // Set the Adapter
  spinner.setAdapter(arrayAdapter);
  
  // Set the ClickListener for Spinner
  spinner.setOnItemSelectedListener(new  AdapterView.OnItemSelectedListener() { 

              public void onItemSelected(AdapterView<?> adapterView, 
             View view, int i, long l) { 
             // TODO Auto-generated method stub
          Toast.makeText(MainActivity.this,"You Selected : "
           + difficultyLevelOptionsList.get(i)+" Level ",Toast.LENGTH_SHORT).show();
             
               }
                // If no option selected
    public void onNothingSelected(AdapterView<?> arg0) {
     // TODO Auto-generated method stub
          
    } 

        });

               
 }
    

}
 
 
Android Spinner

 

New Advance Topics:                   Android LiveWallpaer Tutorial
Android ImageSwitcher                    Android TextSwitcher                                Android ViewFlipper
Android Gesture Detector               Handling/Detecting Swipe Events                Gradient Drawable
Detecting Missed Calls                    Hide Title Bar                                           GridView Animation
Android AlarmManager                 Android BootReceiver                       Vibrate Phone In a Desirable Pattern    
Developing for Different Screen Sizes           Showing Toast for Longer Time       Publishing your App
How to publish Android App on Google Play
Android TextWatcher                               Android ExpandableListView

 Beginning With Android
      Android : Introduction(What is Android)                                                              Configuring Eclipse for Android Development
     Creating Your First Android Project                                           Understanding Android Manifest File of your android app

 Advance Android Topics                                                              Customizing Android Views


Working With Layouts                                                                Working With Views

Understanding Layouts in Android                                                   Using Buttons and EditText in Android
Working with Linear Layout (With Example)                                     Using CheckBoxes in Android
Nested Linear Layout (With Example)                                              Using AutoCompleteTextView in Android                                                                                          Grid View
Relative Layout In Android                                                               ListView
Table Layout                                                                                   Android ProgressBar
Frame Layout(With Example)                                                          Customizing ProgressBar
Absolute Layout                                                                             Customizing Radio Buttons
Grid Layout                                                                                    Customizing Checkboxes In Android

Android Advance Views
Android Spinner                                                                           Android GalleryView
Android TabWidget                                                                      Android ExpandableListView

Android Components                                                                 Dialogs In Android

Activity In Android                                                                    Working With Alert Dialog
Activity Life Cycle                                                                    Adding Radio Buttons In Dialog
Starting Activity For Result                                                       Adding Check Boxes In Dialog
Sending Data from One Activity to Other in Android                    Creating Customized Dialogs in Android
Returning Result from Activity                                                   Creating Dialog To Collect User Input
Android : Service                                                                     DatePicker and TimePickerDialog
BroadcastReceiver                                                                   Using TimePickerDialog and DatePickerDialog In android

Menus In Android                                                                ListView:
Creating Option Menu                                                               Populating ListView With DataBase
Creating Context Menu In Android                                              Populating ListView with ArrayList
                                                                                               ListView with Custom Adapter

Toast                                                                                      Working With SMS
Customizing Toast In Android                                                       How to Send SMS in Android
Customizing the Display Time of Toast                                        How To Receive SMS
Customizing Toast At Runtime                                                  Accessing Inbox In Android
Adding Image in Toast
Showing Toast for Longer Time


TelephonyManager                                                            Storage: Storing Data In Android
Using Telephony Manager In Android                                          SharedPreferences In Android
                                                                                              Reading and Writing files to Internal Stoarage

Working With Incoming Calls                                       DataBase :  Introduction of SQLiteDataBase
How To Handle Incoming Calls in Android                                Working With Database in Android
How to Forward an Incoming Call In Android                            Creating Table In Android
CALL States In Android                                                          Inserting, Deleting and Updating Records In Table in Android


Miscellaneous
Notifications In Android
How To Vibrate The Android Phone
Sending Email In Android
Opening a webpage In Browser
How to Access PhoneBook In Android
Prompt User Input with an AlertDialog
How to Hide Title Bar In Android
How to show an Activity in Landscape or Portrait Mode only.
How to Set an Image as Wallpaper.