Tuesday, October 27, 2009

Announcing Android 2.0 support in the SDK!


Media_http3bpblogspot_xuiqw

I am excited to announce that the Android SDK now supports Android 2.0 (also known as Eclair).

Android 2.0 brings new developer APIs for sync, Bluetooth, and a few other areas. Using the new sync, account manager and contacts APIs, you can write applications to enable users to sync their devices to various contact sources. You can also give users a faster way to communicate with others by embedding Quick Contact within your application. With the new Bluetooth API, you can now easily add peer-to-peer connectivity or gaming to your applications. To get a more complete list of the new capabilities you can add to your applications, please go to the Android 2.0 highlights page.

Current developers can use the SDK Manager to add Android 2.0 support to their SDK as well as update their SDK Tools to revision 3. New developers can download the Android SDK from the download site. After the download, Android platforms must be added using the SDK Manager


Media_http3bpblogspot_usspu

The SDK Manager allows you to add new Android platforms to your SDK.

Android SDK Tools, revision 3 is required to develop for Android 2.0. It includes support for code coverage through the Ant build system, as well as Mac OS X 10.6 (Snow Leopard) support for the SDK and related tools. For those of you who develop using Eclipse, we are releasing ADT version 0.9.4 through the usual Eclipse update mechanism.

Over the next few months, we expect to see more and more Android devices being released. These devices will be running Android 1.5, 1.6, or 2.0. We are also planning a minor version update of Android 2.0 towards the end of the year, and that will be the last update for 2009. Below are some of the things you can do to be better prepared:


  • Download the Android 2.0 platform and make sure your existing apps continue to work on new devices running Android 2.0.


  • Make sure that your apps work when using the WVGA (800x480) & FWVGA (854x480) emulator skins. We expect devices with these types of screen, running Android 2.0 to be launched soon.


Checkout the video below for more information about Android 2.0.

Kita Makin Takabur

HARI-HARI ini kita berada dalam suasana Hari Sumpah Pemuda. Hari yang amat bersejarah dalam sejarah perpolitikan nasional. Kita tahu baik, pada 28 Oktober 1928 para pemuda secara gegap gempita mengikrarkan tekadnya yang kita kenal dengan Sumpah Pemuda.
Mereka mengangkat sumpah dengan formulasi bahasa yang amat sederhana. Menggunakan diksi yang mudah dicerna, namun sarat makna, sarat pesan. Mereka berikrar, Berbangsa Satu Bangsa Indonesia, Berbahasa Satu Bahasa Indonesia, dan Bertanah Air Yang Satu, Tanah Air Indonesia.

Tekad itu mereka usung untuk melecutkan semangat perjuangan bangsa ini, membakar spirit kaum muda untuk bangkit melawan penjajah, melawan imperialisme dan kolonialisme yang bercokol di tanah pertiwi, yang membelenggu kebebasan anak-anak negeri ini.

Itu peristiwa bersejarah yang terjadi 81 tahun silam. Peristiwa yang hingga kini terpahat indah dalam sanubari setiap orang, terukir indah dalam benak setiap hati, yang tak melupakan torehan sejarah pada zaman perjuangan dulu.

Saat itu, tatkala bangsa ini dalam kondisi terpuruk akibat penjajahan, semua orang merasa terpanggil untuk membela negara. Semua orang berjuang dan terus berjuang hingga titik darah penghabisan. Mereka bertarung dengan bambu runcing, bertarung dengan senjata yang ada adanya untuk mengusir penjajah. Selama hayat masih dikandung badan, mereka tak berhenti berjuang, demi membebaskan Indonesia dari tindasan kolonial.

Sekarang, kita menikmati hasilnya. Bahkan sudah puluhan tahun lamanya, kita telah mengecapi nikmatnya kemerdekaan, hasil perjuangan mereka dulu. Bahkan di antara kita, ada yang juga telah membangun kemegahan, membangun kepongahan, membangun ketamakan di atas darah dan air mata para pejuang. Kita menyisihkan tujuan perjuangan pendahulu, yang menghantar bangsa ini ke gerbang kemerdekaan dengan taruhan nyawa.

