Programming the trackball light

by Boardy » Tue, 23 Mar 2010 01:51:48 GMT


Sponsored Links
 Hi all,

I am currently looking into developing an app for the android
platform. Before getting started on my app I have been going through
the development guide for android.

I was looking at flashing the trackball light when I perform a
notification event.

String ns = Context.NOTIFICATION_SERVICE;
        NotificationManager mNotificationManager = (NotificationManager)
getSystemService(ns);

        int icon = R.drawable.notification_icon;
        CharSequence tickerText = "Hello";
        long when = System.currentTimeMillis();

        Notification notification = new Notification(icon, tickerText,
when);

        Context context = getApplicationContext();
        CharSequence contentTitle = "My notification";
        CharSequence contentText = "Hello world!";
        Intent notificationIntent = new Intent(this, Hello.class);
        PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
notificationIntent, 0);

        notification.setLatestEventInfo(context, contentTitle,
contentText, contentIntent);
        notification.defaults |= Notification.DEFAULT_SOUND;
                long[] vibrate = {0, 500, 100, 200, 100, 500, 100,
500, 200, 500};
        notification.vibrate = vibrate;
                notification.defaults |= Notification.DEFAULT_LIGHTS;
        mNotificationManager.notify(HELLO_ID, notification);

I have put in notification.defaults |= Notification.DEFAULT_LIGHTS;
thinking that this was for the trackball LED but I think its the led
at the top of the phone, that one that lights up to show that its
charging.

How would I flash the light on the trackball. I have an HTC Hero.
Thanks for your help

--



Other Threads

1. source code for android camera app android 2.2

I can get the most recent android 2.3 version from git, but eclipse
doesn't like running it on my nexus one running 2.2.

Can someone provide the right link?

TIA
Bernard T. Higonnet

-- 

2. Multiple screen support (panic)

Hi at all,

I have some problem with multiple screen support, I work with dp(dpi)
for specify the layout_heigth and layout_width and I hope that is the
better way to support multiple screen, but when I tried with two
smartphone I meet two different result.

I give an example, this is a layout I use:

<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/
android"
                                                         
android:id="@+id/cities_main_layout"
                                                         
android:orientation="vertical"
                                                         
android:layout_width="fill_parent"
                                                         
android:layout_height="fill_parent"

                                                         >



                                        <ListView
                                                android:id="@+id/citieslist"
                                                
android:layout_width="wrap_content"
                                                android:layout_height="320dip"
                                                
android:layout_gravity="center_vertical"
                                                
android:layout_below="@id/cities_main_layout"
                                        />

                                        <LinearLayout
                                                         
android:id="@+id/cities_button_layout"
                                                         
android:orientation="horizontal"
                                                         
android:layout_width="wrap_content"
                                                         
android:layout_height="wrap_content"
                                                         
android:layout_below="@id/citieslist"
                                                         
android:layout_gravity="center_vertical"
                                        >
                                                <Button
                                                        
android:id="@+id/bycountry"
                                                android:layout_height="50dip"
                                                android:layout_width="105dip"
                                                
android:background="@drawable/buttonmarket"
                                                
android:text="@string/button_bycountry"
                                        />
                                        <Button
                                                        android:id="@+id/top10"
                                                android:layout_height="50dip"
                                                android:layout_width="105dip"
                                                
android:background="@drawable/buttonmarket"
                                                
android:text="@string/button_top10"
                                        />
                                        <Button
                                                        
android:id="@+id/recommended"
                                                android:layout_height="50dip"
                                                android:layout_width="105dip"
                                                
android:background="@drawable/buttonmarket"
                                                
android:text="@string/button_recommended"
                                        />

                                        </LinearLayout>

                         </RelativeLayout>


The button are at the bottom of the layout, and I see two different
result:

img600(dot)imageshack(dot)us/img600/5513/htcmagicg2(dot)png

img441(dot)imageshack(dot)us/img441/6440/samsunggalaxys(dot)png

In the last smartphone I can see the buttons, instead in the first I
cannot...what's wrong?

I have to write a layout for any set of screen??!!!

-- 

3. is it possible to call MountService in my Activity?

4. To upload and share images

5. We are all droids

6. Barcode Reader and Soft Input

7. Problem building opensles