亚洲AV无码一区二区二三区软件,亚洲成a人片在线观看久,91精品国产亚洲爽啪在线观看http://www.tkk7.com/zdq5337/category/45514.html空山無人,水流花開。zh-cnMon, 01 Nov 2010 15:38:22 GMTMon, 01 Nov 2010 15:38:22 GMT60Android ---js與java的相互調用http://www.tkk7.com/zdq5337/archive/2010/11/01/336671.html開花流水開花流水Mon, 01 Nov 2010 06:22:00 GMThttp://www.tkk7.com/zdq5337/archive/2010/11/01/336671.htmlhttp://www.tkk7.com/zdq5337/comments/336671.htmlhttp://www.tkk7.com/zdq5337/archive/2010/11/01/336671.html#Feedback1http://www.tkk7.com/zdq5337/comments/commentRss/336671.htmlhttp://www.tkk7.com/zdq5337/services/trackbacks/336671.htmlandroid中的關鍵代碼:

webview.getSettings().setJavaScriptEnabled(true);

webview.addJavascriptInterface(object,"name");//把Name="name"的對象添加到object中。object如果是this,就是window.name

webview.loadUrl("file:///android_asset/index.html");//注意這個資源的位置是跟res并列的文件夾下。

 

js或html中調用android中方法代碼:

         如: 

         或js中 window.name.java中的方法();

android中調用js的function方法:

         Callfunction(){

      webview.loadUrl("javascript: function ()");

}

需要注意的地方,很多數據類型js中不認識,最好是在android那邊封裝好,提供必要的方法接口。比如傳到js中的list,在js中是沒辦法去得到里面的元素的。

addJavascriptInterface:addJavascriptInterface方法中要綁定的Java對象及方法要運行在另外的線程中,不能運行在構造他的線程中,也就是說不能運行在當前的activity線程中,就是把這個方法綁定到頁面中,js也可以調用

文檔中的解釋:


Use this function to bind an object to Javascript so that the methods can be accessed from Javascript.

The Java object that is bound runs in another thread and not in the thread that it was constructed in.





Demo代碼:

JavaJsDemo.java

package com.demo.android.JavaJsDemo;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
import java.util.ArrayList;
import java.util.List;
public class JavaJsDemo extends Activity {
/** Called when the activity is first created. */
private WebView web;
public List<String> list;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initData();
setContentView(R.layout.main);
web = (WebView)this.findViewById(R.id.webview);
//開啟javascript設置
web.getSettings().setJavaScriptEnabled(true);
//把RIAExample的一個實例添加到js的全局對象window中
//這樣就可以使用window.javatojs來調用它的方法
web.addJavascriptInterface(this, "javatojs");
//加載網頁
web.loadUrl("file:///android_asset/index.html");
}
void initData(){
list=new ArrayList<String>();
for(int i=0;i<5;i++){
list.add("我是List中的第"+(i+1)+"行");
}
}
/**
* 該方法將在js腳本中,通過window.javatojs.....()進行調用
* @return
*/
public Object getObject(int index){
return list.get(index);
}
public int getSize(){
return list.size();
}
public void Callfunction(){
web.loadUrl("javascript: GetList()");
}
}

index.html



DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>demotitle>
<script language="javascript">
function GetList(){
var i=window.javatojs.getSize();
for(var n=0;n<i;n++){
var jsdata= window.javatojs.getObject(n);//拿到activity里面的屬性javadata
var datalistdiv = document.getElementById("datalist"); //得到頁面的div
pnode = document.createElement("p");//創建一個p標簽,再建個textnode
tnode = document.createTextNode(jsdata);
pnode.appendChild(tnode);//p中加入數據
datalistdiv.appendChild(pnode);//div中鍵入新的p
}
}
script>
head>
<body onload="javascript:window.javatojs.Callfunction()">//調用java方法
<div id = "datalist">
this is a demo
div>
body>
html>


開花流水 2010-11-01 14:22 發表評論
]]>
Android permission 訪問權限大全http://www.tkk7.com/zdq5337/archive/2010/07/16/326266.html開花流水開花流水Fri, 16 Jul 2010 02:05:00 GMThttp://www.tkk7.com/zdq5337/archive/2010/07/16/326266.htmlhttp://www.tkk7.com/zdq5337/comments/326266.htmlhttp://www.tkk7.com/zdq5337/archive/2010/07/16/326266.html#Feedback0http://www.tkk7.com/zdq5337/comments/commentRss/326266.htmlhttp://www.tkk7.com/zdq5337/services/trackbacks/326266.html程序執行需要讀取到安全敏感項必需在androidmanifest.xml中聲明相關權限請求, 完整列表如下:
android.permission.ACCESS_CHECKIN_PROPERTIES
允許讀寫訪問”properties”表在checkin數據庫中,改值可以修改上傳( Allows read/write access to the “properties” table in the checkin database, to change values that get uploaded)

