Monday, February 28, 2011

Android notification

Notification In Android
Download SourceCode

   Android notification four types there.
        1.Status Bar Notification.
        2.Sound
        3.viberate
        4.Flash light


Screen Shot









Source Code


import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class NotifiActivity extends Activity {
   
    private NotificationManager mNotificationManager;
    private int SIMPLE_NOTFICATION_ID;
   
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
       
        mNotificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
        final Notification notifyDetails = new Notification(R.drawable.icon,"New Alert, Click Me!",System.currentTimeMillis());
       

        Button start = (Button)findViewById(R.id.Button01);
        Button cancel = (Button)findViewById(R.id.Button02);
       
        start.setOnClickListener(new OnClickListener() {
           
            public void onClick(View v) {
               
               
                Context context = getApplicationContext();
                CharSequence contentTitle = "Notification Details...";
                CharSequence contentText = "Browse Android Official Site by clicking me";
                Intent notifyIntent = new Intent(android.content.Intent.ACTION_VIEW,Uri.parse("http://www.google.com"));
                PendingIntent intent =
                    PendingIntent.getActivity(NotifiActivity.this, 0,
                    notifyIntent, android.content.Intent.FLAG_ACTIVITY_NEW_TASK);
                /*notifyIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);*/
                notifyDetails.setLatestEventInfo(context, contentTitle, contentText, intent);
                mNotificationManager.notify(0, notifyDetails);
            }
        });
       
        cancel.setOnClickListener(new OnClickListener() {
           
            public void onClick(View v) {
               
                mNotificationManager.cancel(0);
            }
        });
    }
}







Friday, February 18, 2011

Android Shape And Style

Android Shape And Style
DOWNLOAD SOURCE CODE

i added code for style and shape thing. u download and check it.

In this tutorial for u can apply style and shape for textview and layout



Screnn Shot





source code

shape.xml
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <gradient android:startColor="#0033FF" android:endColor="#FFFFFF"
        android:angle="90" />
   
</shape>

Wednesday, February 16, 2011

Tuesday, February 15, 2011

Animation for image and Text in android


Animation for image and text in android


DOWNLOAD SOURCE CODE



i added code for animation for image and text.
just download and check it.

Screen shot





Check out this may be help you

Related Posts Plugin for WordPress, Blogger...