Sebagai contoh, kasus korupsi terus terjadi di negeri ini. Dari pusat sampai ke daerah, masih banyak pejabat yang rajin mengumpulkan harta dengan cara-cara yang melanggar hukum, melanggar aturan yang berlaku. Para pejabat yang diharapkan menjadi teladan bagi masyarakat, malah sebalikmya melakukan aksi yang tidak pada tempatnya.

Begitu juga kaum muda yang diharapkan sebagai penerus bangsa ini, malah terjerumus dalam hal-hal yang kontraproduktif. Tak sedikit anak-anak kita masuk dalam perangkap narkotika dan obat-obatan terlarang (narkoba). Masih banyak lagi contoh kasus yang memperlihatkan karakter anak muda kita, yang sudah dan semakin takabur dalam bingkai teks sumpah pemuda.

Jika dulu para pemuda menyatukan visi misi, menyatukan tekad merebut kemerdekaan dari tangan penjajah demi masa depan bangsa dan negara ini, saat ini justeru kita telah larut dalam perilaku yang mencederai sumpah pemuda itu sendiri.
Bila dulu para pejuang menyatukan bangsa ini dengan satu bahasa, yakni bahasa Indonesia, saat ini kita justeru lebih senang menggunakan bahasa orang lain. Kita merasa lebih terhormat, lebih bermartabat, lebih pintar dan lebih gaul, apabila menggunakan istilah-istilah asing. Kita lupa bahwa untuk menjadikan bahasa Indonesia sebagai bahasa ibu, para pendahulu memperjuangkannya dengan jiwa dan raga.

Kita lupa bahwa pada masa lalu, pemerintah kita telah menjadikan bulan Oktober sebagai bulan bahasa. Bahkan itu masih berlaku sampai sekarang.
Sayangnya, kita tidak menyadari hal tersebut. Kita justeru cenderung membudayakan bahasa asing dalam pergaulan kita. Kita lebih suka mempopulerkan bahasa asing ketimbang kekayaan bahasa yang kita miliki. Kita juga lebih suka menggunakan bahasa serapan daripada bahasa yang kita miliki.

Contoh itu mudah didapat. Saat seminar, misalnya, para pembicara dengan gayanya menggunakan istilah-istilah asing (bahasa Inggris). Mungkin hal itu untuk gagah- gagahan, supaya bisa dibilang pintar. Tapi mereka lupa bahwa cara itu sesungguhnya melukai rasa bahasa yang kita miliki.

Entah sampai kapan sandiwara ini berlangsung. Tapi jika para cerdik cendekia, para pejabat, para akademisi, dan para pemuda, belum menyadari ketimpangan tersebut, maka nasib bahasa Indonesia tentu akan semakin suram. Karena itu, melalui momentum Hari Sumpah Pemuda tahun 2009 ini, kita kembali menyatukan tekad untuk menyudahi hal-hal yang berbau asing. Saatnya kita gunakan kekayaan yang ada pada kita. *

Friday, October 23, 2009

UI framework changes in Android 1.6

Android 1.6 introduces numerous enhancements and bug fixes in the UI framework. Today, I'd like to highlight three two improvements in particular.

Optimized drawing

The UI toolkit introduced in Android 1.6 is aware of which views are opaque and can use this information to avoid drawing views that the user will not be able to see. Before Android 1.6, the UI toolkit would sometimes perform unnecessary operations by drawing a window background when it was obscured by a full-screen opaque view. A workaround was available to avoid this, but the technique was limited and required work on your part. With Android 1.6, the UI toolkit determines whether a view is opaque by simply querying the opacity of the background drawable. If you know that your view is going to be opaque but that information does not depend on the background drawable, you can simply override the method called isOpaque():


@Override
public boolean isOpaque() {
return true;
}


The value returned by isOpaque() does not have to be constant and can change at any time. For instance, the implementation of ListView in Android 1.6 indicates that a list is opaque only when the user is scrolling it.

Updated: Our apologies—we spoke to soon about isOpaque(). It will be available in a future update to the Android platform.

More flexible, more robust RelativeLayout

RelativeLayout is the most versatile layout offered by the Android UI toolkit and can be successfully used to reduce the number of views created by your applications. This layout used to suffer from various bugs and limitations, sometimes making it difficult to use without having some knowledge of its implementation. To make your life easier, Android 1.6 comes with a revamped RelativeLayout. This new implementation not only fixes all known bugs in RelativeLayout (let us know when you find new ones) but also addresses its major limitation: the fact that views had to be declared in a particular order. Consider the following XML layout:


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

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="64dip"
android:padding="6dip">

