الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

مشكلة ف عرض google map

بدأه Ahmed Abd El-Rasoul في 20 أغسطس 2011 · 2 رد · 956 مشاهدة · في Android
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

ف مشكلة بعمل Run للمشروع بيقولى

post-243732-079608300 1313841346_thumb.g

main.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
	android:id="@+id/mainlayout"
	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:clickable="true"
    	android:apiKey="94:1E:43:49:87:73:BB:E6:A6:88:D7:20:F1:8E:B5:98"
	/>

</RelativeLayout>

ملف AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  	package="com.test"
  	android:versionCode="1"
  	android:versionName="1.0">
	<uses-sdk android:minSdkVersion="8" />

	<application android:icon="@drawable/icon" android:label="@string/app_name">
    	<activity android:name=".ShowMap"
              	android:label="@string/app_name">
        	<intent-filter>
            	<action android:name="android.intent.action.MAIN" />
            	<category android:name="android.intent.category.LAUNCHER" />
        	</intent-filter>
    	</activity>
    	<uses-library android:name="com.google.android.maps" android:required="true"></uses-library>

	</application>
</manifest>

كلاس الجافا ShowMap

package com.test;

import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.widget.RelativeLayout;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;

public class ShowMap extends MapActivity {

	private MapController mapController;
	private MapView mapView;
	private LocationManager locationManager;

	public void onCreate(Bundle bundle) {
		super.onCreate(bundle);
		setContentView(R.layout.main); // bind the layout to the activity

		// create a map view
		RelativeLayout linearLayout = (RelativeLayout) findViewById(R.id.mainlayout);
		mapView = (MapView) findViewById(R.id.mapview);
		mapView.setBuiltInZoomControls(true);
		mapView.setStreetView(true);
		mapController = mapView.getController();
		mapController.setZoom(14); // Zoon 1 is world view
		locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
		locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0,
				0, new GeoUpdateHandler());
	}

	@Override
	protected boolean isRouteDisplayed() {
		return false;
	}

	public class GeoUpdateHandler implements LocationListener {

		public void onLocationChanged(Location location) {
			int lat = (int) (location.getLatitude() * 1E6);
			int lng = (int) (location.getLongitude() * 1E6);
			GeoPoint point = new GeoPoint(lat, lng);
			mapController.animateTo(point); //	mapController.setCenter(point);

		}

		public void onProviderDisabled(String arg0) {
			// TODO Auto-generated method stub

		}

		public void onProviderEnabled(String arg0) {
			// TODO Auto-generated method stub

		}

		public void onStatusChanged(String arg0, int arg1, Bundle arg2) {
			// TODO Auto-generated method stub

		}

	/*	@Override
		public void onLocationChanged(Location location) {
			int lat = (int) (location.getLatitude() * 1E6);
			int lng = (int) (location.getLongitude() * 1E6);
			GeoPoint point = new GeoPoint(lat, lng);
			mapController.animateTo(point); //	mapController.setCenter(point);
		}

		@Override
		public void onProviderDisabled(String provider) {
		}

		@Override
		public void onProviderEnabled(String provider) {
		}

		@Override
		public void onStatusChanged(String provider, int status, Bundle extras) {
		}  */
	}
}

التطبيق اهو TestMap.rar

المرفقات
ARAB1.GIF

تم تعديل هذه المشاركة بواسطة Ahmed Abd El-Rasoul في 20 أغسطس 2011 في 15:18

سأل الممكن المستحيل : أين تقيم ؟ فأجابه في أحلام العاجز

----------------------------------------

نمضى النصف الأول من حياتنا بحثاً عن المال والنجاح والشهرة ونمضى

النصف الثانى منها بحثاً عن الأطباء

-----------------------------------------

شخصٌ يرى ذا الكون وهو جالسٌ ويجوب هذي الأرض بين الدول

#2

طبعا انت عارف اخوك ملوش فالاندرويد لسه جديد زيك بس انت دخلت اوووى :)

المهم

لازم تحط permission

فى الملف بتاع AndroidManifest.xml

<uses-library android:name="com.google.android.maps" />
<uses-permission android:name="android.permission.INTERNET" />

شوف اللينك دا كمان

http://developer.and...lo-mapview.html

تم تعديل هذه المشاركة بواسطة Mahmoud Kelany في 20 أغسطس 2011 في 15:19

Software Developer
Mahmoudkelany.com


 

#3
Mahmoud Kelany كتب:

طبعا انت عارف اخوك ملوش فالاندرويد لسه جديد زيك بس انت دخلت اوووى :)

المهم

لازم تحط permission

فى الملف بتاع AndroidManifest.xml

<uses-library android:name="com.google.android.maps" />
<uses-permission android:name="android.permission.INTERNET" />

شوف اللينك دا كمان

http://developer.and...lo-mapview.html

ولا دخلت ولا حاجة بس شكل الاندرويد ده رووووعة

ع العموم لف شكر ع اللينك يا حوده هاشوفه وربنا يسهل

سأل الممكن المستحيل : أين تقيم ؟ فأجابه في أحلام العاجز

----------------------------------------

نمضى النصف الأول من حياتنا بحثاً عن المال والنجاح والشهرة ونمضى

النصف الثانى منها بحثاً عن الأطباء

-----------------------------------------

شخصٌ يرى ذا الكون وهو جالسٌ ويجوب هذي الأرض بين الدول

مواضيع مشابهة