IncomingMessage.javaAPI DocGoogle Android v1.5 Example3402Sun Nov 11 13:01:04 GMT


public class IncomingMessage extends

Fields Summary
Constructors Summary
Methods Summary
private android.view.ViewinflateView(int resource)

        ViewInflate vi = (ViewInflate)getSystemService(Context.INFLATE_SERVICE);
        return vi.inflate(resource, null, null);
protected voidonCreate(android.os.Bundle icicle)



        Button button = (Button) findViewById(;
        button.setOnClickListener(new Button.OnClickListener() {
                public void onClick(View v) {
protected voidperformNotification()

         * Here we send a notification that is both transient and persistent.
         * The transient part is the view that comes up and shows the user
         * the text of what could be an incoming message.  The persistent part
         * goes into the status bar where they can acknowledge it later.

        // look up the notification manager service
        NotificationManager nm = (NotificationManager)

        // the transient notification =======================================
        // create the view
        View view = inflateView(R.layout.incoming_message_panel);

        // set the text in the view
        TextView tv = (TextView)view.findViewById(;
        tv.setText("kthx. meet u for dinner. cul8r");

        // the persistent notification ======================================

        // what happens when we click the icon
        Intent clickIntent = new Intent(Intent.MAIN_ACTION);
        clickIntent.setClass(this, IncomingMessageView.class);

        // construct the Notification object.
        Notification notif = new Notification(
                            clickIntent, null, null);

        // after a 100ms delay, vibrate for 250ms, pause for 100 ms and
        // then vibrate for 500ms.
        notif.vibrate = new long[] { 100, 250, 100, 500};

        // send the notification ============================================

        nm.notifyWithView(R.layout.incoming_message_panel, view,
                NotificationManager.LENGTH_LONG, notif);