<TextView
android:id="@+id/band"
android:layout_width="fill_parent"
android:layout_height="26dip"

android:layout_below="@+id/track"
android:layout_alignLeft="@id/track"
android:layout_alignParentBottom="true"

android:gravity="top"
android:text="The Airborne Toxic Event" />

<TextView
android:id="@id/track"
android:layout_marginLeft="6dip"
android:layout_width="fill_parent"
android:layout_height="26dip"

android:layout_toRightOf="@+id/artwork"

android:textAppearance="?android:attr/textAppearanceMedium"
android:gravity="bottom"
android:text="Sometime Around Midnight" />

<ImageView
android:id="@id/artwork"
android:layout_width="56dip"
android:layout_height="56dip"
android:layout_gravity="center_vertical"

android:src="@drawable/artwork" />

</RelativeLayout>


This code builds a very simple layout—an image on the left with two lines of text stacked vertically. This XML layout is perfectly fine and contains no errors. Unfortunately, Android 1.5's RelativeLayout is incapable of rendering it correctly, as shown in the screenshot below.


Media_httpdocsgooglec_xhvtj

The problem is that this layout uses forward references. For instance, the "band" TextView is positioned below the "track" TextView but "track" is declared after "band" and, in Android 1.5, RelativeLayout does not know how to handle this case. Now look at the exact same layout running on Android 1.6:


Media_httpdocsgooglec_sxrju

As you can see Android 1.6 is now better able to handle forward reference. The result on screen is exactly what you would expect when writing the layout.

Easier click listeners

Setting up a click listener on a button is very common task, but it requires quite a bit of boilerplate code:


findViewById(R.id.myButton).setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Do stuff
}
});


One way to reduce the amount of boilerplate is to share a single click listener between several buttons. While this technique reduces the number of classes, it still requires a fair amount of code and it still requires giving each button an id in your XML layout file:


View.OnClickListener handler = View.OnClickListener() {
public void onClick(View v) {
switch (v.getId()) {
case R.id.myButton: // doStuff
break;
case R.id.myOtherButton: // doStuff
break;
}
}
}

findViewById(R.id.myButton).setOnClickListener(handler);
findViewById(R.id.myOtherButton).setOnClickListener(handler);


With Android 1.6, none of this is necessary. All you have to do is declare a public method in your Activity to handle the click (the method must have one View argument):


class MyActivity extends Activity {
public void myClickHandler(View target) {
// Do stuff
}
}


And then reference this method from your XML layout:


<Button android:onClick="myClickHandler" />


This new feature reduces both the amount of Java and XML you have to write, leaving you more time to concentrate on your application.

The Android team is committed to helping you write applications in the easiest and most efficient way possible. We hope you find these improvements useful and we're excited to see your applications on Android Market.

Wednesday, October 21, 2009

Rumah Tahan Gempa ala Bantul

Rumah dan bangunan tahan gempa ternyata bisa didapat dengan harga murah. Di Bantul, Yogyakarta, sejumlah warga mengembangkan pembuatan rumah tanah gempa bumi dengan biaya berkisar Rp 8 hingga Rp 9 juta rupiah per unit.

Dinding rumah hanya sedikit menggunakan batu bata, sedangkan kerangka rumah tidak menggunakan besi dan beton, melainkan kayu.

Sistem konstruksi pondasi rumah ini mengadopsi konstruksi rumah adat Jawa, Joglo, yaitu dengan menggunakan umpak atau batu penyangga tiang. Sementara, dinding atas hingga ke atap rumah menggunakan asbes.

Selain penggunaan sedikit materi bangunan, proses pembuatannya juga mudah. Plus, dapat dikerjakan secara bergotong royong. Warga pun mengaku tenang bisa tinggal di rumah yang dibangun selama lima hari ini.

Di Desa Ngibikan, sedikitnya sudah seratus warga yang mendirikan rumah murah tahan gempa. Model rumah seperti ini setidaknya dapat dikembangkan di daerah rawan gempa di tanah air.

Thursday, October 15, 2009

