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.

https://developers.google.com/maps/documentation/android/start#getting_the_google_maps_android_api_v2

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.

https://code.google.com/apis/console/?noredirect&pli=1#project:940879255152:access

3. Next fundamental step is to read about MAP on google play services  http://developer.android.com/google/play-services/maps.html

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

http://developer.android.com/google/play-services/setup.html

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(R.menu.menu_drill, menu);
// enable home icon to be a button
ActionBar actionBar = getActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
return true;

 

2.

@Override

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

case android.R.id.home:
onBackPressed();
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.

 

TravelMeds512

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!