package com.test;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class test extends Activity {
private EditText lat;
private EditText lon;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
Button btn = (Button)findViewById(R.id.map);
lat = (EditText)findViewById(R.id.lat);
lon = (EditText)findViewById(R.id.lon);
btn.setOnClickListener(new View.OnClickListener()
{
public void onClick(View view)
{
String _lat = lat.getText().toString();
String _lon = lon.getText().toString();
Uri uri = Uri.parse("geo:" + _lat + "," + _lon);
startActivity(new Intent(Intent.ACTION_VIEW,uri));
}
});
}
}
--------------------
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:stretchColumns="1,2">
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="2dip"
android:paddingRight="4dip"
android:text="위도 경도:"/>
<EditText
android:id="@+id/lat"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:cursorVisible="true"
android:editable="true"
android:singleLine="true"
android:layout_weight="1"/>
<EditText
android:id="@+id/lon"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:cursorVisible="true"
android:editable="true"
android:singleLine="true"
android:layout_weight="1"/>
</TableRow>
</TableLayout>
<Button
android:id="@+id/map"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="지도 보기!"
/>
</LinearLayout>
지금 알짜만 안드로이드 책보면서 공부하고있는데... 책 오픈소스인데 더 추가하고싶은데..
위도 경도 입력하면 위치는 찾아주는데 위치 표시하는것 어케하는지 궁금합니다 ;;
자세하게 설명 부탁드립니다;
그럼 MapActivity 부분을 이용해서 MapView를 띄우는거랑
거기에 그려질 마크 표시니까 Overlay 부분을 공부하심 될꺼예요 ㅎㅎ
위도와 경도를 가진 데이터가
Location
GeoPoint
lat lng
이렇게 있으니 이걸 잘 써보시고 그 중에 화면에 표시되는 부분은 지도가 아니고 핸드폰이니까
Point를 통해서 지도의 좌표와 화면의 x / y 값을 가지고서 그림을 위치시키시면 되요