android.permission.ACCESS_COARSE_LOCATION
允許一個程序訪問CellID或WiFi熱點來獲取粗略的位置(Allows an application to access coarse (e.g., Cell-ID, WiFi) location)

android.permission.ACCESS_FINE_LOCATION
允許一個程序訪問精良位置(如GPS) (Allows an application to access fine (e.g., GPS) location)

android.permission.ACCESS_LOCATION_EXTRA_COMMANDS
允許應用程序訪問額外的位置提供命令(Allows an application to access extra location provider commands)

android.permission.ACCESS_MOCK_LOCATION
允許程序創建模擬位置提供用于測試(Allows an application to create mock location providers for testing)

android.permission.ACCESS_NETWORK_STATE
允許程序訪問有關GSM網絡信息(Allows applications to access information about networks)

android.permission.ACCESS_SURFACE_FLINGER
允許程序使用SurfaceFlinger底層特性(Allows an application to use SurfaceFlinger’s low level features)

android.permission.ACCESS_WIFI_STATE
允許程序訪問Wi-Fi網絡狀態信息(Allows applications to access information about Wi-Fi networks)

android.permission.ADD_SYSTEM_SERVICE
允許程序發布系統級服務(Allows an application to publish system-level services).

android.permission.BATTERY_STATS
允許程序更新手機電池統計信息(Allows an application to update the collected battery statistics)

android.permission.BLUETOOTH
允許程序連接到已配對的藍牙設備(Allows applications to connect to paired bluetooth devices)

android.permission.BLUETOOTH_ADMIN
允許程序發現和配對藍牙設備(Allows applications to discover and pair bluetooth devices)

android.permission.BRICK
請求能夠禁用設備(非常危險)(Required to be able to disable the device (very *erous!).)

android.permission.BROADCAST_PACKAGE_REMOVED
允許程序廣播一個提示消息在一個應用程序包已經移除后(Allows an application to broadcast a notification that an application package has been removed)

android.permission.BROADCAST_STICKY
允許一個程序廣播常用intents(Allows an application to broadcast sticky intents)

android.permission.CALL_PHONE
允許一個程序初始化一個電話撥號不需通過撥號用戶界面需要用戶確認(Allows an application to initiate a phone call without going through the Dialer user interface for the user to confirm the call being placed.)

android.permission.CALL_PRIVILEGED
允許一個程序撥打任何號碼,包含緊急號碼無需通過撥號用戶界面需要用戶確認(Allows an application to call any phone number, including emergency numbers, without going through the Dialer user interface for the user to confirm the call being placed)

android.permission.CAMERA
請求訪問使用照相設備(Required to be able to access the camera device. )

android.permission.CHANGE_COMPONENT_ENABLED_STATE
允許一個程序是否改變一個組件或其他的啟用或禁用(Allows an application to change whether an application component (other than its own) is enabled or not. )

android.permission.CHANGE_CONFIGURATION
允許一個程序修改當前設置,如本地化(Allows an application to modify the current configuration, such as locale. )

android.permission.CHANGE_NETWORK_STATE
允許程序改變網絡連接狀態(Allows applications to change network connectivity state)

android.permission.CHANGE_WIFI_STATE
允許程序改變Wi-Fi連接狀態(Allows applications to change Wi-Fi connectivity state)

android.permission.CLEAR_APP_CACHE
允許一個程序清楚緩存從所有安裝的程序在設備中(Allows an application to clear the caches of all installed applications on the device. )

android.permission.CLEAR_APP_USER_DATA
允許一個程序清除用戶設置(Allows an application to clear user data)

android.permission.CONTROL_LOCATION_UPDATES
允許啟用禁止位置更新提示從無線模塊(Allows enabling/disabling location update notifications from the radio. )

android.permission.DELETE_CACHE_FILES
允許程序刪除緩存文件(Allows an application to delete cache files)

android.permission.DELETE_PACKAGES
允許一個程序刪除包(Allows an application to delete packages)

android.permission.DEVICE_POWER
允許訪問底層電源管理(Allows low-level access to power management)

android.permission.DIAGNOSTIC
允許程序RW診斷資源(Allows applications to RW to diagnostic resources. )

android.permission.DISABLE_KEYGUARD
允許程序禁用鍵盤鎖(Allows applications to disable the keyguard )

android.permission.DUMP
允許程序返回狀態抓取信息從系統服務(Allows an application to retrieve state dump information from system services.)

