2012-11-27 3 views
5

버튼을 누르면 버튼 중 하나에 PDF 파일이 표시되는 응용 프로그램을 개발 중입니다.안드로이드에서 PDF 파일보기

이 PDF 파일을 표시하는 가장 좋은 방법은 무엇입니까?

SD 카드에 복사 한 다음 기기에 이미 설치된 adobe를 사용하여 인 텐트를 통해 볼 수 있습니다.

그러나 모든 장치에 adobe가 설치되어 있다고 가정 할 수 없으므로 대체 방법은 무엇입니까?

이미지로 변환하여이 방법으로 표시 할 수 있습니까?

+0

나는 유효한 PDF 리더 앱이 없다면 사용자를 시장에 데려다 줄 대화 상자를 보여줄 것입니다. – FoamyGuy

답변

1

나는 당신이 pdf 변환을 너 자신보고 싶다고 의심한다. 안드로이드 개발자에서 촬영

/** 
* Indicates whether the specified action can be used as an intent. This 
* method queries the package manager for installed packages that can 
* respond to an intent with the specified action. If no suitable package is 
* found, this method returns false. 
* 
* @param context The application's environment. 
* @param action The Intent action to check for availability. 
* 
* @return True if an Intent with the specified action can be sent and 
*   responded to, false otherwise. 
*/ 
public static boolean isIntentAvailable(Context context, String action) { 
    final PackageManager packageManager = context.getPackageManager(); 
    final Intent intent = new Intent(action); 
    List<ResolveInfo> list = 
      packageManager.queryIntentActivities(intent, 
        PackageManager.MATCH_DEFAULT_ONLY); 
    return list.size() > 0; 
} 

here 블로그 :이 같은 텐트를 처리하는 응용 프로그램이 있는지 확인할 수 있습니다.

pdfs를 처리 할 응용 프로그램이 없다면 Play 스토어로 보낼 수있는 대화 상자를 표시하십시오. 이 같은 Play 스토어를 출시 할 의도를 만들 수 있습니다

try { 
    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details? id="+appName))); 
} catch (android.content.ActivityNotFoundException anfe) { 
    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id="+appName))); 
} 

this 유래 링크에서 촬영.

관련 문제