Sunday, March 13, 2016

DatePicker, Sony Xperia and dates before 1980

I had a user report that they could not set a birth date before 1980 on their Sony Xperia phone. Bit of a problem if you are older than 36.

To fix this, first add the following to where ever you are inflating your datepicker:

this.datePicker = (DatePicker) view.findViewById(R.id.datePicker);
// hack also added to styleif (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    Calendar calendar1 = Calendar.getInstance();
    calendar1.set(1900, Calendar.JANUARY, 1, 0, 0, 0);
    datePicker.setMinDate(calendar1.getTimeInMillis());
}


Unfortunately, the DatePicker.setMinDate is not exposed pre HONEYCOMB so to fix those apps, you can try adding this to your base application style

<!-- Base application theme. --><style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->    <item name="android:startYear">1900</item>
</style>

Sunday, March 6, 2016

I failed sharing in Kindergarten, so when asked to do a simple sample app, I had to create myself a GitHub account. Normally I use Bitbucket due to their more commercial friendly approach.

Set up was reasonably painless and my first impressions are positive.

My challenge, as given was as follows:

Framework:

  • Android Studio 2.0+
  • Gradle build system
  • Target SDK Marshmallow
  • Min SDK Ice Cream Sandwich
  • The use of 3rd-party libraries to facilitate development is encouraged

Task


  • Create a new android project
  • The Root Activity should be a Navigation Drawer
  • The application should follow the material design principles
  • The core view of the main activity should be a Recycler View
  • The Recyler should implement some sort of custom view
  • The custom view should download and display images downloaded from the internet (imgur)

To see my sample app, CLICK HERE