Maxima Bantah Tendang Keluar Raditya Dika

Production House film Menculik Miyabi, Maxima Pictures membantah telah menendang keluar novelis Raditya Dika dari film yang melibatkan supermodel porno asal Jepang Maria Ozawa alias Miyabi.

"Enggak, enggak ada seperti itu," bantah General Manajer Maxima Pictures Sediadi saat berbincang dengan okezone, Selasa (13/10/2009).

Dia menegaskan, Maxima Pictures masih memiliki hubungan yang baik dengan pacar mantan penyanyi cilik Sherina. "Tidak mungkin lah kita menendang Raditya," ujarnya.

Pria yang disapa Adi ini mengaku, pihaknya sebenarnya belum mengetahui persis perihal keluarnya Raditya sebagai pemain dan penulis. Yang pasti, katanya, Maxima tetap akan menghargai pemilik ide cerita milik Raditya Dika tersebut.

Sebelumnya, Raditya Dika keluar dari peran utama Raffan, yang rencananya akan dia bintangi. Bahkan, dia juga tidak lagi menjadi penulis utama naskah film tersebut. Dia digantikan Raditya Mangunsong.

Keluarnya Raditya Dika mengembuskan gosip pihak Maxima Pictures kesal perihal bocornya rencana mengundang Miyabi ke Jakarta. Pasalnya, pertama kali kabar Miyabi ke Jakarta muncul dalam wawancara Raditya dengan salah satu Koran nasional 12 September 2009 lalu.

Akibatnya, Maxima Pictures diprotes dan didemo untuk mengurungkan niatnya mendatangkan Miyabi ke Jakarta.

Friday, October 9, 2009

Menculik Miyabi

Bagi sebagian kalangan, kata “Miyabi” begitu akrab di telinga. Mereka yang paham biasanya langsung tersenyum begitu mendengar “Miyabi”. Yang tidak mengerti cuma bingung melihat temannya tersenyum. Belakangan, kata “Miyabi” jadi begitu populer dan tak lagi dipahami secara eksklusif oleh sebagian orang menyusul kabar akan datangnya aktris Jepang Maria Ozawa Video (23).
Miyabi adalah nama alias Maria Ozawa. Di Jepang, ia dikenal sebagai bintang film porno. Sebuah film berjudul Menculik Miyabi akan diproduksi di Indonesia. Ini tentu bukan film porno. Tapi, Miyabi akan ikut menjadi pemain di film yang digarap oleh rumah produksi Maxima Pictures itu.

Diam-diam demam Miyabi merebak. Banyak orang tergelitik ingin tahu seperti apakah film orang dewasa yang dibintanginya. Ternyata tidak sulit mencari “Miyabi”, bahkan untuk seorang "pemula" sekali pun. Kata “Miyabi” telah menjadi ikon di kawasan Glodok, Jakarta Barat, yang dikenal sebagai pusat perdagangan film bajakan. Film-film Miyabi dan film dewasa lainnya digelar secara terbuka di sana.

Memasuki halaman gedung Glodok, mata Anda langsung tertumbuk pada deretan DVD Miyabi bersampul foto dirinya yang manis. Terlebih begitu Anda memasuki koridor pusat perbelanjaan elektronik terbesar di Jakarta ini. Film-film Miyabi pun semakin mudah Anda temui. Puluhan DVD Miyabi sengaja dijejerkan di rak seukuran 5 meter x 1 meter, sementara mata pemilik lapak berkeliaran mencari calon pembeli potensial.

Support for additional screen resolutions and densities in Android

You may have heard that one of the key changes introduced in Android 1.6 is support for new screen sizes. This is one of the things that has me very excited about Android 1.6 since it means Android will start becoming available on so many more devices. However, as a developer, I know this also means a bit of additional work. That's why we've spent quite a bit of time making it as easy as possible for you to update your apps to work on these new screen sizes.

To date, all Android devices (such as the T-Mobile G1 and Samsung I7500, among others) have had HVGA (320x480) screens. The essential change in Android 1.6 is that we've expanded support to include three different classes of screen sizes:


  • small: devices with a screen size smaller than the T-Mobile G1 or Samsung I7500, for example the recently announced HTC Tattoo

  • normal: devices with a screen size roughly the same as the G1 or I7500.

  • large: devices with a screen size larger than the G1 or I7500 (such as a tablet-style device.)

