Android P (API 28) – What does the StrictMode policy violation “SmartSelectionEventTracker$SelectionEvent;->selectionAction” mean?

In Android P, restrictions have been added to private APIs (that is, APIs that are not part of the public SDK and are accessed via reflection). See Restrictions on non-SDK interfaces: Android 9 (API level 28) introduces new restrictions on the use of non-SDK interfaces, whether directly, via reflection, or via JNI. These restrictions are … Read more

A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks

That means you have opened something but never close them.Closable have a method close which you must call to release the resources associated with the component when you no longer need it. To look for the leak, you can try MAT, I often use it to find memory leaks(static data holding a reference to Activity, … Read more

Android StrictMode InstanceCountViolation

It’s all in the code The key is StrictMode.sExpectedActivityInstanceCount and incrementExpectedActivityCount and decrementExpectedActivityCount: Increment is called in ActivityThread.performLaunchActivity just after creating the Activity instance. Decrement is called in ActivityThread.performDestroyActivity after the activity has been removed from the application. So the limit is less each time an activity is destroyed, however if an instance is leaked … Read more

Should accessing SharedPreferences be done off the UI Thread?

I’m glad you’re already playing with it! Some things to note: (in lazy bullet form) if this is the worst of your problems, your app’s probably in a good spot. 🙂 Writes are generally slower than reads, though, so be sure you’re using SharedPreferenced$Editor.apply() instead of commit(). apply() is new in GB and async (but … Read more