protected static final String TAG = "MainActivity";
 Context contex;
 int icon=R.drawable.ic_launcher;
 CharSequence message="Downloading";
 
 
    @Override
    protected void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        final NotificationManager mnotifymngr=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
        final Notification notification =new Notification(icon, message, System.currentTimeMillis()); 
        
        Intent intent =new Intent(MainActivity.this,Progress.class);
        final PendingIntent pintent=PendingIntent.getActivity(contex, 0,intent , 0);
        notification.setLatestEventInfo(contex, "sdfs", "asdfa", pintent);
        mnotifymngr.notify(0, notification);
        
        
    }

Add a code snippet to your website: www.paste.org