title: how to access Assets in android?
body: <p>edit: fixed it with</p>
  
  <pre><code>ZipInputStream zin = new ZipInputStream(getAssets().open("totalkeys.zip")); 
  </code></pre>
  
  <hr>
  
  <p>I got an unzipper ( decompress ) from an example, where it takes a string as a path to a zipped file. But since I have the file in my assets, I somehow need to make to read it from there... well, got this far.</p>
  
  <p>Unfortunately it throws me "ERROR/Decompress(24122): java.lang.ClassCastException: android.content.res.AssetManager$AssetInputStream" Any ideas how to fix it? )</p>
  
  <pre><code>public class dec extends Activity {
  /** Called when the activity is first created. */
  @Override
      public void onCreate(Bundle savedInstanceState) {
  
          super.onCreate(savedInstanceState);
  
          Toast.makeText(this, "hello, starting to unZipp!", 15500).show();
  
          String location = Environment.getExternalStorageDirectory() + "/unzipped/"; 
          /////////////////////////////////////////////////////////////////////
  
          try  { 
  
              AssetManager mgr = getBaseContext().getAssets();
  
              FileInputStream fin = (FileInputStream)mgr.open("totalkeys.zip");
              // throws ERROR/Decompress(24122): java.lang.ClassCastException: android.content.res.AssetManager$AssetInputStream
  
              //FileInputStream fin = new FileInputStream(_zipFile); /// old one, that wanted a String.
              ZipInputStream zin = new ZipInputStream(fin); 
              ZipEntry ze = null; 
              while ((ze = zin.getNextEntry()) != null) { 
                Log.v("Decompress", "Unzipping " + ze.getName()); 
  
                if(ze.isDirectory()) { 
                  dirChecker(ze.getName()); 
                } else { 
                  FileOutputStream fout = new FileOutputStream(location + ze.getName()); 
                  for (int c = zin.read(); c != -1; c = zin.read()) { 
                    fout.write(c); 
                  } 
  
                  zin.closeEntry(); 
                  fout.close(); 
                } 
  
              } 
              zin.close(); 
            } catch(Exception e) { 
              Log.e("Decompress", "unzip", e); 
            } 
  
          } 
  
          private void dirChecker(String dir) { 
  
            String location = Environment.getExternalStorageDirectory() + "/unzipped/"; 
            File f = new File(location + dir); 
  
            if(!f.isDirectory()) { 
              f.mkdirs(); 
            } 
  
          ////////////////////////////////////////////////////
  
          finish();
  
  }
  
  }
  </code></pre>
  
  <p>Thanks!</p>