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. items can't be selected (or highlighted)

I just want to notice that the Layout for the ArrayAdapter contains
checkbox.



















--~--~---------~--~----~------------~-------~--~----~

2. Heap size overflow after I loaded audio file in SoundPool!!

After the program executed "SoundPool.load( "/sdcard/audio.MP3", 1 )"
sentence, the program crashed and threw the log "Heap size overflow!
req size: 1073664, max size: 1048576".

My source code is listed as blow.  What is the root cause for this
error?? Thanks!!

/*============================================================
private final String    SPEECH_FILE_FULL_NAME   = "/sdcard/audio.mp3";

AudioManager mAudioManager = ( AudioManager )( getSystemService
( Context.AUDIO_SERVICE ) );
float mVolume = mAudioManager.getStreamVolume
( AudioManager.STREAM_MUSIC );

int mSoundId = mSoundPool.load( SPEECH_FILE_FULL_NAME, 1 );
mSoundPool.setRate( mSoundId, 1.2f );
mSoundPool.play( mSoundId, mVolume, mVolume, 1, 0, 1.2f );
/*============================================================
--~--~---------~--~----~------------~-------~--~----~

3. How to change the "tone color" of an audio file??

4. How to keep service alive?

5. how to incude include static files(.a) in android jni application?

6. KeyEvent for backspace.

7. Supposed to use javac?