android.permission.EXPAND_STATUS_BAR
允許一個程序擴展收縮在狀態欄,android開發網提示應該是一個類似Windows Mobile中的托盤程序(Allows an application to expand or collapse the status bar. )

android.permission.FACTORY_TEST
作為一個工廠測試程序,運行在root用戶(Run as a manufacturer test application, running as the root user. )

android.permission.FLASHLIGHT
訪問閃光燈,android開發網提示HTC Dream不包含閃光燈(Allows access to the flashlight )

android.permission.FORCE_BACK
允許程序強行一個后退操作是否在頂層activities(Allows an application to force a BACK operation on whatever is the top activity. )

android.permission.FOTA_UPDATE
暫時不了解這是做什么使用的,android開發網分析可能是一個預留權限.

android.permission.GET_ACCOUNTS
訪問一個帳戶列表在Accounts Service中(Allows access to the list of accounts in the Accounts Service)

android.permission.GET_PACKAGE_SIZE
允許一個程序獲取任何package占用空間容量(Allows an application to find out the space used by any package. )

android.permission.GET_TASKS
允許一個程序獲取信息有關當前或最近運行的任務,一個縮略的任務狀態,是否活動等等(Allows an application to get information about the currently or recently running tasks: a thumbnail representation of the tasks, what activities are running in it, etc.)

android.permission.HARDWARE_TEST
允許訪問硬件(Allows access to hardware peripherals. )

android.permission.INJECT_EVENTS
允許一個程序截獲用戶事件如按鍵、觸摸、軌跡球等等到一個時間流,android 開發網提醒算是hook技術吧(Allows an application to inject user events (keys, touch, trackball) into the event stream and deliver them to ANY window.)

android.permission.INSTALL_PACKAGES
允許一個程序安裝packages(Allows an application to install packages. )

android.permission.INTERNAL_SYSTEM_WINDOW
允許打開窗口使用系統用戶界面(Allows an application to open windows that are for use by parts of the system user interface. )

android.permission.INTERNET
允許程序打開網絡套接字(Allows applications to open network sockets)

android.permission.MANAGE_APP_TOKENS
允許程序管理(創建、催后、 z- order默認向z軸推移)程序引用在窗口管理器中(Allows an application to manage (create, destroy, Z-order) application tokens in the window manager. )

android.permission.MASTER_CLEAR目前還沒有明確的解釋,android開發網分析可能是清除一切數據,類似硬格機

android.permission.MODIFY_AUDIO_SETTINGS
允許程序修改全局音頻設置(Allows an application to modify global audio settings)

android.permission.MODIFY_PHONE_STATE
允許修改話機狀態,如電源,人機接口等(Allows modification of the telephony state – power on, mmi, etc. )

android.permission.MOUNT_UNMOUNT_FILESYSTEMS
允許掛載和反掛載文件系統可移動存儲(Allows mounting and unmounting file systems for removable storage. )

android.permission.PERSISTENT_ACTIVITY
允許一個程序設置他的activities顯示(Allow an application to make its activities persistent. )

android.permission.PROCESS_OUTGOING_CALLS
允許程序監視、修改有關播出電話(Allows an application to monitor, modify, or abort outgoing calls)

android.permission.READ_CALENDAR
允許程序讀取用戶日歷數據(Allows an application to read the user’s calendar data.)

android.permission.READ_CONTACTS
允許程序讀取用戶聯系人數據(Allows an application to read the user’s contacts data.)

android.permission.READ_FRAME_BUFFER
允許程序屏幕波或和更多常規的訪問幀緩沖數據(Allows an application to take screen shots and more generally get access to the frame buffer data)

android.permission.READ_INPUT_STATE
允許程序返回當前按鍵狀態(Allows an application to retrieve the current state of keys and switches. )

android.permission.READ_LOGS
允許程序讀取底層系統日志文件(Allows an application to read the low-level system log files. )

android.permission.READ_OWNER_DATA
允許程序讀取所有者數據(Allows an application to read the owner’s data)

android.permission.READ_SMS
允許程序讀取短信息(Allows an application to read SMS messages.)

android.permission.READ_SYNC_SETTINGS
允許程序讀取同步設置(Allows applications to read the sync settings)

android.permission.READ_SYNC_STATS
允許程序讀取同步狀態(Allows applications to read the sync stats)

android.permission.REBOOT
請求能夠重新啟動設備(Required to be able to reboot the device. )

android.permission.RECEIVE_BOOT_COMPLETED
允許一個程序接收到 ACTION_BOOT_COMPLETED廣播在系統完成啟動(Allows an application to receive the ACTION_BOOT_COMPLETED that is broadcast after the system finishes booting. )

