我想寫一個應用程序,你可以輸入一個地址,然後你重定向到谷歌地圖。 (我認爲這被稱爲隱含意圖)安卓內容activitynotfoundexception沒有找到處理意圖的活動 - 當試圖去url
- 我創建了一個意圖,啓動主要活動,這是我的應用程序中唯一的活動。 主要活動由一些文本,一個編輯區和一個按鈕組成。
的AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.where_do_you_live"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main" >
<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" />
</manifest>
這是該按鈕的代碼:
public void Button1Click(View view)
{
try
{
addressField=(EditText)findViewById(R.id.address);
String address=addressField.getText().toString();
address=address.replace(' ','+');
Intent geoIntent=new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("geo:0,0?q=" + address));
startActivity(geoIntent);
}
catch(Exception e)
{
TextView tv=(TextView)findViewById(R.id.textView1);
tv.setText(e.toString());
//finding stuff
}
}
您確定您的谷歌地圖已經安裝在您的設備上? – Erol 2012-07-17 16:49:05
該設備是一個模擬器,所以我必須? – Ken 2012-07-17 17:27:44