2013-05-27 1 views
2
public void onContacts(View v) 
{ 
    Intent i=new Intent(Intent.ACTION_VIEW, ContactsContract.Contacts.CONTENT_URI); 
    startActivity(i); 
} 

public void onBrowse(View v) 
{ 

    String s1= et1.getText().toString(); 
    Intent i= new Intent(Intent.ACTION_VIEW, Uri.parse(s1)); 
    startActivity(i); 

} 

public void onSearch(View v) 
{ 

    String s1= et2.getText().toString(); 
    Intent i=new Intent(Intent.ACTION_WEB_SEARCH); 
    i.putExtra(SearchManager.QUERY, s1); 
    startActivity(i); 
} 

public void onMap(View v) 
{ 

    String s1= et3.getText().toString(); 
    Intent i=new Intent(Intent.ACTION_VIEW,Uri.parse("geo:0,0?q="+s1)); 
    startActivity(i); 
} 

이들 각각은 각각의 버튼에 연결된 몇 가지 방법이 버튼 중 하나를 클릭에 그것이 어떤 editext 부착되지 않은 onContacts() 방법 제외한 ActivityNotFoundException를 도시하는 ...안드로이드 : ActivityNotFoundException

로그 캣 결과 :

05-27 23:18:42.984: E/AndroidRuntime(714): Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=google } 

의 AndroidManifest.xml

이 도울 수 있다면

691,363,210

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

<uses-sdk android:minSdkVersion="10" /> 
<uses-permission android:name="android.permission.INTERNET"/> 
<uses-permission android:name="android.permission.INSTALL_LOCATION_PROVIDER" /> 
<uses-permission android:name="android.permission.CALL_PHONE"/> 

<application 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" > 
    <activity 
     android:label="@string/app_name" 
     android:name=".AllIntentActivity" > 
     <intent-filter > 
      <action android:name="android.intent.action.MAIN" /> 
      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 
</application> 
내가 방법에서 제공되는 필요한 자원, 즉 어떤 문자열이 글고 치기 그가에서 검색되지 않습니다 동일한 기능을 가진 프로그램을 실행 한 .. 참조 itshelf

사람에 대한

소스 코드 말하고 난에 대한

public void onContents(View v) 
{ 
    Intent i=new Intent(Intent.ACTION_VIEW,ContactsContract.Contacts.CONTENT_URI); 
    startActivity(i); 
} 

public void onBrowser(View v) 
{ 
    Intent i= new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com")); 
    startActivity(i); 
} 

public void onSearch(View v) 
{ 
    Intent i=new Intent(Intent.ACTION_WEB_SEARCH); 

    i.putExtra(SearchManager.QUERY, "tapu"); 
    startActivity(i);  
} 

public void onMap(View v) 
{ 
    Intent i=new Intent(Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=hyderabad")); 
    startActivity(i); 
} 

public void onCall(View v) 
{ 
    Intent i=new Intent(Intent.ACTION_CALL,Uri.parse("tel:9776215312")); 
    startActivity(i); 
} 
+0

에 당신이 당신의 글고을 통해 올바른 URI를 전달 하시겠습니까? – eternay

답변

2

나는 당신의 문제가 있는지 확인하려면 Intent.ACTION_VIEW 및 Intent.ACTION_WEB_SEARCH 액션을 처리하기위한 활동이 없다고 생각 당신이 전에를 확인할 수 있습니다 귀하의 텐트를 처리하기위한 활동이 :

PackageManager packageManager = getPackageManager(); 
List<ResolveInfo> activities = packageManager.queryIntentActivities(intent, 0); 
boolean isIntentSafe = activities.size() > 0; 

는 경우이 시도하기 전에, 순간하여 텐트를 처리하기위한 활동이 없다는 것을 의미 0 목록 활동의 수 활동 활동을 시작하려면 먼저이 항목을 확인해야합니다.

EDIT : 우리가 알고있는 것처럼 그 행동은 안드로이드 장치 (지도 및 웹 브라우저)에서 공통적으로 발생하므로, 수행하려는 URI가 올바른지 확인해야합니다.

+0

콘텐츠를 편집했습니다 – ceanan007

+0

좋아, 실제 안드로이드 장치 (갤럭시 탭)에서 편집하여 제공하는 코드를 테스트하고 'onCall'메서드 (wi-fi 타블렛)를 제외한 모든 코드를 테스트했습니다. , 그래서 당신은 코드, 에뮬레이터 또는 실제 장치를 실행하고 있습니까? EditText에서 파싱 한 URI 문자열이나 유효한 URI를 파싱 한 후 URI 문자열이 유효한 URI인지 확인하십시오. – JosephChilberry

+0

예, 에뮬레이터가 아닌 전화로 작업하고 있습니다. 나는 그것을 이전에 시도하지 않았다. ... – ceanan007

1

당신의 의도 URI가 잘못되었습니다. 또는 TextView의 내용이 예상되는 검색 대화 상자를 여는 방식으로 구성되지 않았습니다. 입력, 예를 들어보십시오 : 당신의 텍스트로

google.com/search?q=blah 

당신의 TextView

관련 문제