1

I'm getting an error stating Could not find class 'android.app.Notification$Builder' but I'm not sure exactly why this is happening all of a sudden (it was working previously).

LOGCAT:

08-30 20:58:41.200: V/In the parser(5056): now
08-30 20:58:41.275: E/dalvikvm(5056): Could not find class 'android.app.Notification$Builder', referenced from method com.project.test.datasettingsConfigFinalActivity.showNotification
08-30 20:58:41.275: W/dalvikvm(5056): VFY: unable to resolve new-instance 17 (Landroid/app/Notification$Builder;) in Lcom/project/test/datasettings/ConfigFinalActivity;
08-30 20:58:41.275: D/dalvikvm(5056): VFY: replacing opcode 0x22 at 0x0035
08-30 20:58:41.275: D/dalvikvm(5056): VFY: dead code 0x0037-007f in Lcom/tracfone/straighttalk/stdatasettings/ConfigFinalActivity;.showNotification ()V

SOURCE:

@SuppressWarnings("deprecation")
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
void showNotification() throws SAXException, ParserConfigurationException {

    String field = getString(R.string.config_name_label);

    String value = Values.get("name").toString();
    int mId = 1;
    String title = "1 of " + TotalSteps + " (Update " + field + ":)";
    Notification.Builder mBuilder = new Notification.Builder(this)
    .setSmallIcon(R.drawable.notifications_icon)
    .setContentTitle(title).setContentText(value);
    Intent resultIntent = new Intent(this,
            NotificationActivityForMultiProf.class);
    resultIntent.putExtra(field, value);
    PendingIntent resultPendingIntent = PendingIntent.getActivity(
            getApplicationContext(), 0, resultIntent,
            PendingIntent.FLAG_UPDATE_CURRENT);
    mBuilder.setContentIntent(resultPendingIntent);
    NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    // mId allows you to update the notification later on.
    mNotification = mBuilder.getNotification();
    mNotification.flags |= Notification.FLAG_AUTO_CANCEL;
    mNotificationManager.notify(mId, mNotification);
    finish();
}
BugHunter
  • 13
  • 1
  • 4
  • Change `Notification.Builder mbuilder = new Notification.Builder(this)` to this `NotificationCompat.Builder mbuilder = new NotificationCompat.Builder(this)` – Rachit Mishra Aug 30 '13 at 21:22
  • I tried it... Now I'm getting: NotificationCompat cannot be resolved to a type – BugHunter Aug 30 '13 at 21:28
  • okay revert to your original code, clean your project and rebuild !, meanwhile see if this http://stackoverflow.com/questions/6391870/how-exactly-to-use-notification-builder helps you ! – Rachit Mishra Aug 30 '13 at 21:37

0 Answers0