Working with Google Map MyLocation

1. Issue. how to delete markers ?

Click on marker shows title and geolocation. Let’s say long click on a map and we’ll check for marker near that (within .02 for example). To delete marker I have to call Marker.clear() or remove(). I don’t have marker object… I can remove all markers and draw remaining ones.


this has good complete code

I found and implemented this code: drag marker to a trash icon. Used this for starting point;



2. Issue. Long click starts drag action. However drag Start message has coordinates that are off from original position. I can’t use these coordinates to snap the marker back in place.
After reading I think I have to maintain HashMap of markers with a key that is key to database entries.

3. Other useful sources:

Bunch of sample code but not clear what for and what’s quality, have to download and see.


4. Marker lifecycle collection of sources.

How to instantiate map after rotation etc


5. Overlays. Not sure if I have to use Overlays. Seems it’s V1. But I will collect sources

6. Google sources

7. Info Window. If I change content of info window during drag- nothing happens.
This might help. InfoWindowAdapter.
Next, this is about creating multiple custom infoWindow . Lot of code.
Next, onMarkerClick show/hide window issues and animaring the camera
Minor next: – post answer to return true if I can

8. Map extensions

9. Draggable marker example

10: cool code to animate the marker from one geopoint to another:

Getting started with Google Map APIs

Google Maps for Android

Google Maps for Android (Photo credit: Wikipedia)

New project has to do with placing markers on a map and managing these markers (add, retrieve, view, update, delete).

I never did a project with maps. So let’s get started.  Starting point is google documentation.

1. Looks like I have to generate a key  that will be used during dev process. And later generate release key.

2. Followed instructions and received a 40 char key for using google map APIs v2 and geolocation API.  This involved creating a project and reading licenses.

3. Next fundamental step is to read about MAP on google play services

My goal is to find a working running example that I can use as a starting point.

4. Before doing step 3 I have to do step  4. Setup google play services sdk

5. Downloaded sample project from google play API.  Running this project requires to put in my own key. 30 min after this still doesn;t run. Research.

HERE: in case of error with the key i have to uninstall and clear data from the device.  Learned hard (semi) way.

Ok, sample project is working. One glitch remains: My location is never initialized. I have to tap my location icon to make it to go where I am otherwise I am in (0, 0).



Using Home icon as a navigation back button

I’d like to enable clicking on the home icon. This click would take user one screen back. Maybe it should take user back to front screen.  For now, act as a back button.

Nothing more simple!

1. @Override

public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(, menu);
// enable home icon to be a button
ActionBar actionBar = getActionBar();
return true;




public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {

return true;



Simple. Little arrow to the left is drawn next to the icon. I didn’t have to create an image.

TravelMeds app is released!

We put the app into Google Play, it’s live!!

Our project team at Moodro and at Galanda are very excited to present TravelMeds app.

Short ad:

Travel safely and protect your loved ones. Make sure your family’s allergy information, medication information and medical conditions are with you on your smart phone when you travel to foreign countries and can be translated to foreign languages.


Dear Followers and Readers. I’d appreciate hearing from you. Go ahead, download the app. Give the feedback for the UI and for functionality. We believe the app is high quality and well crafted. To find, enter “TravelMeds” in the Google Play store search bar.



We strive for the 5 star rating. If any issues identified – I would be glad to work on it and write about overcoming these problems.

App is advertisement supported. Explore the ads, you might find an interesting product or a deal.

Take care!

–Galina a.k.a. galanda

Smartphone Configuration for Social Media Mark...

Smartphone Configuration for Social Media Marketing in Frederick MD (Photo credit: Frederick Md Publicity)

About calling finish() in activity

Now, my new activity layout file is constructed with using “include” for a sections of a screen that I expect to use at least twice.

This is a details activity screen, I expect user to enter couple fields and I save data in content provider. Simple, happens in many apps. But it’s a first one for me.

Problem: Save button is pressed, I call save() and I call finish(), expecting activity to be switched to a previous one. Data apparently is saved correctly but no, instead of exiting this activity some other stuff is happening. What??

Let’s read about it.

1. Lean every day. : ) Any statement written after finish() will get executed. Interesting,  but I don’t have any other statements after finish (just break, return etc).

