I am developing an app that needs Hijri Date, I used what was published here converting gregorian to hijri date .
It works for me but it gave wrong date for example when the Gregorian is 20/9/2016 it became 17/12/1437 IN Hijri, and that's wrong it should be 19/12/1437.
Where is the problem ?
Regarding your conversion example, it seems to me you are looking for the Umalqura-variant of Hijri-calendar which is the official calendar of Saudi-Arabia.
The SO-link you posted refers to Joda-Time. This library does not support umalqura but four algorithmic variants of Hijri-calendar (only suitable as approximation). I have tested all four supported variants. None is for you.
If you are operating on Java-8-platform then you can use the following solution. However, if you are on Android and try to use the backport ThreetenABP then that will fail because its implementation deviates from Java-8:
If you want more calendar features like other variants or variable start of day (islamic days start at sunset!) or if you are operating on Android then you can use my library Time4J/A. The HijriCalendar of Time4J (or Time4A on Android) yields what you want:
Note that the last example is a conversion valid at noon time. When using evening as start of day then please consult the javadoc how to do that.
Update from 2016-09-07:
Other possible umalqura solutions with very different APIs on Android include