Tuesday 23 September 2008

Displaying the Copyright Information for Google Maps

A condition of using the Google Maps API in Android is the display of the Copyright notice as it is defined in the terms and conditions.
I have decided just to add another simple Activity that will just display the mandated string. This is a very simple Activity, which just uses a TextView and looks like this:

import android.app.Activity;
import android.os.Bundle;

public class CopyrightInfo extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.copyrightinfo);
}
}
The view is defined via XML in my layout/copyrightinfo.xml declaration:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:padding="20dip"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/copyrightinfo_fulltext"/>

</LinearLayout>


I have decided to bypass the Activity matching mechanisms for Intents here and when it comes to launching the CopyrightInfo Activity, I have just hard-coded the class into my main Activity:


ComponentName comp = new ComponentName(this.getPackageName(),CopyrightInfo.class.getName());
startActivity(new Intent().setComponent(comp));


The whole shebang just looks like this now:


(By the way, does the ScreenCapture button on DDMS work for anyone? It seems a bit of functionality that is simply broken)

That was an easy lesson, but it is preparing the way for more displays from the GPS.

No comments: