0
現在Androidスタジオで働いています。以下は私のJavaファイルのコードですが、これまではコード内で指定した入力に基づいて位置を見つけることができました。私は代わりに2つの別々の編集テキストの場所を持つことができます。ここで私は経度と緯度を入力し、ボタンを押して場所を見つけることができます。ユーザーが入力した経度と緯度に基づいて場所を検索するにはどうすればよいですか?
import android.app.Activity;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import org.osmdroid.views.MapView;
import org.osmdroid.util.GeoPoint;
import org.osmdroid.config.Configuration;
public class HelloMap extends Activity
{
MapView mv;
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_hello_map);
Configuration.getInstance().load
(this, PreferenceManager.getDefaultSharedPreferences(this));
mv = (MapView)findViewById(R.id.map1);
mv.setBuiltInZoomControls(true);
mv.getController().setZoom(14);
mv.getController().setCenter(new GeoPoint(51.05,-0.72));
}}
私は自分のアクティビティをメインに含めています。
<?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"
>
<org.osmdroid.views.MapView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:enabled="true"
android:clickable="true"
android:id="@+id/map1"
tilesource="Mapnik"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:id="@+id/latet"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:id="@+id/longet"
android:layout_below="@id/latet"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/lattv"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/longtv"
/>
</RelativeLayout>
私は実際にこれを実行するかどうかはわかりませんので、任意の助けいただければ幸いです:)
あなたがする必要がどのような