2013-04-20 3 views
0

URL에서 이미지로드 용 소스를 사용하고 있습니다. 이미지 링크는 json 파일에 저장되고 json 파일은 서버에서 호스팅됩니다. 하지만 json 파일을 로컬에 저장하려면 자산 또는 드로어 블에 저장해야합니다. 제 문제는 자산 관리자를 사용하는 경우 스트림 관리자를 사용하고 스트림 관리자가 이미지 URL을로드하는 컨텍스트로 구현 된 URL과 함께 앉아 있지 않다는 것입니다. config_wallpaper_manifest_url의 url을 loacal asset url로 변경하면 즉, example.json, 같은 결코로드되지 않습니다. 이 문제를 해결할 수있는 방법은 무엇입니까? 감사.Android에서 이미지 url로 로컬 json 파일로드

public void loadData (Bundle savedInstanceState) { 

    // Check Network State 
    if (!NetworkUtil.getNetworkState(this)) { 
     final RetryFragment fragment = RetryFragment.getFragmentWithMessage("No connection"); 
     this.addFragment(fragment, RetryFragment.TAG, true); 
     return; 
    } 



    if (savedInstanceState == null || savedInstanceState.get(KEY_LIST_DATA) == null) { 
     final String url = super.getResources().getString(R.string.config_wallpaper_manifest_url); 
     if (url != null && URLUtil.isValidUrl(url)) { 
      // Add Loading Fragment 
      final LoadingFragment fragment = new LoadingFragment(); 
      this.addFragment(fragment, LoadingFragment.TAG, true); 

      // Load Data 
      final RestClientHandler handler = new RestClientHandler(this); 
      RestClient.get(this, url, handler); 
     } 

    } else { 
     Log.i(TAG, "Restored Instance"); 
     this.mData = (ArrayList<NodeCategory>) savedInstanceState.get(KEY_LIST_DATA); 
     this.mPosition = savedInstanceState.getInt(KEY_LIST_POSITION); 
     if (this.mPosition != -1) { 
      mIgnoreSelection = true; 
     } 

     this.configureActionBar(); 
    } 
} 

답변