Example usage for android.content.res Resources getString

List of usage examples for android.content.res Resources getString

Introduction

In this page you can find the example usage for android.content.res Resources getString.

Prototype

@NonNull
public String getString(@StringRes int id) throws NotFoundException 

Source Link

Document

Return the string value associated with a particular resource ID.

Usage

From source file:com.foodsurvey.foodsurvey.ui.ReviewActivity.java

private void populatePageList() {
    mCurrentPageSequence = new ArrayList<Page>();
    Resources res = getResources();
    Page[] pageList = new Page[] {
            new SingleFixedChoicePage(this, res.getString(R.string.q1_title),
                    res.getString(R.string.q1_question)).setChoices(res.getStringArray(R.array.q1_options))
                            .setRequired(true),
            new SingleFixedChoicePage(this, res.getString(R.string.q2_title),
                    res.getString(R.string.q2_question)).setChoices(res.getStringArray(R.array.q2_options))
                            .setRequired(true),
            new SingleFixedChoicePage(this, res.getString(R.string.q3_title),
                    res.getString(R.string.q3_question)).setChoices(res.getStringArray(R.array.q3_options))
                            .setRequired(true),
            new SingleFixedChoicePage(this, res.getString(R.string.q4_title),
                    res.getString(R.string.q4_question)).setChoices(res.getStringArray(R.array.q4_options))
                            .setRequired(true),
            new TextPage(this, res.getString(R.string.q5_question)),
            new ImagePage(this, res.getString(R.string.q6_question)) };
    mCurrentPageSequence.addAll(Arrays.asList(pageList));

}

From source file:com.chauffeurprive.kronos.time.CircleView.java

public void initialize(Context context, TimePickerController controller) {
    if (mIsInitialized) {
        Log.e(TAG, "CircleView may only be initialized once.");
        return;/*from  w  w w .j a  v a  2 s .c  o m*/
    }

    Resources res = context.getResources();
    int colorRes = controller.getCircleBackgroundColor();
    mCircleColor = ContextCompat.getColor(context, colorRes);
    mDotColor = controller.getAccentColor();
    mPaint.setAntiAlias(true);

    mIs24HourMode = controller.is24HourMode();
    if (mIs24HourMode) {
        mCircleRadiusMultiplier = Float
                .parseFloat(res.getString(R.string.mdtp_circle_radius_multiplier_24HourMode));
    } else {
        mCircleRadiusMultiplier = Float.parseFloat(res.getString(R.string.mdtp_circle_radius_multiplier));
        mAmPmCircleRadiusMultiplier = Float
                .parseFloat(res.getString(R.string.mdtp_ampm_circle_radius_multiplier));
    }

    mIsInitialized = true;
}

From source file:com.enadein.carlogbook.CarLogbook.java

public MenuItem[] buildMenu() {
    Resources res = getResources();
    String name = getMediator().getUnitFacade().getCarName();
    carName = new MenuItem(0, name, MenuItem.HEADER);
    items.add(carName);/*from   w  ww .j  av a  2 s .c o  m*/
    items.add(new MenuItem(R.drawable.log, res.getString(R.string.menu_item_log)));
    items.add(new MenuItem(R.drawable.stat, res.getString(R.string.menu_item_reports)));
    items.add(new MenuItem(R.drawable.notify, res.getString(R.string.menu_item_notifications)));
    items.add(new MenuItem(R.drawable.cars, res.getString(R.string.menu_item_my_cars)));
    items.add(new MenuItem(R.drawable.calc, res.getString(R.string.calc)));
    items.add(new MenuItem(R.drawable.backup, res.getString(R.string.menu_item_import_export)));
    items.add(new MenuItem(R.drawable.sett, res.getString(R.string.menu_item_settings)));
    items.add(new MenuItem(R.drawable.info, res.getString(R.string.menu_item_about)));

    return items.toArray(new MenuItem[] {});

}

From source file:ca.mudar.mtlaucasou.BaseMapActivity.java

/**
 * Show the Processing dialog and start the Geocode search thread.
 */// w w w  . j ava2  s . com
public void showDialogProcessing() {

    Resources res = getResources();
    String message = res.getString(R.string.toast_postal_code_processing);

    pd = ProgressDialog.show(this, "", message, true);

    Thread thread = new Thread(this);
    thread.start();
}

