2015-01-12 5 views
1

현재 안드로이드의 목록이나 gridview에서 parse.com 서버의 pdf 파일을 다운로드하고 볼 수있는 안드로이드 앱을 개발 중입니다. 그들은 단지 구글 워드 프로세서와 webview를 사용하여 그들을 볼 수 있지만, 나는 그 어떤 도움을 할 방법을 알아낼 수 없다는 것을 높이 평가합니다.안드로이드리스트 뷰에서 parse.com에 저장된 PDF 파일을 다운로드하고 보는 방법

ArrayList<ParseObject> list = new ArrayList<ParseObject>(); 
ParseQuery<ParseObject> query = new ParseQuery<ParseObject>("Mobiles"); 
query.findInBackground(new FindCallback<ParseObject>() 
{ 
@Override public void done(List<ParseObject> objects, ParseException e) 
{ if (e == null) 
{ 
list = (ArrayList<ParseObject>) objects; 
mMyadapter = new MyAdapter(context, list); 
} 
else { 
    } 
}); 
ParseFile pf = (ParseFile) list.get(position).get("pdffiles"); 
pf.getDataInBackground(new GetDataCallback() 
{ @Override 
public void done(byte[] bytes, ParseException e) 
{ if (e == null) 
{ // add to list view } else { Log.d("debug", "bad"); } } }); 
} 
} 
} 
} 

답변

0

파일의 URL을 가져온 다음 Google 문서 도구로 링크를 전달하면됩니다.

구문 분석 문서에서는 URL을 가져올 수 있다고 언급하지 않았지만 모든 개발자가 상식에 따라 필수적이고 원시적이라고 생각하기 때문에 생각합니다.

ParseFile pdfUrl=((ParseFile)list.get(position).get("pdffiles")).getUrl(); 
String googleDocsUrl = "http://docs.google.com/viewer?url=" + pdfUrl; 
Intent intent = new Intent(Intent.ACTION_VIEW); 
intent.setDataAndType(Uri.parse(googleDocsUrl),"text/html"); 

startActivity(intent); 
관련 문제