Reputation: 5176
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);
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
version.@SuppressWarnings
, so that is ruled out.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);
}
Upvotes: 4
Views: 4673
Reputation: 1862
You have to turned on warnings of your related project from project properties. To do this follow these steps:
or remove check box from project specific error/warnings settings and click on Android Lint Preferences tab and search for deprecated Serverity.
Upvotes: 0
Reputation: 8068
Have a look at:
Preferences | Java | Compiler | Errors/Warnings | Deprecated and Restricted API
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.
Upvotes: 2
Reputation: 15886
Check for following:
Properties > Java > Compiler > Errors/Warnings > Deprecated and restricted API
Select Warning
for Deprecated API.
Upvotes: 0