Skip to main content

Posts

Showing posts from February, 2015

Get metadata from pdf via Mupdf library in Android

In this link , one of my previous posts, I have explained how to add mupdf library as a module into an Android Studio project. You can either start with this guide or directly continue to this post. The target file to edit is  mupdf.c . This file contains ndk functions in order to be called from java part. We will just add a ndk function to fetch metadata of a pdf file. Because mupdf library has a functionality to provide it, we don't need any further coding.

How to avoid API-level warning of Android Studio

Before giving the solution, let's start with a scenario. setSelectionFromTop() is a new method in Android Lollipop API. This method is basically beneficial to precisely keep scroll state of a ListView. By keeping that info, a developer can go back to old scroll state after doing some operation like data set change. You are aware of API level and you do your control before you call this function: if (currentapiVersion >= Build.VERSION_CODES.LOLLIPOP) { srlistview.setSelectionFromTop(index, top); } But if project minSdk is set to a lower level (in this case it is 15), this warning will still be displayed in Android Studio: