Xperia™ game developer tip: How to make an application install directly to the SD card

When designing your game for the Xperia™ PLAY or other Android™ devices, Sony Ericsson highly recommends that you enable the Move to SD card option. This will make your gaming files movable to external storage. This is an optional feature you can declare for your application with the android:installLocation manifest attribute. If you do not declare this attribute, your application will be installed on the internal storage only and it cannot be moved to the external storage.

Read more

Xperia™ game developer tip: How to make an application install directly to the SD card

Xperia™ game developer tip: How to make an application install directly to the SD card

When designing your game for the Xperia™ PLAY or other Android™ devices, Sony Ericsson highly recommends that you enable the Move to SD card option. This will make your gaming files movable to external storage. This is an optional feature you can declare for your application with the android:installLocation manifest attribute. If you do not declare this attribute, your application will be installed on the internal storage only and it cannot be moved to the external storage.

Read more

Xperia™ game developer tip: How to make an application install directly to the SD card

How to take advantage of the pinch-to-zoom feature in your Xperia™ X10 apps – Part 2

Recently Sony Ericsson rolled out an update to the Android™ 2.1 operating system in its Xperia™ X10 phones. One of the important new features in the update is support for a multi-touch gesture called pinch-to-zoom. The first part of this two-part tutorial showed how to take advantage of the pinch-to-zoom feature in your apps. In this second part of the tutorial, you’ll examine a code example that uses the pinch-to-zoom feature.

Read more

How to take advantage of the pinch-to-zoom feature in your Xperia™ X10 apps – Part 2

Recently Sony Ericsson rolled out an update to the Android™ 2.1 operating system in its Xperia™ X10 phones. One of the important new features in the update is support for a multi-touch gesture called pinch-to-zoom. The first part of this two-part tutorial showed how to take advantage of the pinch-to-zoom feature in your apps. In this second part of the tutorial, you’ll examine a code example that uses the pinch-to-zoom feature.

Read more

How to take advantage of the pinch-to-zoom feature in your Xperia™ X10 apps – Part 1

Recently Sony Ericsson rolled out an update to the Android™ 2.1 operating system in its Xperia™ X10 phones. One of the important new features in the update is support for a multi-touch gesture called pinch-to-zoom. In this first part of a two-part tutorial, you will learn how to take advantage of the pinch-to-zoom feature in your apps. In the second part of the tutorial, you’ll examine a code example that uses the pinch-to-zoom feature.

Read more

How to take advantage of the pinch-to-zoom feature in your Xperia™ X10 apps – Part 1

How to take advantage of the pinch-to-zoom feature in your Xperia™ X10 apps – Part 1

Recently Sony Ericsson rolled out an update to the Android™ 2.1 operating system in its Xperia™ X10 phones. One of the important new features in the update is support for a multi-touch gesture called pinch-to-zoom. In this first part of a two-part tutorial, you will learn how to take advantage of the pinch-to-zoom feature in your apps. In the second part of the tutorial, you’ll examine a code example that uses the pinch-to-zoom feature.


The pinch-to-zoom feature allows users to zoom in and get a closer, more detailed view of a display, or zoom out and get a wider field of view. For example, in the side-by-side image below, the image on the left shows a display zoomed out for a wider field of view. The image on the right shows the display zoomed in for a closer view.

The pinch-to-zoom feature lets users zoom out for a wider field of view, or zoom in for a closer view.

Although not initially available in the Android 2.1 support in Xperia™ X10, pinch-to-zoom is now available as an over-the-air (OTA) enhancement. Note however that Xperia™ X10 is not yet fully optimized for multi-touch. There are some cases where a pinch-to-zoom gesture generates unusual behavior. For more information, see the Limitations section in Part 2 of the tutorial.

You can take advantage of the pinch-to-zoom feature in applications that you develop for Xperia™ X10. Two applications that are packaged with Xperia™ X10 already take advantage of the feature: the web browser and Google Maps. There are also other applications that make use of this feature, such as Angry Birds.

Below is a video that demonstrates the pinch-to-zoom feature in Xperia™ X10.

Providing pinch-to-zoom capability in your Xperia™ X10 application
Your Xperia™ X10 application needs to do the following to provide pinch-to-zoom capability:

  • Detect that the user has made a pinch-to-zoom gesture, such as moving two fingers across the screen. This is further explained below in Detecting and getting information about the gesture.
  • Get information about the gesture, such as what the action was and when it took place. This is further explained below in Detecting and getting information about the gesture.
  • Process the gesture, that is, respond to the user’s action, as appropriate. This is further explained below in Processing the gesture.

Detecting and getting information about the gesture
When a user touches the screen, Android creates an Android™ MotionEvent object to record information about the touch event, such as the action the user performed and the time when the user performed it. Your application needs to access the object in order to detect a pinch-to-zoom gesture and get information about it. This requires the application to first import the MotionEvent class as follows:

import android.view.MotionEvent;

Processing the gesture
To process the gesture, you create a callback handler. You can use the callback handler to take actions such as get information about a pinch-to-zoom gesture. However, first you need to register the callback handler using the setOnTouchListener() method of the Android View class, as shown in the following code snippet.

import android.view.View;
import android.view.View.OnTouchListener;
…
view.setOnTouchListener(onTouchListener);

The parameter to view.setOnTouchListener represented by:

onTouchListener

is the callback handler, that is, the touch listener that you want to register. The callback handler is attached to a specific view. Touch events that are posted to that view are processed by the associated callback handler.

The callback handler must implement Android’s View.OnTouchListener interface and use the onTouch() method defined in the interface to process the touch events. When you call the onTouch() method, you need to supply as parameters a View object and a MotionEvent object, as shown below.

public class MyPinchZoom extends Activity implements OnTouchListener {

   public boolean onTouch(View v, MotionEvent event) {
      // Process touch events
   }

}

A user starts a pinch-to-zoom gesture by touching the screen with one finger. This event is represented in the MotionEvent object by the constant ACTION_DOWN. When the user touches the screen with a second finger while continuing to touch the screen with the first finger, that event is recorded in the MotionEvent object by the constant ACTION_POINTER_DOWN. Other constants represent other actions taken during the pinch-to-zoom gesture. Here are the set of action-related constants for the pinch-to-zoom gesture:

ACTION_DOWN The user touched the screen.
ACTION_POINTER_DOWN The user touched the screen with a second finger while continuing to touch the screen with the first finger.
ACTION_MOVE The user moved a finger on the screen.
ACTION_POINTER_UP The user released one finger from the screen while continuing to touch the screen with the other finger.
ACTION_UP The user released the finger from the screen (only only one finger was touching the screen).
ACTION_CANCEL The user cancelled the current gesture.

After you register the callback handler, you can use it to call methods on the MotionEvent object to get information about a pinch-to-zoom related event. For example, the getAction() method returns the type of action performed: up down, move , or cancel. The following code snippet shows a call to the getAction() method.

// Process touch events
      int action = event.getAction();

The lowest 8 bits of the action returned by getAction() represent the action code. To access the action code, you can perform a bitwise AND operation (using the & operator). The two operands of the AND operation are the result returned by getAction() and the MotionEvent constant, ACTION_MASK. The ACTION_MASK constant is a bit mask of the part of the action code that represents the action itself. The following line of code performs a bitwise AND operation on the action returned by getAction() and the ACTION_MASK constant.

int actionCode = action & MotionEvent.ACTION_MASK;

You can get the number of pointers (fingers) associated with the event by calling the getPointerCount() method of the MotionEvent object, as shown below.

int pCount = event.getPointerCount();

You can also retrieve the X and Y coordinates associated with the touch event by calling the getX() and getY() methods of the MotionEvent object, respectively. Here is an example that retrieves first the X coordinate and then the Y coordinate.

float xcoord = event.getX;
float ycoord = event.getY;

By identifying a pointer index as a parameter to getX() and getY(), you can retrieve the X and Y coordinates of a specific pointer. The following example shows how to get the X coordinate and Y coordinate of the first pointer.

Float  xcoord = event.getX(0);   //Get the X coordinate for the first
                                 // pointer
Float  ycoord = event.getY(1);   //Get the Y coordinate for the second
                                 // pointer

More information

Read more

How to take advantage of the pinch-to-zoom feature in your Xperia™ X10 apps – Part 1

Learn how to make Xperia™ PLAY games through design3 training videos

 

 

With the revolutionary release of the Xperia™ PLAY into the mobile gaming ecosystem, we are excited to work with design3 to offer training videos designed to help Sony Ericsson developers move their projects from concept to delivery as fast as possible. Read more about design3’s exciting offerings after the jump.

Read more

Learn how to make Xperia™ PLAY games through design3 training videos

Unlocking the boot loader in the new Xperia™ smartphones

With its new generation of 2011 Xperia™ smartphones, Sony Ericsson will allow advanced developers to unlock the boot loader in a secure and legal way. We will enable this opportunity later this spring, although it will only be possible for certain releases of these phones.

Find out the details after the jump.

Read more

Android™ Gingerbread coming to Xperia™ X10 generic trade kits

Sony Ericsson Xperia™ X10

Sony Ericsson has previously communicated  that we did not plan for any further upgrades of the Xperia X10 beyond Android 2.1 Éclair. This was correct at the time, but it has now changed and we plan to bring an upgrade to Android™ Gingerbread for generic trade kits of the Xperia X10 at the end Q2 or early Q3 this year. We have simply listened to our consumers, and the development of the software for our new 2011 range of Xperia™ phones gave us a solution that made it possible to deliver Android™ Gingerbread on Xperia™ X10.

For more details, check out this blog post on the Sony Ericsson Products blog.

Read more

Page 20 of 24« First...10...1819202122...Last »