Any given device will fall into one of those three groups. As a developer, you can control if and how your app appears to devices in each group by using a few tools we've introduced in the Android framework APIs and SDK. The documentation at the developer site describes each of these tools in detail, but here they are in a nutshell:


  • new attributes in AndroidManifest for an application to specify what kind of screens it supports,

  • framework-level support for using image drawables/layouts correctly regardless of screen size,

  • a compatibility mode for existing applications, providing a pseudo-HVGA environment, and descriptions of compatible device resolutions and minimum diagonal sizes.

The documentation also provides a quick checklist and testing tips for developers to ensure their apps will run correctly on devices of any screen size.

Once you've upgraded your app using Android 1.6 SDK, you'll need to make sure your app is only available to users whose phones can properly run it. To help you with that, we've also added some new tools to Android Market.

Until the next time you upload a new version of your app to Android Market, we will assume that it works for normal-class screen sizes. This means users with normal-class and large-class screens will have access to these apps. Devices with "large" screens simply run these apps in a compatibility mode, which simulates an HVGA environment on the larger screen.

Devices with small-class screens, however, will only be shown apps which explicitly declare (via the AndroidManifest) that they will run properly on small screens. In our studies, we found that "squeezing" an app designed for a larger screen onto a smaller screen often produces a bad result. To prevent users with small screens from getting a bad impression of your app (and reviewing it negatively!), Android Market makes sure that they can't see it until you upload a new version that declares itself compatible.

We expect small-class screens, as well as devices with additional resolutions in Table 1 in the developer document to hit the market in time for the holiday season. Note that not all devices will be upgraded to Android 1.6 at the same time. There will be significant number of users still with Android 1.5 devices. To use the same apk to target Android 1.5 devices and Android 1.6 devices, build your apps using Android 1.5 SDK and test your apps on both Android 1.5 and 1.6 system images to make sure they continue to work well on both types of devices. If you want to target small-class devices like HTC Tattoo, please build your app using the Android 1.6 SDK. Note that if your application requires Android 1.6 features, but does not support a screen class, you need to set the appropriate attributes to false. To use optimized assets for normal-class, high density devices like WVGA, or for low density devices please use the Android 1.6 SDK.

Tuesday, October 6, 2009

ADC 2 Round 1 Scoring Complete


Media_http1bpblogspot_hatoe

The response to round one of the Android Developer Challenge 2 has been phenomenal! We originally expected that it would take two weeks to get all the necessary data to complete scoring. Over the last 10 days, more than 26,000 Android users reviewed and submitted our target of over 100 scores per application. With this enthusiastic support of the Android community, we are closing the first round of ADC 2 judging today.

We will now be reviewing the results and preparing for round 2. Please stay tuned for information about round 2, where the community, combined with a panel of judges, will narrow down the top 20 applications in each category to determine the final winners. Until then, users with the ADC 2 judging application currently installed will get a notice saying that round 1 is over. When round 2 opens, the judging application will resume giving out new submissions to score. We look forward to seeing the results of the final round and hope that you choose to help us score these top apps as well!

Monday, October 5, 2009

Gestures on Android 1.6

Touch screens are a great way to interact with applications on mobile devices. With a touch screen, users can easily tap, drag, fling, or slide to quickly perform actions in their favorite applications. But it's not always that easy for developers. With Android, it's easy to recognize simple actions, like a swipe, but it's much more difficult to handle complicated gestures, which also require developers to write a lot of code. That's why we have decided to introduce a new gestures API in Android 1.6. This API, located in the new package android.gesture, lets you store, load, draw and recognize gestures. In this post I will show you how you can use the android.gesture API in your applications. Before going any further, you should download the source code of the examples.

Creating a gestures library

The Android 1.6 SDK comes with a new application pre-installed on the emulator, called Gestures Builder. You can use this application to create a set of pre-defined gestures for your own application. It also serves as an example of how to let the user define his own gestures in your applications. You can find the source code of Gestures Builders in the samples directory of Android 1.6. In our example we will use Gestures Builder to generate a set of gestures for us (make sure to create an AVD with an SD card image to use Gestures Builder.) The screenshot below shows what the application looks like after adding a few gestures:


