Skip to content

Tag: android

Set custom view for my location button in google map

I am using the Google Maps Android API v2, and I need a way to change the view (icon, color, etc.) of “My Location” button. now i can change the position of that but i need a way to do a full customization. can somebody help me please? Answer The location button is actually an ImageView. You shoul…

How to request Location Permission at runtime

In the manifest file I added permissions coarse and fine, and when I run on device with Android 6, nothing happens! I try everything but no way to get location updates… What am I doing wrong? Answer You need to actually request the Location permission at runtime (notice the comments in your code stating…

What is a StringIndexOutOfBoundsException? How can I fix it?

This is my code: It’s the default given from the android documentation. I only changed the url. This is my error message: java.lang.StringIndexOutOfBoundsException: length=28; regionStart=1; regionLength=499 at java.lang.String.substring(String.java:1931) at com.example.my.app.MainActivity$2.onResponse(…

addView adds the view but it’s not showing it

I know this has already been asked, but I tried everything and I couldn’t solve my problem. When I create the views programmatically, they are definitely added. I checked in the debugger and everything is in it’s place, even the parent view gets bigger in height because they are using space. But I…

adb logcat returns “Logcat read failure”

After noticing that Logcat messages were not showing up in Android Studio, I tried every solution out there, and nothing worked. I eventually tried the command adb devices and sure enough my device was there, but as soon as I tried adb logcat it returned “logcat read failure”. Developer settings a…