2. OnDestroy() is a last call that activity will see before being destroyed.  I guess it’s a good place to put code for back button pressed if you don’t feel like writing onBackPressed() .

3. android:noHistory = “true”. Can play with that.

"Ruby Hilton, Lynn Gardens, Kingsport, Te...

“Ruby Hilton, Lynn Gardens, Kingsport, Tennessee. Another view of the super-finish operation calling for the spraying… – NARA – 532749 (Photo credit: Wikipedia)

I see, any code that comes after finish() is executed.

Oh, that’s right! found additional code.  Finish() is not necessarily the end, more “activity” happens after the finish. Makes a joke.

Take care!



ListView: onListItemClick and On Touch

My app starts with an empty list and user has to click “Add” to create a first item.  First time users can’t figure out the Add (plus sign) button and they smack the finger on a blank screen, maybe something will come up to guide. Ok that’s a task: when user touches empty area on a list we want to treat it as Add button was clicked. 

My activity already implements onListItemClick and it’s void call

There is onTouch which is boolean. Let’s try

public boolean onTouch(View arg0, MotionEvent event) {

Log.d(TAG, “onTouch list”);

boolean ret=false;
return ret;

Simple enough though this is called 3 times when I touch once. 

Reading. I see, there are 3 event. I’ll handle the Action Up.

case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_MOVE:
// code
case MotionEvent.ACTION_UP:
if (lView.getAdapter().getCount()<=0){

This sounds simple but I spent some time figuring what the condition is for me to return true and when to return false, so that onListItemClick is still called. Ended up limiting this feature to a condition when list has no items. 

Good enough. 

Take care.

Going to read release procedures next. 

Please Don't Touch

Please Don’t Touch (Photo credit: Wikipedia)



In App Advertisements

Google has AdSense and AdWords

There is MoPub that people use and talk about. Only experience can tell (or do You?) what is better.

I had code sample for MoPub, let’s try it out.

1. MoPub Integration part1

This crashes at runtime…

Though I used MoPub successfully earlier (in sprint). Spent 2-3 and then switched to AdMob.

I have low tolerance to now this works now it doesn’t game.

2. AdMob by google. Easy to integrate, seem to be working well so far.



Send mail from the app

We want to implement Contact Us button. 

User will be able to send an e-mail to my designated mailbox. [I might check it :)]


Intent i = new Intent(Intent.ACTION_SEND);
i.putExtra(Intent.EXTRA_EMAIL  , new String[]{""});
i.putExtra(Intent.EXTRA_SUBJECT, "subject of email");
i.putExtra(Intent.EXTRA_TEXT   , "body of email");
try {
    startActivity(Intent.createChooser(i, "Send mail..."));
} catch (android.content.ActivityNotFoundException ex) {
    Toast.makeText(MyActivity.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show();

But this requires e-mail client (?) and doesnt have sender address. How would I respond then?

Intent intent = new Intent(Intent.ACTION_SENDTO); // it's not ACTION_SEND intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, "Subject of email"); intent.putExtra(Intent.EXTRA_TEXT, "Body of email"); intent.setData(Uri.parse("")); // or just "mailto:" for blank intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // this will make such that when user returns to your app, your app is displayed, instead of the email app. startActivity(intent);
more code examples.
One of these should work I hope.


Preferences (Settings) are used for storing values between sessions. These values could be save in a database but when values are just a few it can ge in preferences

1. Create

private void saveMyPreferences(String key, String value) {

SharedPreferences preferences = getApplicationContext().getSharedPreferences(A_PREFERENCES_NAME, 0);
SharedPreferences.Editor editor = preferences.edit();
editor.putString(key, value);
return ;

2. retrieve
private String getMyPreferences(String key) {
SharedPreferences preferences = getPreferences(A_PREFERENCES_NAME);

String defaultValue=””;

English: An Inglehart-Welzel Cultural Map of t...

English: An Inglehart-Welzel Cultural Map of the World: World Secular-Rational and Self Expression Values as a map of world cultures based on World Values Survey data. Svenska: En Världskulturkarta av Inglehart-Welzel typ. (Photo credit: Wikipedia)

return preferences.getString(key,defaultValue);