Android app development: click a ListView item programmatically

I’m going to share a code snippet that you may use to programmatically click a ListView item in your Android app. This will not simply highlight the desired ListView item, but also trigger the onItemClick listener. This code is what I placed in a Fragment’s onLoadFinished() method:

Simply replace the default_position value with the […]

Read More

Android app codes for Google Maps with clustering

I prepared Android app codes with Google Maps and clustering feature. Feel free to use these as basis for your new projects. They are on GitHub: [1] Default Map Markers: catzie/SimpleAndroidMapClustering   [2] Custom Map Markers: catzie/Simple-Android-Map-Clustering-with-Custom-Markers   I simply took the necessary classes and res files from Android Maps Utility demo, and then placed […]

Read More

Android Maps: Get current location coordinates with Google API Client Builder

To get your current location via Google Map in an Android app, this was how we do it:

Stop. Don’t use that! The method GoogleMap.getMyLocation() is deprecated. Instead, we need to use FusedLocationApi and the callback onLocationChanged(). Here’s an example code that works for me ( consider copying the contents of onResume() into onStart() […]

Read More

Android Development: Permission denied when running ./gradlew in Mac

I’m using a Mac at the moment to work on my Android app projects. For some reason I need to run ./gradlew in the terminal, but I was getting this error: -bash: ./gradlew: Permission denied To fix this, what I did was run the following commands:

After those commands, my Mac downloaded numerous files […]

Read More

Android: Switch into another activity

To switch into another activity, the method we use is startActivity(). This is what starts another Android activity:

Replace NameOfActivity with the name of any activity you’d like to switch into.

Read More