Logcat or Stack trace of the error would help detect the problem easily instead of someone going through the whole code.
On Mon, Nov 8, 2010 at 12:57 PM, khushi <[email protected]> wrote: > > i have created a marker demowhich the marker on the map for which i > have used pushpin.gif image. > i have added the pushpin.gif in the drawable folders whish is inside > the resource folder. > when i run it on the emulator the force close errror appears i have > also made sure that i add > <uses-library android:name="com.google.android.maps"/> > as a child of application which was given as an earlier solution by a > friend on the discussion group.still the error persists. i guess the > code is fine .kindly guide thank u > > package com.android.khushi.Googlemaps > > import java.util.List; > import com.google.android.maps.GeoPoint; > import com.google.android.maps.MapActivity; > import com.google.android.maps.MapController; > import com.google.android.maps.MapView; > import com.google.android.maps.Overlay; > import com.google.android.maps.MapView.LayoutParams; > > import android.graphics.Bitmap; > import android.graphics.BitmapFactory; > import android.graphics.Canvas; > import android.graphics.Point; > import android.os.Bundle; > import android.view.View; > import android.widget.LinearLayout; > > public class MapsActivity extends MapActivity > { > MapView mapView; > MapController mc; > GeoPoint p; > > class MapOverlay extends com.google.android.maps.Overlay > { > @Override > public boolean draw(Canvas canvas, MapView mapView, > boolean shadow, long when) > { > super.draw(canvas, mapView, shadow); > > //---translate the GeoPoint to screen pixels--- > Point screenPts = new Point(); > mapView.getProjection().toPixels(p, screenPts); > > //---add the marker--- > Bitmap bmp = BitmapFactory.decodeResource( > getResources(), R.drawable.pushpin); > canvas.drawBitmap(bmp, screenPts.x, screenPts.y-50, > null); > return true; > } > } > > /** Called when the activity is first created. */ > > > @Override > protected boolean isRouteDisplayed() { > // TODO Auto-generated method stub > return false; > } > @Override > public void onCreate(Bundle savedInstanceState) > { > super.onCreate(savedInstanceState); > setContentView(R.layout.main); > > mc.animateTo(p); > mc.setZoom(17); > > //---Add a location marker--- > MapOverlay mapOverlay = new MapOverlay(); > List<Overlay> listOfOverlays = mapView.getOverlays(); > listOfOverlays.clear(); > listOfOverlays.add(mapOverlay); > > mapView.invalidate(); > } > } > > _________________________________________________________________________________________ > > main.xml > > > <?xml version="1.0" encoding="utf-8"?> > > <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/ > android" > 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="my api key" > /> > > <LinearLayout android:id="@+id/zoom" > android:layout_width="wrap_content" > android:layout_height="wrap_content" > android:layout_alignParentBottom="true" > android:layout_centerHorizontal="true" > /> > > <ImageView xmlns:android="http://schemas.android.com/apk/res/android" > android:id="@+id/icon" > android:layout_width="fill_parent" > android:layout_height="fill_parent" > android:adjustViewBounds="true" > android:src="@drawable/pushpin" > /> > > </RelativeLayout> > > _____________________________________________________________________________________ > Android.manifest > > <?xml version="1.0" encoding="utf-8"?> > <manifest xmlns:android="http://schemas.android.com/apk/res/android" > package="package com.android.khushi.Googlemaps" > > android:versionCode="1" > android:versionName="1.0.0"> > <application android:icon="@drawable/pushpin" > android:label="@string/app_name"> > > <uses-library android:name="com.google.android.maps"/> > > <activity android:name=".MapsActivity" android:label="@string/ > app_name"> > <intent-filter> > <action android:name="android.intent.action.MAIN" /> > <category > android:name="android.intent.category.LAUNCHER" /> > </intent-filter> > </activity> > > </application> > > <uses-permission android:name="android.permission.INTERNET" /> > <uses-permission > android:name="android.permission.ACCESS_COARSE_LOCATION"></uses- > permission> > <uses-permission > android:name="android.permission.ACCESS_FINE_LOCATION"></uses- > permission> > </manifest> > > _______________________________________________________________________________ > > i have added the pushpin.gif in the drawable folders whish is insid > the resource folder. > when i run it on the emulator the force close errror appears i have > also made sure that i add > <uses-library android:name="com.google.android.maps"/> > as a child of application which was given as an earlier solution by a > friend on the discussion group.still the error persists.kindly guide > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- Kumar Bibek http://techdroid.kbeanie.com http://www.kbeanie.com -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

