日食不显示德precated警告? [英] Eclipse not showing deprecated warning?

查看:237
本文介绍了日食不显示德precated警告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据Javadoc文档:

As per Javadocs:

public Date (int year, int month, int day) 
This constructor was deprecated in API level 1.

Date date = new Date(year,month,date);

这个构造是API等级1 pcated德$ P $,但我的Eclipse是不是给我的Andr​​oid项目我创建德precation警告。有什么可以的问题?有没有办法,我在做一个愚蠢的错误?

This constructor was deprecated in API Level 1 but my Eclipse isn't giving me deprecation warning in the Android project I'm creating. What can be the issue? Is there a silly mistake that I'm making?


  • 我在编译项目 4.0 版本。

  • 我检查皮棉preferences和它的罚款。

  • 我没有设置 @燮pressWarnings ,这样就排除了。

  • I've compiled the project at 4.0 version.
  • I've checked the Lint preferences and it's fine.
  • I've not set an @SuppressWarnings, so that is ruled out.

这是code,我使用:

This is the code that I'm using:

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;

import android.app.Activity;
import android.app.DatePickerDialog;
import android.app.DatePickerDialog.OnDateSetListener;
import android.app.Dialog;
import android.content.Context;
import android.graphics.Paint;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;

@Override
    protected Dialog onCreateDialog(int id) {
        Calendar mCalen = Calendar.getInstance();
        int day = mCalen.get(Calendar.DAY_OF_MONTH);
        int month = mCalen.get(Calendar.MONTH);
        int year = mCalen.get(Calendar.YEAR);
        return new DatePickerDialog(this, new OnDateSetListener() {

            @Override
            public void onDateSet(DatePicker view, int year, int monthOfYear,
                    int dayOfMonth) {
                String newDate = new StringBuilder().append(dayOfMonth)
                        .append("/").append(monthOfYear + 1).append("/")
                        .append(year).toString();
                date = null;
                timeStamp = null;
                dateStamp = 0;
                date = newDate;
                timeStamp = new Date(year, monthOfYear, dayOfMonth);
                dateStamp = timeStamp.getTime();
                dateTextView.setText(date);
            }
        }, year, month, day);
    }

推荐答案

有一个看看:

Preferences | Java | Compiler | Errors/Warnings | Deprecated and Restricted API

确认德precated API 设置为警告。确保code这是德precated有一个@德precated注释无论是在类/方法或在JavaDoc。

Make sure Deprecated API is set to Warning. Ensure the code which is deprecated has a @Deprecated annotation either at the class / method or in the JavaDoc.

这篇关于日食不显示德precated警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