From source file:com.agateau.equiv.ui.Kernel.java

public void shareCustomProductList(Context context) {
    File file = context.getFileStreamPath(CUSTOM_PRODUCTS_CSV);
    Uri contentUri = FileProvider.getUriForFile(context, "com.agateau.equiv.fileprovider", file);
    final Resources res = context.getResources();

    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("message/rfc822");
    intent.putExtra(Intent.EXTRA_EMAIL, new String[] { Constants.CUSTOM_PRODUCTS_EMAIL });
    intent.putExtra(Intent.EXTRA_SUBJECT, res.getString(R.string.share_email_subject));
    intent.putExtra(Intent.EXTRA_STREAM, contentUri);
    intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);

    context.startActivity(Intent.createChooser(intent, res.getString(R.string.share_via)));
}

From source file:at.flack.receiver.FacebookReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    Bundle bundle = intent.getExtras();//  w  w  w .  j av a2s  .  c om
    try {
        if (main instanceof FbMessageOverview && bundle.getString("type").equals("message")) {
            ((FbMessageOverview) main).addNewMessage(
                    new FacebookMessage(bundle.getString("fb_name"), bundle.getString("fb_message"),
                            bundle.getString("fb_img"), bundle.getLong("fb_id"), bundle.getString("fb_tid")));
        } else if (main instanceof FbMessageOverview && bundle.getString("type").equals("readreceipt")) {
            ((FbMessageOverview) main).changeReadReceipt(bundle.getLong("fb_time"),
                    bundle.getLong("fb_reader"));
        } else if (main instanceof FbMessageOverview && bundle.getString("type").equals("typ")) {
            ((FbMessageOverview) main).changeTypingStatus(bundle.getLong("my_id"), bundle.getLong("fb_id"),
                    bundle.getBoolean("fb_from_mobile"), bundle.getInt("fb_status"));
        } else if (main instanceof FbMessageOverview && bundle.getString("type").equals("img_message")) {
            ((FbMessageOverview) main).addNewMessage(new FacebookImageMessage(bundle.getString("fb_name"),
                    bundle.getString("fb_image"), bundle.getString("fb_preview"), bundle.getString("fb_img"),
                    bundle.getLong("fb_id"), bundle.getString("fb_tid")));
        } else if (bundle.getString("type").equals("read")) {
            killNotification(context,
                    new MarkAsRead(bundle.getString("fb_tid"), bundle.getBoolean("fb_markas")));
        } else if (bundle.getString("type").equals("message")
                || bundle.getString("type").equals("img_message")) {
            sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
            if (!sharedPrefs.getBoolean("notification_fbs", true))
                return;
            notify = sharedPrefs.getBoolean("notifications", true);
            vibrate = sharedPrefs.getBoolean("vibration", true);
            headsup = sharedPrefs.getBoolean("headsup", true);
            led_color = sharedPrefs.getInt("notification_light", -16776961);
            boolean all = sharedPrefs.getBoolean("all_fb", true);

            if (notify == false)
                return;
            if (bundle.getLong("fb_id") == bundle.getLong("my_id")) {
                return;
            }

            NotificationCompat.Builder mBuilder = null;
            boolean use_profile_picture = false;
            Bitmap profile_picture = null;

            String origin_name = bundle.getString("fb_name");

            try {
                profile_picture = RoundedImageView.getCroppedBitmap(Bitmap.createScaledBitmap(
                        ProfilePictureCache.getInstance(context).get(origin_name), 200, 200, false), 300);
                use_profile_picture = true;
            } catch (Exception e) {
                use_profile_picture = false;
            }

            Resources res = context.getResources();

            if (bundle.getString("type").equals("img_message")) {
                bundle.putString("fb_message", res.getString(R.string.fb_notification_new_image));
            }

            int lastIndex = bundle.getString("fb_message").lastIndexOf("=");
            if (lastIndex > 0 && Base64.isBase64(bundle.getString("fb_message").substring(0, lastIndex))) {
                mBuilder = new NotificationCompat.Builder(context)
                        .setSmallIcon(R.drawable.raven_notification_icon).setContentTitle(origin_name)
                        .setColor(0xFF175ea2)
                        .setContentText(res.getString(R.string.sms_receiver_new_encrypted_fb))
                        .setAutoCancel(true);
                if (use_profile_picture && profile_picture != null) {
                    mBuilder = mBuilder.setLargeIcon(profile_picture);
                } else {
                    mBuilder = mBuilder.setLargeIcon(convertToBitmap(origin_name,
                            context.getResources().getDrawable(R.drawable.ic_social_person), 200, 200));
                }
            } else { // normal or handshake

                if (bundle.getString("fb_message").charAt(0) == '%'
                        && (bundle.getString("fb_message").length() == 10
                                || bundle.getString("fb_message").length() == 9)) {
                    if (lastIndex > 0
                            && Base64.isBase64(bundle.getString("fb_message").substring(1, lastIndex))) {
                        mBuilder = new NotificationCompat.Builder(context).setContentTitle(origin_name)
                                .setColor(0xFF175ea2)
                                .setContentText(res.getString(R.string.sms_receiver_handshake_received))
                                .setSmallIcon(R.drawable.notification_icon).setAutoCancel(true);
                        if (use_profile_picture && profile_picture != null) {
                            mBuilder = mBuilder.setLargeIcon(profile_picture);
                        } else {
                            mBuilder = mBuilder.setLargeIcon(convertToBitmap(origin_name,
                                    context.getResources().getDrawable(R.drawable.ic_social_person), 200, 200));
                        }
                    } else {
                        return;
                    }
                } else if (bundle.getString("fb_message").charAt(0) == '%'
                        && bundle.getString("fb_message").length() >= 120
                        && bundle.getString("fb_message").length() < 125) {
                    if (lastIndex > 0
                            && Base64.isBase64(bundle.getString("fb_message").substring(1, lastIndex))) {
                        mBuilder = new NotificationCompat.Builder(context).setContentTitle(origin_name)
                                .setColor(0xFF175ea2)
                                .setContentText(res.getString(R.string.sms_receiver_handshake_received))
                                .setSmallIcon(R.drawable.notification_icon).setAutoCancel(true);
                        if (use_profile_picture && profile_picture != null) {
                            mBuilder = mBuilder.setLargeIcon(profile_picture);
                        } else {
                            mBuilder = mBuilder.setLargeIcon(convertToBitmap(origin_name,
                                    context.getResources().getDrawable(R.drawable.ic_social_person), 200, 200));
                        }
                    } else {
                        return;
                    }
                } else if (all) { // normal message
                    mBuilder = new NotificationCompat.Builder(context)
                            .setSmallIcon(R.drawable.raven_notification_icon).setContentTitle(origin_name)
                            .setColor(0xFF175ea2).setContentText(bundle.getString("fb_message"))
                            .setAutoCancel(true).setStyle(new NotificationCompat.BigTextStyle()
                                    .bigText(bundle.getString("fb_message")));

                    if (use_profile_picture && profile_picture != null) {
                        mBuilder = mBuilder.setLargeIcon(profile_picture);
                    } else {
                        mBuilder = mBuilder.setLargeIcon(convertToBitmap(origin_name,
                                context.getResources().getDrawable(R.drawable.ic_social_person), 200, 200));
                    }
                } else {
                    return;
                }
            }
            // }
            Uri alarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
            mBuilder.setSound(alarmSound);
            mBuilder.setLights(led_color, 750, 4000);
            if (vibrate) {
                mBuilder.setVibrate(new long[] { 0, 100, 200, 300 });
            }

            Intent resultIntent = new Intent(context, MainActivity.class);
            resultIntent.putExtra("FACEBOOK_NAME", origin_name);

            TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
            stackBuilder.addParentStack(MainActivity.class);
            stackBuilder.addNextIntent(resultIntent);
            PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(1,
                    PendingIntent.FLAG_UPDATE_CURRENT);
            mBuilder.setContentIntent(resultPendingIntent);
            if (Build.VERSION.SDK_INT >= 16 && headsup)
                mBuilder.setPriority(Notification.PRIORITY_HIGH);
            if (Build.VERSION.SDK_INT >= 21)
                mBuilder.setCategory(Notification.CATEGORY_MESSAGE);

            final NotificationManager mNotificationManager = (NotificationManager) context
                    .getSystemService(Context.NOTIFICATION_SERVICE);

            if (!MainActivity.isOnTop)
                mNotificationManager.notify(8, mBuilder.build());
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.example.android.sampletvinput.rich.RichAppLinkDetailsFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final String displayNumber = getActivity().getIntent().getStringExtra(RichFeedUtil.EXTRA_DISPLAY_NUMBER);

    DetailsOverviewRowPresenter dorPresenter = new DetailsOverviewRowPresenter(
            new DetailsDescriptionPresenter());
    dorPresenter.setSharedElementEnterTransition(getActivity(), "RichAppLinkDetailsFragment");

    DetailsOverviewRow row = new DetailsOverviewRow(displayNumber);
    Resources res = getResources();
    Bitmap bitmap = BitmapFactory.decodeResource(res, R.drawable.your_company);
    int length = Math.min(bitmap.getWidth(), bitmap.getHeight());
    Bitmap croppedBitmap = Bitmap.createBitmap(bitmap, (bitmap.getWidth() - length) / 2,
            (bitmap.getHeight() - length) / 2, length, length);
    row.setImageBitmap(getActivity(), croppedBitmap);

    Action action1 = new Action(0, res.getString(R.string.details_fragment_action_1));
    Action action2 = new Action(1, res.getString(R.string.details_fragment_action_2));
    row.addAction(action1);//from   w  w w .  j  av a2 s  .co m
    row.addAction(action2);

    ClassPresenterSelector presenterSelector = new ClassPresenterSelector();
    dorPresenter.setBackgroundColor(ContextCompat.getColor(getActivity(), R.color.detail_background));
    dorPresenter.setStyleLarge(true);

    dorPresenter.setOnActionClickedListener(new OnActionClickedListener() {
        @Override
        public void onActionClicked(Action action) {
            getActivity().finish();
        }
    });

    presenterSelector.addClassPresenter(DetailsOverviewRow.class, dorPresenter);
    presenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter());
    ArrayObjectAdapter adapter = new ArrayObjectAdapter(presenterSelector);
    adapter.add(row);

    setAdapter(adapter);
}

