• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Adding google maps to my application

allenkb

Lurker
i have been learning to make Android apps and have been making good headway. I decided to try doing a mpping app. I found a tutorial that simply displayed a google map. that is all it done. The tutorial went smooth and I was able to make it work. So now i want to incorporate what i have learned into an app i have been building. This app has several screens(instances) that display depending on menu selection, etc.

So here is my Android manifest..


<?
xmlversion="1.0"encoding="utf-8"?>
<

manifestxmlns:android="http://schemas.android.com/apk/res/android"
package="ken.allen.android.Tower"
android:versionCode="1"
android:versionName="1.0">
<applicationandroid:icon="@drawable/icon"android:label="@string/app_name">
<uses-libraryandroid:name="com.google.android.maps"android:required="true"/>
<activityandroid:name=".Tower"
android:label="@string/app_name">
<intent-filter>
<actionandroid:name="android.intent.action.MAIN"/>
<categoryandroid:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>


<activityandroid:name=".Activity2">
<activityandroid:name=".CreateDataBase"></activity>
<activityandroid:name=".BuildList"></activity>
<activityandroid:name=".datascreen"></activity>
<activityandroid:name=".Mapit"></activity>
</activity>






<


activityandroid:name=".datarecords"></activity>

&#12288;
&#12288;
<


activityandroid:name="BuildList"></activity>

</


application>

<


uses-permissionandroid:name="android.permission.ACCESS_FINE_LOCATION">
<

uses-permissionandroid:name="android.permission.ACCESS_COARSE_LOCATION"/>
<

uses-permissionandroid:name="android.permission.ACCESS_FINE_LOCATION"/>
<

uses-permissionandroid:name="android.permission.ACCESS_LOCATION"/>
<

uses-permissionandroid:name="android.permission.INTERNET"/>
<

uses-permissionandroid:name="android.permission.ACCESS_GPS"/></uses-permission>

&#12288;
&#12288;
</manifest>


I select my new intent froma menu item as follows

case


3:
// String v_band = spin2.getSelectedItem().toString();
Intent myIntent1 =


new Intent(Tower.this, Mapit.class);
// myIntent1.putExtra("BAND", v_band);
Tower.


this.startActivity(myIntent1);
returntrue;

My new Intent or mapper.xml contains the following.

<?


xmlversion="1.0"encoding="utf-8"?>
<

RelativeLayout
xmlns:android


="http://schemas.android.com/apk/res/android"
android:orientation


="vertical"
android:layout_width


="fill_parent"
android:layout_height


="fill_parent"
>
<


com.google.android.maps.MapView
android:id="@+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="0EVD3Q_WMbtaa_vIjrPoaiN7Egbs8amSorNF-qw"
/>

</
RelativeLayout>



and the java for the mapper.xml is as follows

package ken.allen.android.Tower;

import android.app.Activity;
import android.os.Bundle;
import com.google.android.maps.MapActivity;

public class Mapit extends MapActivity{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.mapper);
}
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}


For some reason this will Force close when this intent is selected in the menu. I duplicated the tutorial worked for me int he beginning. Right now i would be happy just to dispplay the google map when the menu itme is slected. I can work on the rest after.





 
Back
Top Bottom