Media_httpdocsgooglec_pjaaa

As you can see, a gesture is always associated with a name. That name is very important because it identifies each gesture within your application. The names do not have to be unique. Actually it can be very useful to have several gestures with the same name to increase the precision of the recognition. Every time you add or edit a gesture in the Gestures Builder, a file is generated on the emulator's SD card, /sdcard/gestures. This file contains the description of all the gestures, and you will need to package it inside your application inside the resources directory, in /res/raw.

Loading the gestures library

Now that you have a set of pre-defined gestures, you must load it inside your application. This can be achieved in several ways but the easiest is to use the GestureLibraries class:


mLibrary = GestureLibraries.fromRawResource(this, R.raw.spells);
if (!mLibrary.load()) {
finish();
}


In this example, the gesture library is loaded from the file /res/raw/spells. You can easily load libraries from other sources, like the SD card, which is very important if you want your application to be able to save the library; a library loaded from a raw resource is read-only and cannot be modified. The following diagram shows the structure of a library:


Media_httpdocsgooglec_calts

Recognizing gestures

To start recognizing gestures in your application, all you have to do is add a GestureOverlayView to your XML layout:


<android.gesture.GestureOverlayView
android:id="@+id/gestures"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1.0" />


Notice that the GestureOverlayView is not part of the usual android.widget package. Therefore, you must use its fully qualified name. A gesture overlay acts as a simple drawing board on which the user can draw his gestures. You can tweak several visual properties, like the color and the width of the stroke used to draw gestures, and register various listeners to follow what the user is doing. The most commonly used listener is GestureOverlayView.OnGesturePerformedListener which fires whenever a user is done drawing a gesture:


GestureOverlayView gestures = (GestureOverlayView) findViewById(R.id.gestures);
gestures.addOnGesturePerformedListener(this);


When the listener fires, you can ask the GestureLibrary to try to recognize the gesture. In return, you will get a list of Prediction instances, each with a name - the same name you entered in the Gestures Builder - and a score. The list is sorted by descending scores; the higher the score, the more likely the associated gesture is the one the user intended to draw. The following code snippet demonstrates how to retrieve the name of the first prediction:


public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) {
ArrayList<prediction> predictions = mLibrary.recognize(gesture);

// We want at least one prediction
if (predictions.size() > 0) {
Prediction prediction = predictions.get(0);
// We want at least some confidence in the result
if (prediction.score > 1.0) {
// Show the spell
Toast.makeText(this, prediction.name, Toast.LENGTH_SHORT).show();
}
}
}


In this example, the first prediction is taken into account only if it's score is greater than 1.0. The threshold you use is entirely up to you but know that scores lower than 1.0 are typically poor matches. And this is all the code you need to create a simple application that can recognize pre-defined gestures (see the source code of the project GesturesDemo):


Media_httpdocsgooglec_nhxel

Gestures overlay

In the example above, the GestureOverlayView was used as a normal view, embedded inside a LinearLayout. However, as its name suggests, it can also be used as an overlay on top of other views. This can be useful to recognize gestures in a game or just anywhere in the UI of an application. In the second example, called GesturesListDemo, we'll create an overlay on top of a list of contacts. We start again in Gestures Builder to create a new set of pre-defined gestures:


Media_httpdocsgooglec_fvrci

And here is what the XML layout looks like:


<android.gesture.GestureOverlayView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gestures"
android:layout_width="fill_parent"
android:layout_height="fill_parent"

android:gestureStrokeType="multiple"
android:eventsInterceptionEnabled="true"
android:orientation="vertical">

<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />

</android.gesture.GestureOverlayView>


In this application, the gestures view is an overlay on top of a regular ListView. The overlay also specifies a few properties that we did not need before:



  • gestureStrokeType: indicates whether we want to recognize gestures made of a single stroke or multiple strokes. Since one of our gestures is the "+" symbol, we need multiple strokes


  • eventsInterceptionEnabled: when set to true, this property tells the overlay to steal the events from its children as soon as it knows the user is really drawing a gesture. This is useful when there's a scrollable view under the overlay, to avoid scrolling the underlying child as the user draws his gesture


  • orientation: indicates the scroll orientation of the views underneath. In this case the list scrolls vertically, which means that any horizontal gestures (like action_delete) can immediately be recognized as a gesture. Gestures that start with a vertical stroke must contain at least one horizontal component to be recognized. In other words, a simple vertical line cannot be recognized as a gesture since it would conflict with the list's scrolling.