android.permission.RECEIVE_MMS
允許一個程序監控將收到MMS彩信,記錄或處理(Allows an application to monitor incoming MMS messages, to record or perform processing on them. )

android.permission.RECEIVE_SMS
允許程序監控一個將收到短信息,記錄或處理(Allows an application to monitor incoming SMS messages, to record or perform processing on them.)

android.permission.RECEIVE_WAP_PUSH
允許程序監控將收到WAP PUSH信息(Allows an application to monitor incoming WAP push messages. )

android.permission.RECORD_AUDIO
允許程序錄制音頻(Allows an application to record audio)

android.permission.REORDER_TASKS
允許程序改變Z軸排列任務(Allows an application to change the Z-order of tasks)

android.permission.RESTART_PACKAGES
允許程序重新啟動其他程序(Allows an application to restart other applications)

android.permission.SEND_SMS
允許程序發送SMS短信(Allows an application to send SMS messages)

android.permission.SET_ACTIVITY_WATCHER
允許程序監控或控制activities已經啟動全局系統中Allows an application to watch and control how activities are started globally in the system.

android.permission.SET_ALWAYS_FINISH
允許程序控制是否活動間接完成在處于后臺時Allows an application to control whether activities are immediately finished when put in the background.

android.permission.SET_ANIMATION_SCALE
修改全局信息比例(Modify the global animation scaling factor.)

android.permission.SET_DEBUG_APP
配置一個程序用于調試(Configure an application for debugging.)

android.permission.SET_ORIENTATION
允許底層訪問設置屏幕方向和實際旋轉(Allows low-level access to setting the orientation (actually rotation) of the screen.)

android.permission.SET_PREFERRED_APPLICATIONS
允許一個程序修改列表參數PackageManager.addPackageToPreferred() 和PackageManager.removePackageFromPreferred()方法(Allows an application to modify the list of preferred applications with the PackageManager.addPackageToPreferred() and PackageManager.removePackageFromPreferred() methods.)

android.permission.SET_PROCESS_FOREGROUND
允許程序當前運行程序強行到前臺(Allows an application to force any currently running process to be in the foreground.)

android.permission.SET_PROCESS_LIMIT
允許設置最大的運行進程數量(Allows an application to set the maximum number of (not needed) application processes that can be running. )

android.permission.SET_TIME_ZONE
允許程序設置時間區域(Allows applications to set the system time zone)

android.permission.SET_WALLPAPER
允許程序設置壁紙(Allows applications to set the wallpaper )

android.permission.SET_WALLPAPER_HINTS
允許程序設置壁紙hits(Allows applications to set the wallpaper hints)

android.permission.SIGNAL_PERSISTENT_PROCESSES
允許程序請求發送信號到所有顯示的進程中(Allow an application to request that a signal be sent to all persistent processes)

android.permission.STATUS_BAR
允許程序打開、關閉或禁用狀態欄及圖標Allows an application to open, close, or disable the status bar and its icons.

android.permission.SUBSCRIBED_FEEDS_READ
允許一個程序訪問訂閱RSS Feed內容提供(Allows an application to allow access the subscribed feeds ContentProvider. )

android.permission.SUBSCRIBED_FEEDS_WRITE
系統暫時保留改設置,android開發網認為未來版本會加入該功能

android.permission.SYSTEM_ALERT_WINDOW
允許一個程序打開窗口使用 TYPE_SYSTEM_ALERT,顯示在其他所有程序的頂層(Allows an application to open windows using the type TYPE_SYSTEM_ALERT, shown on top of all other applications. )

android.permission.VIBRATE
允許訪問振動設備(Allows access to the vibrator)

android.permission.WAKE_LOCK
允許使用PowerManager的 WakeLocks保持進程在休眠時從屏幕消失( Allows using PowerManager WakeLocks to keep processor from sleeping or screen from dimming)

android.permission.WRITE_APN_SETTINGS
允許程序寫入API設置(Allows applications to write the apn settings)

android.permission.WRITE_CALENDAR
允許一個程序寫入但不讀取用戶日歷數據(Allows an application to write (but not read) the user’s calendar data. )

android.permission.WRITE_CONTACTS
允許程序寫入但不讀取用戶聯系人數據(Allows an application to write (but not read) the user’s contacts data. )

android.permission.WRITE_GSERVICES
允許程序修改Google服務地圖(Allows an application to modify the Google service map. )

android.permission.WRITE_OWNER_DATA
允許一個程序寫入但不讀取所有者數據(Allows an application to write (but not read) the owner’s data.)

