2011-08-03 12 views
0

내가 의도를 사용하여 사용자에게 내 APK 파일을 표시하려면, 여기에 코드입니다 :어떻게 파일을 sdcard에 표시 할 수 있습니까?

SDCardRoot = Environment.getExternalStorageDirectory(); 
File file = new File(SDCardRoot,fileName); 
if (file.exists()) { 

Uri path = Uri.fromFile(file); 
Intent intent = new  
Intent(Intent.ACTION_VIEW,path);         
startActivity(intent); 

하지만 난 그 사용자가 설치할 수 있도록 APK 파일을 시작하려는 나에게 ActivityNotFoundException을주고있다.

답변

0

시험해보세요.

Uri path = Uri.fromFile(file); 
Intent intent = new  
Intent(Intent.ACTION_VIEW,path); 
intent.setDataAndType(path, "application/vnd.android.package-archive");      
startActivity(intent); 
관련 문제