Jetpack Compose Smart Recomposition

To have smart recomposition scopes play a pivotal role. You can check Vinay Gaba’s What is “donut-hole skipping” in Jetpack Compose? article. Leland Richardson explains in this tweet as The part that is “donut hole skipping” is the fact that a new lambda being passed into a composable (ie Button) can recompose without recompiling the … Read more

ADB access denied to data folder?

Update 2023; accessing data is not even through USB (file transfer mode) possible anymore (since a few Android and/or Samsung-device updates ago). Root your device. Original answer; Starting from API level 8 (Android 2.2), for the debuggable application (the one built by Android Studio all the times unless the release build was requested), you can … Read more

YouTube API Android auto start

What you are looking for is the Youtube API’s loadVideo method. From the docs: public abstract void loadVideo (String videoId) Loads and plays the specified video. You can use it like this: @Override public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer player, boolean wasRestored) { this.player = player; player.loadVideo(; // where is a String of a Youtube … Read more

Rotating image. Animation list or animated rotate? (Android)

Rotate drawable suggested by Praveen won’t give you control of frame count. Let’s assume you want to implement a custom loader which consists from 8 sections: Using animation-list approach, you need to create 8 frames rotated by 45*frameNumber degrees manually. Alternatively, you can use 1st frame and set rotation animation to it: File res/anim/progress_anim.xml: <?xml … Read more

Gradle android build for different processor architectures

As of Android Gradle Plugin version 13 you can now generate seperate APK’s using the new “split” mechanism. You can read about it here. The default file structure for placing your .so files is: src -main -jniLibs -armeabi -armeabi-v7a -x86 -mips Note that the name of the .so file is unimportant … Read more

UserRecoverableAuthException: NeedPermission

Try following the Drive quickstart for Android, it is a step-by-step guide showing how to authorize and upload a file to Drive: To be more specific, it looks like you are not catching the UserRecoverableException and triggering the intent to have the user authorize the app. This is documented in the Google Play Services … Read more

Generating iOS and Android icons in Cordova / PhoneGap

I wrote a script that auto generates icons for cordova using ImageMagick: To use it, create an “icon.png” file and place it in the root folder of your project, then run: cordova-icon and it will generate all the required icons for the platforms your project has. You can also configure it as a hook … Read more

Disable WebView touch events in Android

mWebView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return true; } }); Disables all touch events on a WebView because the touch listener is executed before the default touch behavior of the WebView. By returning true the event is consumed and isn’t propagated to the WebView. Using android:clickable=”false” does not disable touch … Read more

Android HttpClient and HTTPS

This should get you started. I’m using basically the same, except with ThreadSafeClientConnManager. SchemeRegistry schemeRegistry = new SchemeRegistry(); schemeRegistry.register(new Scheme(“https”, SSLSocketFactory.getSocketFactory(), 443)); HttpParams params = new BasicHttpParams(); SingleClientConnManager mgr = new SingleClientConnManager(params, schemeRegistry); HttpClient client = new DefaultHttpClient(mgr, params);