G7 32Web View

A^®WtfMMM^(Browser)± > ftAffiAAtêS^AÏfAMffiM T ° A Android ° AffimfTP^-ffi WebView AtAMffiM '

M^MM^ ' ^ATST.ZIP m* ' ^AAKA/res/raw/i^Mffi ' MAA^ m1.ZIP = ftA ' MMM show_zip()®^a^ft m1.ZIP lAÑA °

1G.7.1 Sffir

<Download>Al<ShowZip> ° 2.M^<Download>MlAÎâ ' WebView AAMA

: http://www.misoo1.com) ÉAfiMÍ®APA:

4. Mft^MM ac01 ' ^ Menu M¥SM$<ShowZip>M®£^ ' W show_zip()®^M^t m1.ZIP !|^W(M^Mg<resources>) ' MTH :

Hello world, acOl

package com.misoo.kx07; import java.io.IOException; import java.io.InputStream; import java.util.zip.ZipInputStream; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.widget.ArrayAdapter; import android.widget.ListView;

public class ac01 extends Activity {

public static final int DOWNLOADED = Menu.FmST; public static final int SHOWZIPID = Menu.FmST + 1; public static final int EXITID = Menu.FmST + 2; private ListView lv; private ArrayAdapter<String> adapter;

@Override public void onCreate(Bundle icicle) {

super.onCreate(icicle); setContentView(R.layout.wa/'«); } @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu);

menu.add(0, DOWNLOAD ED, "Download");

menu.add(0, SHOWZIPID, "ShowZip"); menu.add(0, EXITID, "Exit"); return true; }

@Override public boolean onOptionsItemSelected(Menu.Item item) { switch (item.getId()) { case DOWNLOADID:

Intent intent = new Intent(ac01.this, download. class); startActivity (intent); break; case SHOWZIPID: this.show_zip(); break; case EXITID: finish(); break; } return super. onOptionsItemSelected(item);

public void show_zip() {

InputStream ins = getResources().openRawResource(R.raw.rni);

ZipInputStream z_ins = new ZipInputStream(ins);

catch (IOException el) { e1.printStackTrace(); }

byte[] buffer = new byte[1024]; char[] cc = new char[1024];

catch (IOException e) { e.printStackTrace(); }

for(int i = 0; i<100; i++) cc[i] = (char)buffer[i];

String ss = String.copyValueOJ(cc, 39, 11); setTitle(ss);

Step-3: MM Activity lAAS^ : download ' SMA®$PT ■

package com.misoo.kx07; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.webkit.WebSettings; import android.webkit.WebView;

public class download extends Activity {

public static final int EXITID = Menu.FIRST; WebView webView = null; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle);

webView = new WebView(this); setContentView(webView); web View.getSettings().setTextSize(WebSettings.TextSize.SM4LLES7); webView.loadUrl("http://www.misoo1.com"); setTitle("Web View..."); } @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu);

menu.add(0, EXITID, "Exit"); return true; } @Ovemde public boolean onOptionsItemSelected(Menu.Item item) { switch (item.getId()) { case EXITID: finish(); break; } return super.onOptionsItemSelected(item);

webView = new WebView(this); setContentView(webView);

webView.getSettings().setTextSize(WebSettings.TextSize.£!MAZZEST); webView.loadUrl("http://www.misoo1.com");

HA—® WebView ^AÖA^A ' ISAAAPAA ' Mm loadUrl()®mA»A

InputStream ins = getResources().openRawResource(R.raw.m7); ZipInputStream z_ins = new ZipInputStream(ins);

flA—ffiZipInputStream^AAM/res/raw/ml.zip^ = ÖAAiffitÄAAM m^n-m.ZIPm ' mmmm^ ■ z_ins.getNextEntry();

3. AAÖAi^A = AAffiAMAMMMSAWebViewUIA^AAM^ ° AM ^MmtT«.ZIP m* ° AAtf^A ' AflAAAS.ZIP m ' MAAASA

4. AndroidManifest.xml UAAA^Ö^AA : <uses-permission android:name="android.permission.INTERNET' />

AAAAMMM °

0 0

Post a comment