Chinaunix首页 | 论坛 | 博客
  • 博客访问: 9144929
  • 博文数量: 1725
  • 博客积分: 12961
  • 博客等级: 上将
  • 技术积分: 19840
  • 用 户 组: 普通用户
  • 注册时间: 2009-01-09 11:25
个人简介

偷得浮生半桶水(半日闲), 好记性不如抄下来(烂笔头). 信息爆炸的时代, 学习是一项持续的工作.

文章分类

全部博文(1725)

文章存档

2024年(1)

2023年(26)

2022年(112)

2021年(217)

2020年(157)

2019年(192)

2018年(81)

2017年(78)

2016年(70)

2015年(52)

2014年(40)

2013年(51)

2012年(85)

2011年(45)

2010年(231)

2009年(287)

分类: LINUX

2010-02-23 16:53:22

浏览器相关的代码主要位于以下三个位置:
1. external/webkit
该目录下存放开源的Webkit c/c++代码。
2. frameworks/base/core/java/android/webkit
external/webkit的java封装。提供了用于开发浏览器应用的java 类库。这些类库使用JNI访问external/webkit中相应的功能。
3. packages/apps/Browser/src/com/android/browser
浏览器应用。

web widget 目前种类比较多,比较流行的有Symbian, apple widget等。下图中的widget基于android示例HelloActivity,使用一个WebView去调用一个简单的widget。
值得注意的是,web widget中的javaScrip 可以调用java的函数,反之亦然。这将极大扩展web widget的功能。


~~~~
1. widget的index.html文件内容。此widget 利用google service API,实现语言翻译功能。将此文件拷贝到emulator上/data目录下。

 
       "">


        Google Translator
       
       
   
   


 
        Auto detect source language and translate to:

       

       

   

  Copy from the above text box and paste the text where ever. If there is an update, it will be here: link Enjoy W. Seto



~~~~~~~~~~~~~~~~~~
2. 调用widget的android程序代码
package com.example.android.hellowebview;

import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.view.*;

import com.example.android.hellowebview.R;


public class HelloWebView extends Activity {


   
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // Set the layout for this activity.  You can find it
        // in res/layout/hello_activity.xml
        setContentView(R.layout.hello_activity);
        WebView wv;
        wv = (WebView) findViewById(R.id.text);
        wv.getSettings().setJavaScriptEnabled(true);
        wv.loadUrl("file:///data/index.html");

    }
}
~~~~~~~~~
3. 在AndroidManifest.xml 中得加入如下行,否则,此程序不能访问Internet。
 
阅读(1559) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~