En el siguiente código podemos ver una forma de visualizar un documento html y movernos a través de sus anclas internas.
Definimos en el layout el componente WebView y el botón para ir a la siguiente ancla:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button android:id="@+id/next" android:text="Next"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
<WebView android:id="@+id/web"
android:layout_width="fill_parent" android:layout_height="fill_parent" />
</LinearLayout>
Read More »
In the raw folder, of our android project, have a test.zip file to decompress. The control class is the controller of my application.
import android.os.Environment;
import com.plasmik.test.Control;
import com.plasmik.test.R;
public void testRaw()
{
try{
// output
File sdcard = Environment.getExternalStorageDirectory();
String subfolderSd = sdcard.getAbsolutePath() + "/" + Control.getPrefs().folderProject;
File outputDir = new File (subfolderSd);
// zip
File f = new File(subfolderSd+"/test.zip");
android.content.res.Resources t = Control.getContext().getResources();
InputStream fis = t.openRawResource(R.raw.test);
Utils.inputstreamToFile(fis, f);
ZipHelper.unzip(f, outputDir);
}
catch (Exception e) {
Log.d("control","unzip error: "+e);
}
}
Read More »