android.permission.WRITE_SETTINGS
允許程序讀取或寫入系統設置(Allows an application to read or write the system settings. )

android.permission.WRITE_SMS
允許程序寫短信(Allows an application to write SMS messages)

android.permission.WRITE_SYNC_SETTINGS
允許程序寫入同步設置(Allows applications to write the sync settings)

android平臺上的權限許可分得很細,如果軟件無法正常執行時看看是不是缺少相關的permission聲明,最終我們還需要使用 android sign tools簽名生成的apk文件。

開花流水 2010-07-16 10:05 發表評論
]]>
EditText僅允許特定類型數據輸入 http://www.tkk7.com/zdq5337/archive/2010/07/07/325444.html開花流水開花流水Wed, 07 Jul 2010 06:30:00 GMThttp://www.tkk7.com/zdq5337/archive/2010/07/07/325444.htmlhttp://www.tkk7.com/zdq5337/comments/325444.htmlhttp://www.tkk7.com/zdq5337/archive/2010/07/07/325444.html#Feedback0http://www.tkk7.com/zdq5337/comments/commentRss/325444.htmlhttp://www.tkk7.com/zdq5337/services/trackbacks/325444.html  1. 密碼框屬性 android:password="true"  這條可以讓EditText顯示的內容自動為 星號,輸入時內容會在1秒內變成*字樣。

  2. 純數字 android:numeric="true" 這條可以讓輸入法自動變為數字輸入鍵盤,同時僅允許0-9的數字輸入

  3. 僅允許 android:capitalize="cwj1987" 這樣僅允許接受輸入cwj1987,一般用于密碼驗證

  下面是一些擴展的風格屬性

  android:editable="false" 設置EditText不可編輯

  android:singleLine="true" 強制輸入的內容在單行

  android:ellipsize="end" 自動隱藏尾部溢出數據,一般用于文字內容過長一行無法全部顯示時。



開花流水 2010-07-07 14:30 發表評論
]]>
觸屏事件的獲取和觸摸屏幕位置http://www.tkk7.com/zdq5337/archive/2010/07/07/325432.html開花流水開花流水Wed, 07 Jul 2010 03:46:00 GMThttp://www.tkk7.com/zdq5337/archive/2010/07/07/325432.htmlhttp://www.tkk7.com/zdq5337/comments/325432.htmlhttp://www.tkk7.com/zdq5337/archive/2010/07/07/325432.html#Feedback0http://www.tkk7.com/zdq5337/comments/commentRss/325432.htmlhttp://www.tkk7.com/zdq5337/services/trackbacks/325432.htmlpublic boolean onTouchEvent(MotionEvent event) {

//獲得觸摸的坐標
float x = event.getX();
float y = event.getY(); switch (event.getAction()) 
{
//觸摸屏幕時刻
case MotionEvent.ACTION_DOWN:

break;
//觸摸并移動時刻
case MotionEvent.ACTION_MOVE:

break;
//終止觸摸時刻
case MotionEvent.ACTION_UP:
break;
}
return true;
}


開花流水 2010-07-07 11:46 發表評論
]]>
主站蜘蛛池模板: 在线视频观看免费视频18| 亚洲人成伊人成综合网久久久| 亚洲成av人片在线天堂无| 免费v片在线观看| 日本免费中文视频| 亚洲欧美国产精品专区久久| 国产成人青青热久免费精品| 99精品免费视品| 最新亚洲卡一卡二卡三新区| 相泽亚洲一区中文字幕| 国产精品成人观看视频免费| 特级aa**毛片免费观看| 亚洲Av熟妇高潮30p| 亚洲国产成人精品久久久国产成人一区二区三区综 | 亚洲精品成a人在线观看☆| 免费毛片网站在线观看| 久久久精品免费视频| 久久精品国产亚洲AV电影网| 亚洲国产成人片在线观看 | 99蜜桃在线观看免费视频网站| 亚洲狠狠色丁香婷婷综合| 亚洲男人都懂得羞羞网站| 免费a级毛片永久免费| 久草在视频免费福利| 成年女人A毛片免费视频| 亚洲av无码一区二区三区天堂| 亚洲电影唐人社一区二区| 久久亚洲综合色一区二区三区 | 亚洲AV人无码综合在线观看| 亚洲精品成a人在线观看| 可以免费观看一级毛片黄a| 操美女视频免费网站| www.999精品视频观看免费| 鲁大师在线影院免费观看| 久久久久免费精品国产| 免费视频一区二区| 免费无码又爽又刺激一高潮| 最近免费字幕中文大全| 两个人看的www高清免费视频| 久久免费99精品国产自在现线| 一级特黄aaa大片免费看|