From source file:com.scigames.slidegame.ProfileActivity.java

/** Called with the activity is first created. */
@Override/*www  . j  a  va 2s.  c o m*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
    Log.d(TAG, "super.OnCreate");
    Intent i = getIntent();
    Log.d(TAG, "getIntent");
    firstNameIn = i.getStringExtra("fName");
    lastNameIn = i.getStringExtra("lName");
    passwordIn = i.getStringExtra("password");
    massIn = i.getStringExtra("mass");
    emailIn = i.getStringExtra("email");
    classIdIn = i.getStringExtra("classId");
    studentIdIn = i.getStringExtra("studentId");
    visitIdIn = i.getStringExtra("visitId");
    rfidIn = i.getStringExtra("rfid");
    photoUrl = i.getStringExtra("photoUrl");
    photoUrl = "http://mysweetwebsite.com/" + photoUrl;
    slideLevel = i.getStringExtra("slideLevel");
    cartLevel = i.getStringExtra("cartLevel");
    Log.d(TAG, "...getStringExtra");
    // Inflate our UI from its XML layout description.
    setContentView(R.layout.profile_page);
    Log.d(TAG, "...setContentView");

    // Hook up button presses to the appropriate event handler.
    //((Button) findViewById(R.id.back)).setOnClickListener(mBackListener);
    //((Button) findViewById(R.id.clear)).setOnClickListener(mClearListener);
    ((Button) findViewById(R.id.done)).setOnClickListener(mDone);
    //Log.d(TAG,"...instantiateButtons");

    //display name and profile info
    Resources res = getResources();
    TextView greets = (TextView) findViewById(R.id.greeting);
    greets.setText(String.format(res.getString(R.string.greeting), firstNameIn, lastNameIn));

    TextView fname = (TextView) findViewById(R.id.first_name);
    fname.setText(String.format(res.getString(R.string.profile_first_name), firstNameIn));

    TextView lname = (TextView) findViewById(R.id.last_name);
    lname.setText(String.format(res.getString(R.string.profile_last_name), lastNameIn));

    TextView school = (TextView) findViewById(R.id.school_name);
    school.setText(String.format(res.getString(R.string.profile_school_name), "from DB"));

    TextView teacher = (TextView) findViewById(R.id.teacher_name);
    teacher.setText(String.format(res.getString(R.string.profile_teacher_name), "from DB"));

    TextView classid = (TextView) findViewById(R.id.class_id);
    classid.setText(String.format(res.getString(R.string.profile_classid), classIdIn));

    TextView mmass = (TextView) findViewById(R.id.mass);
    mmass.setText(String.format(res.getString(R.string.profile_mass), massIn));

    TextView memail = (TextView) findViewById(R.id.email);
    memail.setText(String.format(res.getString(R.string.profile_email), emailIn));

    TextView mpass = (TextView) findViewById(R.id.password);
    mpass.setText(String.format(res.getString(R.string.profile_password), passwordIn));

    TextView mRfid = (TextView) findViewById(R.id.rfid);
    mRfid.setText(String.format(res.getString(R.string.profile_rfid), rfidIn));

    Log.d(TAG, "...Profile Info");
    Typeface ExistenceLightOtf = Typeface.createFromAsset(getAssets(), "fonts/Existence-Light.ttf");
    Typeface Museo300Regular = Typeface.createFromAsset(getAssets(), "fonts/Museo300-Regular.otf");
    Typeface Museo500Regular = Typeface.createFromAsset(getAssets(), "fonts/Museo500-Regular.otf");
    Typeface Museo700Regular = Typeface.createFromAsset(getAssets(), "fonts/Museo700-Regular.otf");

    TextView welcome = (TextView) findViewById(R.id.welcome);
    TextView notascigamersentence = (TextView) findViewById(R.id.notascigamersentence);
    setTextViewFont(ExistenceLightOtf, greets);
    setTextViewFont(Museo500Regular, fname, lname, school, teacher, classid, mmass, memail, mpass, mRfid);

    Button Done = (Button) findViewById(R.id.done);
    setButtonFont(ExistenceLightOtf, Done);

    //set listener
    task.setOnResultsListener(this);

    //push picture back.-- photo
    task.cancel(true);
    //create a new async task for every time you hit login (each can only run once ever)
    task = new SciGamesHttpPoster(ProfileActivity.this, "http://mysweetwebsite.com/push/update_mass.php"); //i'm using MASS just for now
    //set listener
    task.setOnResultsListener(ProfileActivity.this);

    //prepare key value pairs to send
    String[] keyVals = { "student_id", studentIdIn, "visit_id", visitIdIn, "mass", massIn };

    //create AsyncTask, then execute
    @SuppressWarnings("unused")
    AsyncTask<String, Void, JSONObject> serverResponse = null;
    serverResponse = task.execute(keyVals);
    Log.d(TAG, "...task.execute(keyVals)");

}

From source file:com.scigames.slidegame.Registration3MassActivity.java

/** Called with the activity is first created. */
@Override//from   w  w w.  ja v  a2 s  .  c o  m
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.d(TAG, "super.OnCreate");
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
    Intent i = getIntent();
    Log.d(TAG, "getIntent");
    firstNameIn = i.getStringExtra("fName");
    lastNameIn = i.getStringExtra("lName");
    studentIdIn = i.getStringExtra("studentId");
    visitIdIn = i.getStringExtra("visitId");
    Log.d(TAG, "...getStringExtra");

    // Inflate our UI from its XML layout description.
    setContentView(R.layout.registration3_mass);
    Log.d(TAG, "...setContentView");

    // Find the text editor view inside the layout, because we
    // want to do various programmatic things with it.
    thisMass = (EditText) findViewById(R.id.mass);
    /* to hide the keyboard on launch, then open when tap in firstname field */
    thisMass.setInputType(InputType.TYPE_NULL);
    thisMass.setOnTouchListener(new View.OnTouchListener() {
        //@Override
        public boolean onTouch(View v, MotionEvent event) {
            thisMass.setInputType(InputType.TYPE_CLASS_TEXT);
            thisMass.onTouchEvent(event); // call native handler
            return true; // consume touch even
        }
    });
    Log.d(TAG, "...instantiateEditTexts");

    //display name in greeting sentence
    Resources res = getResources();
    TextView greets = (TextView) findViewById(R.id.greeting);
    greets.setText(String.format(res.getString(R.string.greeting), firstNameIn, lastNameIn));
    Log.d(TAG, greets.toString());
    Log.d(TAG, "...Greetings");

    //set info to what we know already
    //firstName.setText(firstNameIn);
    //lastName.setText(lastNameIn);

    // Hook up button presses to the appropriate event handler.
    ((Button) findViewById(R.id.back)).setOnClickListener(mBackListener);
    ((Button) findViewById(R.id.continue_button)).setOnClickListener(mContinueButtonListener);
    ((Button) findViewById(R.id.scan)).setOnClickListener(mScanButtonListener);
    Log.d(TAG, "...instantiateButtons");

    //set listener
    task.setOnResultsListener(this);
}

