public void onClick(View v) {
Intent notificationIntent = new Intent(this, MainActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 1,
notificationIntent, PendingIntent.FLAG_CANCEL_CURRENT);
NotificationManager nm = (NotificationManager) this
.getSystemService(Context.NOTIFICATION_SERVICE);
Resources res = this.getResources();
Notification.Builder builder = new Notification.Builder(this);
builder.setContentIntent(contentIntent)
.setSmallIcon(R.drawable.ic_launcher)
.setLargeIcon(
BitmapFactory.decodeResource(res,
R.drawable.ic_launcher)).setTicker("helllo")
.setWhen(System.currentTimeMillis()).setAutoCancel(true)
.setContentTitle("Messge").setContentText("Messge22");
Notification n = builder.build();
nm.notify(5, n);
}
I am trying to use this Code for Send Notification On Button click but there is Error coming in Code it show Error Call requires API level 11 (current min is 8): android.app.Notification.Builder#setContentIntent i have set Project Api Level 19 please help me where am doing wrong please suggest me Solution target=android-19 Project Properties while I have to code for:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />