Receiver as inner class in Android

In my code there is an inner class that extends BroadcastReceiver. And I have added the following line to the AndroidManifest.xml: <receiver android:name=”OuterClass$InnerClass android:enabled=”true”/> But I am receiving the following error: unable to instantiate receiver org.example.test.OuterClass$InnerClass How can I solve this issue ?

How to solve the XML parsing performance issue on Android

I have to read a XML file with about ~4000 lines on Android. First I tried the SimpleXML library because it’s the easiest and it took about 2 minutes on my HTC Desire. So I thought maybe SimpleXML is so slow because of reflection and all the other magic that this library uses. I rewrote […]

How to display Persian(Farsi) numbers in views

I want to display Persian(Farsi) numbers on views. For example I calculated a date and converted it to Jalali calendar but how can I display it by Persian numbers?

Glide load local image by Uri.

I’m trying to use Glide to load an image from local storage with no success. Glide.with(mContext) .load(pictureUri) // Uri of the picture .transform(new CircleTransform(..)) .into(profileAvatar); This is the error I get: java.lang.Exception: Failed to load model: ‘/storage/emulated/0/DCIM/Camera/IMG_20150831_180900.jpg’ at com.bumptech.glide.request.GenericRequest.onSizeReady(GenericRequest.java:441) at com.bumptech.glide.request.target.ViewTarget$SizeDeterminer.getSize(ViewTarget.java:211) at com.bumptech.glide.request.target.ViewTarget.getSize(ViewTarget.java:100) at com.bumptech.glide.request.GenericRequest.begin(GenericRequest.java:272) at com.bumptech.glide.manager.RequestTracker.resumeRequests(RequestTracker.java:83) at com.bumptech.glide.RequestManager.resumeRequests(RequestManager.java:180) at com.bumptech.glide.RequestManager.onStart(RequestManager.java:203) at com.bumptech.glide.manager.ActivityFragmentLifecycle.onStart(ActivityFragmentLifecycle.java:50) at com.bumptech.glide.manager.SupportRequestManagerFragment.onStart(SupportRequestManagerFragment.java:135) […]

Android textview not supporting line break

I’m creating a custom view programmatically that is displaying text that is parsed from an XML file. The text is long and contains the “/n” character for force line breaks. For some reason, the text view is displaying the /n and there isn’t any line breaks. Here is my code: // get the first section […]

android – how to get the image edge x/y position inside imageview

If i have an ImageView that fills the screen. The ImageView background is set to green color. I place a bitmap in the ImageView, keeping bitmap proportions. A portrait photo in this layout will show green on both left and right side (Phone orientation= portrait). Now, How do i get the left side x/y position […]

ERROR: In <declare-styleable> MenuView, unable to find attribute android:preserveIconSpacing

I had created an app and when tried to run,get an error like this. ERROR: In <declare-styleable> MenuView, unable to find attribute android:preserveIconSpacing Problems and at end of R.java please help me to fix this issue

Android Deep Linking with multiple query parameters

I’m trying to deep link my app and have implemented the following in my AndroidManifest.xml to open the proper activity. <activity android:name=”.ui.activities.MyActivity” android:label=”@string/title_activity” android:screenOrientation=”portrait”> <!– ATTENTION: This intent was auto-generated. Follow instructions at https://g.co/AppIndexing/AndroidStudio to publish your Android app deep links. –> <intent-filter> <action android:name=”android.intent.action.VIEW” /> <category android:name=”android.intent.category.DEFAULT” /> <category android:name=”android.intent.category.BROWSABLE” /> <!– ATTENTION: This […]

Language Level Java 8 (Retrolambda) on AndroidStudio 4+?

So, someone backported Lambdas for Java 8 back to Java 6, and 7. Apparently it also works for Android. The project is called Retrolambda. I wanted to play around with this on AndroidStudio, but it seems in recent version they have removed the ability to set Java 8 as the Language Level (so I don’t […]

Prevent Android WebView caching data

Is it possible to prevent a WebView from caching data in /data/data/???/cache/webViewCache? I’ve set the following on the WebSettings but the cache folder is still used: webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE); webSettings.setAppCacheEnabled(false); I’ve noticed that the cache files are deleted on application exit or when the application goes into the background but I’d prefer for them not to be […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.