2011-11-02 161 views
0

我有這個很無聊的例外來了擾亂我的腦海裏。FileNotFoundException異常的Android

我在這說哪裏可以找到我的應用程序的內容更新的資產文件夾中的XML文件。

所以我用xmlpullparser解析我的資產xml文件,然後得到的鏈接從那裏,然後我用代碼片斷爲:

PullLoadData pld = new PullLoadData("versioncheck.xml",SplashScreen.this); 
       pld.checkUpdate(); 
       int fileSize = 0; 
       InputStream is; 
       AssetManager assetMgr = getAssets(); 
       PullLoadData pldContent; 
       File file = new File(getString(R.string.database_path)+ "ext"); 
       progressBar.setMax(100); 
       for (int i = 0; i < pld.result.size(); i++) { 
        int results = 0; 
        for (int j = 0; j < issue.length; j++) { 
         if (pld.result.get(i).get("issue").equals(issue[j])) { 
          results = 1; 
         } 
        } 
        if (results == 0) { 

         Log.i(TAG, "ZIP Link "+ pld.result.get(i).get("link")); 

         is = assetMgr.open(pld.result.get(i).get("link"));} 

//我得到正確的URL到zip文件,並使用該從瀏覽器鏈接,我可以下載zip文件.........但我得到FileNotFoundException異常而調試。

任何想法我在哪裏錯了?

+0

我想我們需要使用網址URL =新的URL( 「您的鏈接」);然後使用URLConnection urlconn = url.openConnection(); – Robin

回答

0

你可以試試這個

URI路徑= Uri.fromFile(新文件( 「資產/ yourxmlfile.xml」));

相關問題