Welcome to MOTODEV  |  Join  |  Log In
 
ECCN 5D992.a

Using BACKTRACK™, the Rear Touchpad on BACKFLIP™

Motorola BACKFLIP makes five-way navigation available in two ways:

  1. Five-way navigation keys (often referred to as directional pad or D-Pad) on the keyboard.
  2. Motorola BACKTRACK, the rear touchpad on the back of the BACKFLIP display.

This article explains:

What is BACKTRACK?

Located on the back of the BACKFLIP display, the BACKTRACK is a touch-sensitive panel that can be used for navigation within the user interface. BACKTRACK does not create touchscreen motion events, but instead it simulates either trackball or a five-way input events.

Some of the features of BACKTRACK are as follows:

  1. Provides up/down/right/left and select functions within the user interface.
  2. The select function works via a short tap of the rear touchpad (if scrolling, to select an component, the user has to lift off the touching finger and tap back on the pad with a short tap).
  3. Diagonal navigation is not supported.
  4. Works for all screens and use cases where traditional five-way navigation is used.
  5. If the user performs a swiping gesture from one end of the pad to the other, the highlighted item will scroll a few places in that direction.
  6. User interface components can be highlighted using a swiping gesture across the touchpad. The number of items that can be highlighted is based on the speed of the swiping gesture across BACKTRACK. For example, 2 items can be obtained using a slow swiping gesture, and 5 items can be highlighted using a fast swiping gesture.
  7. For BACKFLIP, BACKTRACK is available in tabletop mode or flip-open mode. (Tabletop mode is not an application, but refers to the position the device is in when it is opened halfway. This mode works for all applications and screens on the phone.)

Enabling BACKTRACK

BACKTRACK is enabled by default. To enable or disable it on the device, touch Settings > Display & security > BACKTRACK.

Enabling/disabling BACKTRACK programmatically

Sometimes an app might need to enable or disable BACKTRACK programmatically. In that case, first check for the value of the BACKTRACK setting then enable or disable BACKTRACK accordingly. The BACKTRACK setting is stored as a name/value pair in the Android system settings, where the name is the string "back_touch_enabled".

The following snippet (using the Android 1.5 SDK) shows enabling/disabling BACKTRACK programmatically.

// test for existence of BACKTRACK system setting
String back_track_setting = "back_touch_enabled" ;
try {
        int bfenabled = System.getInt(getContentResolver(), back_track_setting);        
        // setting exists, now test for value
        if (bfenabled == 0){
                //enable BACKTRACK
                System.putInt(getContentResolver(), back_track_setting, 1);
        } 
        else {
                // disable BACKTRACK
                System.putInt(getContentResolver(), back_track_setting, 0);
        }
}
catch (Settings.SettingNotFoundException e) {
        // setting doesn't exist
}

However, to use the putInt() call to update the BACKTRACK setting, you must include the following permission in your app's AndroidManifest.xml file.

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

Events triggered by BACKTRACK

BACKTRACK can trigger the onTrackballEvent() callback method of the View class of an Activity when any touch event occurs on the touchpad. The event can be consumed by overriding the onTrackballEvent() method and returning true.

If for any reason the application needs to behave the same for BACKTRACK events and five-way key press events, it can be done by not consuming the event in the onTrackballEvent() method.

If this event is not consumed (by not implementing the onTrackballEvent() method or by returning false from that method), then the event is subsequently propagated down by the View class and then handled the same as any other D-Pad key events.

You can read more about handling UI events in the Android™ documentation.

Sample code using events triggered by BACKTRACK

