1

我收到一条错误消息,指出找不到类 'android.app.Notification$Builder',但我不确定为什么会突然发生这种情况(它以前工作过)。

日志猫:

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

资源:

@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();
}
4

0 回答 0