Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/199.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 找不到类“android.app.Notification$Builder”_Java_Android_Class - Fatal编程技术网

Java 找不到类“android.app.Notification$Builder”

Java 找不到类“android.app.Notification$Builder”,java,android,class,Java,Android,Class,我收到一个错误,说明找不到类“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.

我收到一个错误,说明找不到类“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();
}

更改通知.Builder mbuilder=new Notification.Builder此为此NotificationCompat.Builder mbuilder=new NotificationCompat.Builder此我已尝试。。。现在我得到了:NotificationCompat无法解析为类型OK恢复到原始代码,清理项目并重建!,同时看看这是否对你有帮助!