Recently, while migrating one of my App ‘InSaver!’ from Java to Kotlin, I stumbled upon a strange, like very strange issue.. 😕

I had a SettingsActivity and a SettingsFragment nested in the same Activity which extended PreferenceFragmentCompat.

Everything was just Fine in Java & then just a quick Convert to Kotlin took so many hours to get fixed!

So, what was all the ruckus about?
Well my SettingsFragment crashed as soon as it hit the onCreatePreferences() method..
The only thing that logcat showed was that the Bundle in the constructor i.e. savedInstanceState was null 🙄.

This shouldn’t have happened because I used the built-in Refactor to convert Java to Kotlin as this class had nothing much which needed my manual interaction..

Somewhere on the stackoverflow, I found out that the Bundle i.e the savedInstanceState variable is “NULLABLE”.

The automated refactor somehow ‘forgot’ or maybe it was an other issue.. I don’t know that yet, to put an ? to Bundle object, hence making it @NonNull which made Kotlin fire the crash..

If that’s happened or is happening to you, just mark the Bundle as well as the RootKey as Nullable like –

override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {}

Why you should Notify a user to Update App?


If you observed, I used the word ‘Notify’ because you should Never force your User to Update the App unless it’s too important!
For example: If your App is server sided & you currently changed some API stuffs or the updated version fixes a critical security issue then only you should force a user to Update App!

Read More

Simplest way to ‘Remove Ads’ via IAP

There are plenty of tutorials on the Internet bout how to Remove Ads in your App via IAP on Android,
but all are way harder & difficult for a beginner to understand…
Someone with a lil bit of Experience in Android will also find it a bit difficult…

Read More

Making Fragments Bulletproof for NPEs

If you are using Fragments in your App then I’m sure you might have experienced a situation where the getActivity() returned null & your App came down Crashing with an NPE!
Read More

Building an Android App’s ‘Flavor’ in AIDE

Building an App’s Flavor is way damn easy in the Android Studio but in AIDE… 😵

Its not that easy to understand if you are a beginner!
I was, untill yesterday 😛
Its not toooo complicated, just follow the instructions.

Read More

Scam for Android Developers!

Few Days after I published my App ‘Status Saver’ & it got a lil bit attention on the Google PlayStore, I received a mail from a Company / Organization named as “FMFG” claiming that I had used a Feature (Push Notification) in my App whose Patent was registered by their client…

Wow! (like Seriously?) 😑
That guy even demanded a ‘Fee’ & that was somewhat Suspicious!
Below is the Mail Content…

Read More