The code used to load and set up the gestures library and overlay is exactly the same as before. The only difference is that we now check the name of the predictions to know what the user intended to do:


public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) {
ArrayList<Prediction> predictions = mLibrary.recognize(gesture);
if (predictions.size() > 0 && predictions.get(0).score > 1.0) {
String action = predictions.get(0).name;
if ("action_add".equals(action)) {
Toast.makeText(this, "Adding a contact", Toast.LENGTH_SHORT).show();
} else if ("action_delete".equals(action)) {
Toast.makeText(this, "Removing a contact", Toast.LENGTH_SHORT).show();
} else if ("action_refresh".equals(action)) {
Toast.makeText(this, "Reloading contacts", Toast.LENGTH_SHORT).show();
}
}
}


The user is now able to draw his gestures on top of the list without interfering with the scrolling:


Media_httpdocsgooglec_zddjc

The overlay even gives visual clues as to whether the gesture is considered valid for recognition. In the case of a vertical overlay, for instance, a single vertical stroke cannot be recognized as a gesture and is therefore drawn with a translucent color:


Media_httpdocsgooglec_zvbgd

It's your turn

Adding support for gestures in your application is easy and can be a valuable addition. The gestures API does not even have to be used to recognize complex shapes; it will work equally well to recognize simple swipes. We are very excited by the possibilities the gestures API offers, and we're eager to see what cool applications the community will create with it.

Saturday, October 3, 2009

Daftar Korban Gempa Sumbar

Daftar Nama Korban Gempa masih belum lengkap dan banyak korban yang belum teridentifikasi sampai dengan pagi ini. Medan yang sulit dan lokasi jalanan yang rusak mengakibatkan beberapa daerah tidak tersentuh bantuan terutama di beberapa Desa di Padang Pariaman.

Kurang lebih ada 4 desa yang terisolasi dimana ada sekitar tiga ratus rumah yang roboh dan belum dapat dikirim bantuan oleh tim evakuasi.

Korban tewas gempa padang Sumatra Barat hingga Kamis sore menjadi 478 orang, demikian data Posko Satkorlak Penanggulangan Bencana Sumbar.

Korban tewas berasal dari Kota Padang, Padangpariaman, Kota Solok, Kota Pariaman, dan Kota Bukittinggi.

Menurut salah seorang petugas Posko Satkorlak, Evi, data terus bertambah seiring masih berlangsungnya pencarian korban yang terperangkap di reruntuhan bangunan.

Di Kota Padang, korban banyak terperangkap di Hotel Ambacang, bimbingan belajar GAMMA, bimbel LIA di Khatib Sulaiman, Pasar Raya Padang, dan Sekolah Tinggi Bahasa Asing (STBA) Padang.

"Diperkirakan korban jiwa mencapai ribuan orang," kata Evi.

Pantauan ANTARA di Posko M Djamil Padang, mayat korban gempa terus berdatangan. Hingga Kamis sore, tercatat sebanyak 63 mayat korban.

RS terbesar di Kota Padang itu ramai dikunjungi masyarakat yang melihat daftar nama keluarganya yang tewas dalam musibah gempa.

Direktur RS M Jamil Padang, Suchyar Iskandar mengatakan, saat ini juga dirawat sebanyak 90 pasien korban gempa, dan 168 korban luka-luka.

Dari daftar nama korban tewas di RS M Jamil, terdapat nama Yuli Syahrial, kepala Cabang Bank Internasional Indonesia Padang.

Menurut salah seorang petugas di BII, Yuli Syahrial baru beberapa bulan bertugas di Kota Padang. Ia tewas di kantornya, pada saat gempa terjadi, Rabu sore.

Suasana Padang Kamis malam tampak mencekam. Aliran listrik yang padam, menyebabkan Kota Padang menjadi gelap. Sementara, lalu lintas kendaraan tampak ramai.

Ekonomi Padang juga lumpuh total karena pusat-pusat perdagangan tutup.

Warga juga mengeluhkan sulitnya mendapat bahan bakar minyak