I got a kind of working home made gps which is working. Now I'm creating a new app again with google maps inside.
In my main I create
startActivity(new Intent(this, GpsLogger.class));
this create my intent which goes ok. During th开发者_运维知识库e onCreate of the GpsLogger I do a setContentView(R.layout.drawer);
there it crashes... but when I comment the google maps part in the xml... it doesn't crash. But I don't have google aps inside ofcourse...
<code><?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/layout_main"
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_gravity="center_horizontal">
<ViewFlipper android:id="@+id/details"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:layout_width="fill_parent"
android:orientation="vertical" android:layout_height="fill_parent">
<!--<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_gravity="top|right">
</TableLayout> -->
<TextView android:layout_gravity="left" android:layout_width="fill_parent" android:id="@+id/lblCircuit" android:layout_height="wrap_content" android:text="Circuit"></TextView>
<EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:text="EditText" android:id="@+id/txtCircuit"></EditText>
<TextView android:text="TextView" android:layout_width="fill_parent" android:layout_gravity="left" android:layout_height="wrap_content" android:id="@+id/lblDriver"></TextView>
<EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:text="EditText" android:id="@+id/txtDriver"></EditText>
<Button android:layout_width="120dip" android:text="@string/startLog" android:layout_height="57dip" android:layout_gravity="bottom|center_horizontal" android:id="@+id/btnLog"></Button>
<Button android:layout_width="120dip" android:text="@string/back" android:layout_height="57dip" android:layout_gravity="bottom|center_horizontal" android:id="@+id/btnBack"></Button>
<TextView android:layout_width="fill_parent" android:layout_gravity="left" android:id="@+id/txtStatus" android:layout_height="fill_parent"></TextView>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:orientation="vertical" android:layout_height="match_parent">
<TextView android:layout_gravity="left|center_vertical" android:layout_width="fill_parent" android:id="@+id/lblView2" android:layout_height="wrap_content" android:text="hier komt een 2D schets van het circuit in realtime"></TextView>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:orientation="vertical" android:layout_height="match_parent">
<TextView android:layout_gravity="left|center_vertical" android:layout_width="fill_parent" android:id="@+id/lblView3" android:layout_height="wrap_content" android:text="Hier moet google apps zijn data weergeven"></TextView>
<!-- <com.google.android.maps.MapView
android:id="@+id/mapview1"
android:layout_width="300dip"
android:layout_height="300dip"
android:layout_gravity="center_horizontal|center_vertical"
android:enabled="true"
android:clickable="true"
android:apiKey="0ImY2ZaoaarHlQFr4Xe0NuqRFRPvqrBOAtvX1ng"/> -->
</LinearLayout>
</ViewFlipper>
</LinearLayout>
</code>
What can be the problem ?
got the
<uses-library android:name="com.google.android.maps" />
in the manifest I'm running it on an avd with google maps 2.2 + addon
and my other app works fine but I cannot find differences in the use of google maps...
hi just check whether you have include this line inside your application tag in the androidmanifest xml
<uses-library android:name="com.google.android.maps" />
also your activity should extend MapActivity instead of default Activity class...
Hope this solves your problem... If Not post your logcat...
精彩评论