public class RearTouchPadNavSample extends Activity {
    /**Called when the activity is first created.*/
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
// event triggered on motion in rear touchpad
      @Override
      public boolean onTrackballEvent(MotionEvent motion) {
             switch (motion.getAction()) {
                  case (MotionEvent.ACTION_MOVE) :{
                        // logic for ACTION_MOVE motion event here
                        break;
                  }
                  case (MotionEvent.ACTION_DOWN) :{
                        // logic for ACTION_DOWN motion event here
                       break;
                  }
                  case (MotionEvent.ACTION_UP) :{
                        // logic for ACTION_UP motion event here
                       break;
                  }
          }
           return true;
      }
//event triggered when any key event occurred
      @Override
      public boolean onKeyDown(int keyCode, KeyEvent event) {
            switch (keyCode) {
                  case KeyEvent.KEYCODE_DPAD_LEFT: {
                        // logic for DPAD_LEFT event here
                        break;
                  }                            
                  case KeyEvent.KEYCODE_DPAD_RIGHT: {
                        // logic for DPAD_RIGHT event here
                        break;
                  }
                  case KeyEvent.KEYCODE_DPAD_UP: {
                        // logic for DPAD_UP event here
                        break;
                  }
                  case KeyEvent.KEYCODE_DPAD_DOWN: {
                        // logic for DPAD_DOWNevent here
                        break;
                  }
                  case KeyEvent.KEYCODE_DPAD_CENTER: {
                        // logic for DPAD_CENTERevent here
                        break;
                  }
                  case KeyEvent.KEYCODE_BACK: {
                         finish();
                  }
            }
            return true;
      }
}

In the above example snippet, the onTrackballEvent() method consumes the events for all BACKTRACK MotionEvents. Also notice the implementation of the onKeyDown() method, which consumes events for all five-way D-Pad key events.

Taking advantage of BACKTRACK events in applications

To take advantage of BACKTRACK events, implement the onTrackballEvent() method to consume MotionEvents.

Or you can take advantage of both BACKTRACK MotionEvents and D-Pad KeyEvents for five-way navigation. These can behave differently in the same application by consuming BACKTRACK MotionEvents and five-way key D-Pad KeyEvents by implementing both onTrackballEvent() and onKeyDown() methods as shown in the example.

However, if you want similar five-way navigation behavior for both BACKTRACK and five-way key D-Pad events, the BACKTRACK MotionEvents should not be consumed. Instead of implementing the onTrackballevent() method or returning false in the onTrackballEvent() method, implement only the onKeyDown() method. In this case, all BACKTRACK motion events are propagated as D-Pad KeyEvents by the View class of the Activity.

You can find more information about five-way navigation in the MOTODEV Technical Library.

Applications that work only with five-way navigation can be made to work with BACKFLIP when it is in tabletop mode and BACKTRACK is still accessible (note that five-way keys are not accessible when BACKFLIP is in tabletop mode).

Applications that use five-way navigation and BACKTRACK should use the following statements in the AndroidManifest.xml file:

<uses-configuration android:reqFiveWayNav="true" />
<uses-configuration android:reqNavigation="trackball" />

If both BACKTRACK and D-Pad navigation are needed in an application, then the following statements should be placed in the AndroidManifest.xml file:

<uses-configuration android:reqFiveWayNav="true" />
<uses-configuration android:reqNavigation="dpad" />
<uses-configuration android:reqNavigation="trackball" />

You can find more information about configuration elements in the Android documentation.

 

ECCN 5D992.a: In accordance with United States Export Administration Regulations (EAR), and specifically the Commerce Control List (CCL), this item has been classified 5D992.a. Export or re-export of this commodity and compliance with the U.S. Export Administration Regulations is ultimately the responsibility of the exporter. For more detailed information related to export or re-export of this item, please consult the EAR at http://www.access.gpo.gov/bis/ear/ear_data.html.

Except as noted, source code on this page is licensed as described below.

BSD License

Copyright © 2009-2010, Motorola, Inc. All rights reserved unless otherwise explicitly indicated.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of Motorola, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


Was This Document Helpful?
Yes  No 

Additional Comments (Optional)



Submit

Share This Page

Bookmark and Share

Table of Contents