From source file:com.diandi.widget.googledatetimepicker.date.DatePickerDialog.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Log.d(TAG, "onCreateView: ");
    getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);

    View view = inflater.inflate(R.layout.date_picker_dialog, null);

    mDayOfWeekView = (TextView) view.findViewById(R.id.date_picker_header);
    mMonthAndDayView = (LinearLayout) view.findViewById(R.id.date_picker_month_and_day);
    mMonthAndDayView.setOnClickListener(this);
    mSelectedMonthTextView = (TextView) view.findViewById(R.id.date_picker_month);
    mSelectedDayTextView = (TextView) view.findViewById(R.id.date_picker_day);
    mYearView = (TextView) view.findViewById(R.id.date_picker_year);
    mYearView.setOnClickListener(this);

    int listPosition = -1;
    int listPositionOffset = 0;
    int currentView = MONTH_AND_DAY_VIEW;
    if (savedInstanceState != null) {
        mWeekStart = savedInstanceState.getInt(KEY_WEEK_START);
        mMinYear = savedInstanceState.getInt(KEY_YEAR_START);
        mMaxYear = savedInstanceState.getInt(KEY_YEAR_END);
        currentView = savedInstanceState.getInt(KEY_CURRENT_VIEW);
        listPosition = savedInstanceState.getInt(KEY_LIST_POSITION);
        listPositionOffset = savedInstanceState.getInt(KEY_LIST_POSITION_OFFSET);
    }/*  www.j a v  a2 s . co  m*/

    final Activity activity = getActivity();
    mDayPickerView = new DayPickerView(activity, this);
    mYearPickerView = new YearPickerView(activity, this);

    Resources res = getResources();
    mDayPickerDescription = res.getString(R.string.day_picker_description);
    mSelectDay = res.getString(R.string.select_day);
    mYearPickerDescription = res.getString(R.string.year_picker_description);
    mSelectYear = res.getString(R.string.select_year);

    mAnimator = (AccessibleDateAnimator) view.findViewById(R.id.animator);
    mAnimator.addView(mDayPickerView);
    mAnimator.addView(mYearPickerView);
    mAnimator.setDateMillis(mCalendar.getTimeInMillis());
    // TODO: Replace with animation decided upon by the design team.
    Animation animation = new AlphaAnimation(0.0f, 1.0f);
    animation.setDuration(ANIMATION_DURATION);
    mAnimator.setInAnimation(animation);
    // TODO: Replace with animation decided upon by the design team.
    Animation animation2 = new AlphaAnimation(1.0f, 0.0f);
    animation2.setDuration(ANIMATION_DURATION);
    mAnimator.setOutAnimation(animation2);

    mDoneButton = (Button) view.findViewById(R.id.done);
    mDoneButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            tryVibrate();
            if (mCallBack != null) {
                mCallBack.onDateSet(DatePickerDialog.this, mCalendar.get(Calendar.YEAR),
                        mCalendar.get(Calendar.MONTH), mCalendar.get(Calendar.DAY_OF_MONTH));
            }
            dismiss();
        }
    });

    updateDisplay(false);
    setCurrentView(currentView);

    if (listPosition != -1) {
        if (currentView == MONTH_AND_DAY_VIEW) {
            mDayPickerView.postSetSelection(listPosition);
        } else if (currentView == YEAR_VIEW) {
            mYearPickerView.postSetSelectionFromTop(listPosition, listPositionOffset);
        }
    }
    return view;
}