I am trying to implement simple notifications in my android app. I am reffering this developer guide
But getting this error message :
Incompatible types. Required: android.support.v7app.NotificationCompat.Builder Found: android.support.v4.app.Notification.Compat.Builder
Error Message screenshot
For the following code snippet :
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ic_launcher) .setContentTitle("My notification") .setContentText("Hello World!");
Here are my imports :
import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.app.NotificationCompat; import android.view.View; import android.widget.Button;
I think the correct NotificationCompat
class is imported. I am using Android Studio v2.1.2
for development. Please help me with this error message. I am new to android programming and java.
Replace
import android.support.v7.app.NotificationCompat;
with
import android.support.v4.app.NotificationCompat;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With