2016年4月26日 星期二

補鈣,怎麼吃才有用?


喜歡下廚的張太太天天都會到傳統市場買菜,有一天出門突然下大雨,張太太不小心滑了一跤,只是順勢用手撐了一下,竟造成手腕骨折。
就醫檢查發現60歲的張太太已經有骨質疏鬆症,原來她平常幾乎沒有喝牛奶,而且怕黑不曬太陽,更沒有運動習慣,醫師警告張太太,要多補充鈣質,改善骨質疏鬆情形,否則未來會很容易骨折。
現代人普遍少鈣
您「少鈣了」嗎?經常看到媒體播出國人鈣質攝取太少的廣告,根據衛生福利部食品藥物管理署「國人膳食營養素參考攝取量及其說明」第7版的資料指出,國人13歲的鈣質建議攝取量是500毫克、46歲是600毫克、79歲為800 毫克、1012歲是1000毫克、1318歲是1200毫克,19歲以上成人、銀髮族都是1000毫克,不過根據調查發現,國人無論在各年齡層、不管男性或女性,鈣的攝取量都非常不足。
根據臺大醫院營養部主任鄭金寶針對國內40歲到70歲婦女攝取鈣的研究報告顯示,國內婦女每天的飲食中,平均只吃到350400毫克的鈣,和建議攝取量的1000毫克相較,明顯偏低,而且不只是婦女,國高中孩童近100%鈣攝取不足,成人也有約8成缺鈣。
老了才補鈣來不及?不補缺更大
台灣人的習慣,年輕的時候只注意減肥、控制飲食,若沒有注意鈣質的攝取量,或許體重減下來也連帶骨密度下降,得不償失;或是等到開始注意要均衡飲食想補充鈣質時,通常都已年近中年。許多專家常提醒民眾從年輕起就要存夠「骨本」以免老了才要補充鈣質就來不及了。為什麼會來不及?因為不同的年齡層對鈣的 吸收率不同,孩童的鈣質吸收率是各年齡層最高的,約達60%,而一般成人的吸收率只有20%到40%,而女性更年期後以及老年男性,每年吸收率會以0.2%的速度遞減。除了要面對骨質大量流失的問題以外,老年人對鈣的吸收率甚至低於30%,才會說老了才要補鈣就來不及了。
但不論來不來得及,各年齡層每天都要攝取足夠的鈣質,才不會讓骨質流失繼續惡化,緩減骨質流失的速度,尤其是老年人,更要注意補鈣的重要性。

補足鈣 注意飲食4原則
國人的飲食習慣中普遍缺鈣,如果要補到足夠的鈣,就要多選擇「高鈣的食物」,建議補鈣要把握以下4原則,鈣質才能補得夠:
1.不要排斥奶製品:雖然目前有許多質疑奶製品的論調,但是,奶類仍是最能快速有效補充鈣質的食物,因為奶鈣的吸收率高達25%至30%,相較於植物性鈣容易和離子結合,吸收率只有10%到15%,在國人缺鈣嚴重之下,不 宜排斥奶製品。建議每天喝 1.52杯低脂奶,若擔心乳糖不耐症會拉肚子,可以選擇優 酪乳、起司等奶製品。
2.不要怕奶太多:雖然有人質疑「鈣質吃得愈多的國家,民眾缺鈣愈多」,不過台灣人嚴重缺鈣,並沒有鈣吃太多的問題,為增加民眾的奶類補充,建議家庭主婦應多多將奶類入菜,例如牛奶烤白菜、起司蛋吐司、牛奶布丁等,增加每天的奶類攝取量。
3.補鈣要三餐均衡攝取:很多人只會在早餐喝牛奶,其他的時間就很少注意攝取鈣,但因為人體一次最大的鈣吸收量只有500毫克,即使早餐喝很多牛奶、起司片也吃了好幾片,超量的鈣就會被排掉,所以鈣質應分開在三餐中都要補充,可以早餐喝一杯牛奶、睡前再喝一杯牛奶,而午、晚餐,可以多吃帶骨的小魚干、 海藻類、蝦皮、深綠蔬菜的芥藍、莧菜、黑芝麻等高鈣食物,但記得芝麻要咬碎,才能讓其中的鈣質釋放出來。
4.多樣化選擇,均衡吃3035種不同食物:如果不喝牛奶,建議每天均衡攝取3035種不同的食物,例如豆類可優先挑選小方豆干含鈣最多;尤其吃素的民眾更要注意吃夠多種蔬菜水果,其中綠葉蔬菜,例如芥菜、莧菜等含鈣量較高;多吃堅果種子食物,其中以黑芝麻和山粉圓含量最高。素食者也可以多吃海帶及 海藻類,像俗稱「海中燕窩」的石花菜就含有豐富的鈣質,而蒟蒻在製作過程中會加入礦 物質,含鈣量也不低,可以加以攝取。
鈣片的選擇
最大劑量不超過500毫克
當發現有缺鈣問題時,大部分的人會選擇使用鈣片,但鈣片要怎麼選?要吃天然鈣還是合成鈣?哪種鈣片比較容易吸收?常令人困擾。
「天然鈣」的吸收率當然比較好,但缺點是貴又容易有金屬污染及高磷的問題。選擇鈣片要考量鈣離子含量及吸收率,市售鈣劑量約100毫克到500毫克,建議最大劑量不要超過500毫克,一天最大攝取量上限是2500毫克。如果有吃高鈣食物,建議選擇250毫克劑量的鈣片;若很少吃高鈣食物,可以選擇500毫克。鈣片若未嚼碎可能會因解離不完全而影響吸收,發泡錠劑型的鈣片則較適合老年人使用。
飯後吃鈣片可搭配柳橙汁補充鈣片要避開吃高鈣食物的那一餐。鈣質的吸收需要有維他命D,所以可以選擇添加維他命D的產品。鈣質在酸性的狀態下比較好吸收,可以搭配柳橙汁或維他命C,飯後食用,但要避免和咖啡因、高纖、高鐵、高磷及高草酸食物共食,以免影響鈣的再吸收。服用降血壓藥及抗生素時也要避開高鈣飲食,以免降低藥效。
不只要補鈣,更要保鈣
35歲以後人體骨質流失的速 率會漸漸大於骨質生成。為了防骨質流失,除了補鈣以外,和補充鈣質一樣重要的是:預防鈣質流失。
1.攝取鈣要避開高纖食物:很多人為了預防便秘及減重常採取高纖飲食,但是過量纖維卻會妨礙鈣質等礦物質的吸收,因此建議高纖食物和補鈣的食物應該分開攝食。
2.避免易致鈣流失的食物:國人喜歡吃炸雞排等肉食,高鈉及高蛋白質飲食會造成鈣質流失,也不宜過量喝咖啡、酒精及碳酸飲料。喝咖啡可用低脂鮮奶取代奶精,減少鈣質流失。
3.充分日曬及運動:保護骨鈣要注意「補鈣」、「日曬」、「運動」,三項缺一不 可。人體的維他命D是在腎臟 轉化,日曬不足會造成維他命D轉化不佳,建議每週至少要找三天各曬15分鐘,同時要進行負重的運動,有助骨中的鈣質增加而不流失
4.攝取含豐富維他命D的食物:維他命D可以增加鈣吸收,如蛋黃、牛奶、鮪魚、小魚乾等。
鈣補過頭,當心結石 雖然國人普遍缺鈣,但是鈣質攝食過量,輕則發生便秘,現在還有研究指出,攝取高劑量鈣易致心血管疾病及腎結石。人體一次吸收鈣最大劑量是500毫克,一次最多只能處理600毫克的鈣,過多的鈣在腎臟濾出時易形成結石,若結石檢驗出來屬碳酸鈣成分,未來則應限制鈣的攝取,避免結石復發。
高鈣食物建議表(資料來源∕國民健康署;每100克含鈣量)
種類
50-100mg
101-200mg
201-500mg
500mg 以上
穀物澱粉類
綜合穀類粉、蒟蒻
糙米片隨身包、加鈣米
麥片
養身麥粉
堅果及種子類
白芝麻、杏仁粉、核桃粒
紅土花生、花生粉、蓮子、開心果
杏仁果、無花果
黑芝麻、黑芝麻粉、芝麻醬、芝麻糊、山粉圓、愛玉子
蔬菜水果類
海帶、芥菜、油菜花、甘薯葉、白鳳菜、青江菜、空心菜、菠菜、高麗菜、黑棗、葡萄乾、紅棗、芹菜、雪裡紅、桔子
紅莧菜、薄荷、九層塔、莧菜、綠豆芽、紅鳳菜、藤三七、川七、小白菜、油菜、黃秋葵、紫菜、龍眼乾、皇冠菜
黑甜菜、芥蘭、山芹菜、洋菜
髮菜、香樁
豆類
米豆、豆腐皮、蠶豆、花豆
黑豆、黃豆、豆鼓、綠豆、傳統豆腐、杏仁、紅豆、腰果
干絲、凍豆腐、黃豆
小方豆干
魚貝類
紅蜻蜓魚、小龍蝦、白口、紅蟳、斑節蝦、干貝、螳螂蝦、草魚、海鰻、白花、白海參
蝦姑頭、牡蠣、文蛤、鹹小卷、劍蝦、牡蠣干、蝦仁
旗魚鬆、金錢魚、薔薇離鰭鯛
小魚干、蝦皮、蝦米、魚脯
乳品類

高鐵鈣脫脂牛乳、脫脂高鈣鮮乳、低脂鮮乳、低脂保久乳

奶粉、羊奶粉、羊乳片、乳酪

Q 市售牛奶或奶粉有些特別添加了高鈣,多喝是否有助益?
A:有許多奶品及奶粉標榜特別增加鈣的成分,但若飲食的鈣攝取充足,多喝高鈣奶粉並無好處,因為人體一次最大吸收量為500毫克,過量也無法吸收,還可能引起結 石等問題。
Q 聽說菠菜和豆腐一起吃會影響鈣質吸收率,真的嗎?
A 因為菠菜含有高草酸,菠菜和豆腐同煮,易造成豆腐中所含的鈣和菠菜的草酸在腸胃道結合成草酸鈣由糞便排除,會降低鈣質的吸收,因此並不建議菠菜和豆腐同煮。

source



2016年4月25日 星期一

如何使用 DOS 指令將程式關閉



如何使用 DOS 指令將程式關閉

欲使用 DOS 指令將程式關閉的話,會因為不同的作業系統而有不同的作法,下面以關閉 IE 瀏覽器為例進行說明:
  1. Windows NT4 的話,需要安裝 Resource Kit,在 C:\NTResKit 裡有 kill.exe,然後使用
    kill iexplore.exe
  2. Windows 2000 則請安裝支援工具(在Windows 2000 CD的Support\Tools,執行setup.exe )安裝之後,在 C:\Program Files\Support Tools 裡有 kill.exe ,然後使用
    kill iexplore.exe
  3. Windows XP/Windows 2003 請使用內建的 taskkill.exe 指令,且要加上 /im 的參數,如:taskkill /im iexplore.exe


source
http://alexchuo.blogspot.tw/2005/10/dos.html

2016年4月20日 星期三

地政規費繳納


以信用卡臨櫃刷卡繳納地政規費及罰鍰

信用卡繳費 EASY GO !
臺北市各地政事務所105年1月1日起開辦「信用卡臨櫃刷卡繳納地政規費及罰鍰」,省時省力超便利, 歡迎多加利用喔!
每筆交易由持卡人依發卡機構規定支付手續費。
配合注意事項:
一、限本所受理申請案件之規費及罰鍰。
二、以「信用卡臨櫃刷卡」,所持信用卡須為參加「公務機關信用卡繳費平台」之發卡機構方得使用信用卡臨櫃刷卡繳納地政規
    費及罰鍰(發卡機構及手續費可至http://www.nccc.com.tw/ 網站查詢)。
三、每筆刷卡金額上限視個人信用額度而定。
四、每筆交易由持卡人依發卡機構規定支付手續費。
五、每筆刷卡金額應以交易金額整筆繳納。如欲取消交易,應當場取消,否則須以書面向本所申請退費。惟手續費之收取方式係
    依發卡機構規定辦理。
六、請持卡人當場核對開立規費金額與刷卡金額是否相符後簽名。
  • 點閱: 341
  •  
  • 資料更新: 2015/12/31 15:50
  •  
  • 資料檢視: 2015/12/31 15:49

  • 資料維護: 臺北市中山地政事務所

source
http://www.csla.gov.taipei/ct.asp?xItem=147597655&ctNode=71810&mp=111031

一、地政規費的繳納方式有哪些?
答:為提供多元繳費選擇,本所目前提供以下繳納方式:
(一)現金繳費。
(二)匯款繳費(限3萬元以上)。
(三)郵政匯票。
(四)銀行本行支票。
(五)ATM電子付費。
(六)晶片金融卡繳費(單筆交易金額最高200萬元,每日最高300萬元,如非使用台北富邦銀行晶片金融卡繳費,另需支付8元之轉帳手續費)。
(七)悠遊卡繳費。
※配合注意事項:
1.注意扣款額度【悠遊卡扣款上限單卡為1萬元】。
2.無法辦理儲值作業。【自103年3月18日起,全面新增規費收費櫃檯使用悠遊聯名卡可自動加值及退貨服務功能】
3.不可繳納罰鍰。
4.須以規費金額整筆繳納。
5.申請人須當場核對悠遊卡收據扣款金額是否正確。
6.刷卡金額如有錯誤,僅能取消刷卡扣款,無法以現金退還,並得重新辦理刷卡作業。)
(八)地政線上系統信用卡繳費。
※配合注意事項:
1.限本所轄區之登記測量案件。
2.民眾所持信用卡,須為參加「電子化政府服務平臺」之發卡機構方得使用信用卡繳納地政規費【發卡機構及手續費可至http://www8.www.gov.tw/school/rate.htm 網站查詢】。
3.金額上限視個人信用卡額度而定。
4.每筆交易均須由持卡人自行負擔手續費。
5.以規費金額整筆繳納,並由送件人自行輸入信用卡資料。
6.因於電子付費平臺刷卡繳費成功後無法於該平臺進行退費程序,民眾如欲退費,請以書面向受理所申請,惟手續費因係發卡機構收取受理所無法退還。
7.請確認是否繳納成功;若繳費失敗,請改以其他方式繳納。
8.請送件人當場核對開立規費金額與線上刷卡金額是否相符。
(九)信用卡臨櫃刷卡繳納地政規費及罰鍰。
※配合注意事項:
1.限本所受理申請案件之規費及罰鍰。
2.以「信用卡臨櫃刷卡」,所持信用卡須為參加「公務機關信用卡繳費平台」之發卡機構方得使用信用卡臨櫃刷卡繳納地政規費及罰鍰(發卡機構及手續費可至http://www.nccc.com.tw/網站查詢)。
3.每筆刷卡金額上限視個人信用額度而定。
4.每筆交易由持卡人依發卡機構規定支付手續費。
5.每筆刷卡金額應以交易金額整筆繳納。如欲取消交易,應當場取消,否則須以書面向本所申請退費。惟手續費之收取方式係依發卡機構規定辦理。
6.請持卡人當場核對開立規費金額與刷卡金額是否相符後簽名。

source
http://www.csla.gov.taipei/ct.asp?xItem=4793&ctNode=37782&mp=111031


2016年4月18日 星期一

[Net] command line 網路相關指令

※ 常用網路測試命令
   (一)、【指令】
          route  print     顯示目前主機之IP路由表(Routing Table)
                 add       加入路由資料
                 delete    刪除路由資料
                 change    更改路由資料
         【功能】
          顯示或修改目前主機之IP路由表 (Routing Table)。

   (二)、【指令】
          ping  [主機的網址或IP位址]
          -t    持續發出測試封包直到終止此命令為止
          -n    設定測試封包的個數,預設為4
          -l    設定測試封包的長度,預設為64-byte
         【功能】
          偵測主機與遠端主機間的連線是否暢通,並顯示封包傳送往返的時間。
         【說明】
          執行"ping localhost"指令,結果顯示主機本身TCP/IP環境正常。其中127.0.0.1
          係主機的Loopback位址,並非IP位址,其主要作為測試用途。

   (三)、【指令】
          ipconfig    顯示網路介面的IP位址、網路遮罩及Gateway位址
          /all        顯示網路介面詳細的設定情形
         【功能】
          顯示主機網路介面的IP位址、網路遮罩(mask)、預設Gateway位址、
          主機名稱及DNS伺服器位址等資訊。
         【說明】
          其中Physical Address是指MAC(Media Access Control)位址,
          又稱Ethernet位址,係寫入網路卡上

   (四)、【指令】
          winipcfg
         【功能】
          顯示主機名稱、DNS伺服器位址、配接卡位址(即MAC位址)、IP位址、
          網路遮罩(mask)及Gateway位址等資訊。
         【說明】
          本指令僅能於Windows 95上執行。
   
   (五)、【指令】
          hostname
         【功能】
          顯示主機名稱。
         
   (六)、【指令】
          tracert  [主機的網址或IP位址]
          -d       不須將IP位址解析為網址
          -h       設定封包傳送所經的最大hop數
          -w       設定封包傳送之逾時秒數,超過則重送封包
         【功能】
          顯示主機至遠端主機間封包傳送所經之路逕、Gateway位址及往返時間。
          
   (七)、【指令】
          finger  [使用者名稱]@ [主機的網址或IP位址]
         【功能】
          顯示遠端主機的某一個用戶資訊。
        
   (八)、【指令】
          arp
         【功能】
          顯示IP位址與MAC(Media AccessControl)位址的對應關係,
          可用來檢查IP位址相衝等問題。

   (九)、【指令】
          rcp  [主機名稱:來源檔] [主機名稱:目的檔]
          -a  文字模式傳輸方式
          -b  二進位模式傳輸方式
          -r  連同子目錄一起複製
         【功能】
         rcp(remote copy)指令用於二台主機間複製檔案,遠端主機須提供rcp服務。

   (十)、【指令】
          rexec  [主機的網址或IP位址][命令command]
         【功能】
          rexec(remote exec)可將命令交由遠端主機來執行,
          其中遠端主機須提供rexec服務,操作時並須輸入帳號及密碼。

   (十一)、【指令】
            rsh  [主機的網址或IP位址][命令command]
           【功能】
            rsh(remote shell) 可將命令交由遠端主機來執行,
            其中遠端主機須提供rsh服務。
 
   (十二)、【指令】
            ftp  [主機的網址或IP位址][port(預設值21)]
            -v   不顯示遠端主機的回應訊息
            -i   於多檔傳送時不回應提示訊息詢問使用者
            -s   ftp自動執行script檔
            -w   設定傳輸緩衝區大小,預設為4096-byte
           【功能】
            提供網路上二台主機間之檔案傳送。
           【說明】
            一般而言,ftp有二種形式:
            1.不具名的ftp,連線帳號為"anonymous",密碼為個人的E-mail地址,
              通常只能下載而不能上傳檔案。
            2.具有主機連線帳號及密碼的ftp,能夠下載及上傳檔案。
              可鍵入"?"查得全部ftp指令。
              ftp常用指令如下:
              !         暫時退出ftp回到DOS,按exit後又跳回ftp環境
              ascii     文字檔傳輸模式
              binary    二進位檔傳輸模式
              bye       中止連線,並結束ftp命令
              close     中止連線,但仍在ftp環境
              cd        變更遠端主機工作目錄
              dir       顯示遠端主機工作目錄內容
              get       下載檔案
              lcd       變更local主機工作目錄
              ls        顯示遠端主機工作目錄內容
              mget      下載多個檔案,可用萬用字元
              mput      上傳多個檔案,可用萬用字元
              open      與另一主機連線
              prompt    多檔傳送時顯示確認提示字串
              put        上傳檔案
              pwd       顯示遠端主機工作目錄
            ftp> pwd     顯示遠端主機的工作目錄為 /home/httpd151/htdocs/tris2
            ftp> ls f*         查看以f為開頭的所有檔案
            ftp> get fan.htm   下載fan.htm檔案
            ftp> bye           結束ftp作業
            或者可先用文書編輯器建立script檔如下:
            ftp.txt內容:  trisadm      s使用者帳號
            password     s密碼
            get fan.htm    s下載檔案
            bye          s中止連線
            再執行"ftp -s:ftp.txt 203.69.78.113"指令,即可下載fan.htm檔案。

     (十三)、【指令】
              telnet  [主機的網址或IP位址][port(預設值23)]
             【功能】
              連到網路上一台遠端主機並模擬其終端機。
            
     (十四)、【指令】
              nslookup  [主機的網址或IP位址]
             【功能】
              查詢一台主機的IP位址及其對應的網域名稱。
             【說明】
              本指令有二種工作模式,若有指定欲查詢的主機網址或IP位址,
              則立即顯示結果;若nslookup後面沒加任何參數則進入指令模式,
              使用者可鍵入主機網址、IP位址或其它命令進行查詢,最後鍵入exit
              退出nslookup作業環境。
     
     (十五)、【指令】
              netstat -a   顯示所有TCP、UPD連線及當時待連線狀態
                      -e   顯示Ethernet介面之流量統計資料
                      -p   顯示指定協定(ip,icmp,tcp,udp)的連線及統計資料
                      -r   顯示路由表(Routing Table)
                      -s   顯示ip,icmp,tcp,udp的流量統計資料
             【功能】
              顯示目前TCP/IP的狀態,建立連線之雙方及相關流量統計資料。
             
     (十六)、【指令】
             nbtstat -a [遠端主機名稱]     顯示遠端主機的名稱
                     -A [遠端主機IP位址]   顯示遠端主機的NetBIOS名稱列表
                     -n                    顯示主機本身的NetBIOS名稱列表
                     -r                    顯示主機執行過的NetBIOS名稱解析次數的統計
                     -s                    顯示主機的NetBIOS連線表(Connection Table)
             【功能】
              顯示NetBIOS名稱列表、節點名稱對應的IP位址及NetBIOS進行通訊的
              流量統計資料。
     (十七)、【指令】
              NET

來源:http://net.niu.edu.tw/images/Test_Net_Command.txt

2016年4月12日 星期二

網頁轉APP_PhoneGap


PhoneGap

http://docs.phonegap.com/develop/1-embed-webview/ios/

http://docs.phonegap.com/develop/1-embed-webview/android/

Embedding the Webview

CREATING APPS WITH PHONEGAP AND ANDROID NATIVE COMPONENTS

In this guide we'll walk through the basic steps needed to create a native hybrid Android app that has elements of both native Android components and a Cordova webview. For more information about why you might choose this approach, read this blog post.

Requirements:

Reference App

We'll use this sample application for reference throughout the tutorial. It contains two views; a Cordova view and a native view. The final sample app will have a button on the Cordova webview that will add an item to a list in the native view to show how to communicate between the web and native views. The sample also uses a couple other Cordova plugins to show how they're installed and for further reference use.

Step 1: Create a Base Cordova Project

Most developers use the PhoneGap or Cordova CLI to create their projects, however for this type of project it's not recommended since we are only working with the Android platform project specifically and we don't want to rebuild or overwrite the platform level code each time we run. Instead we'll use the cordova-android project itself. (This is the same project used from the CLI when you add the Android platform).
  1. Begin by cloning or downloading the zip file for the cordova-android Apache Cordova project for Android. Run the following command to execute the create script from the directory containing the cordova-android base project you cloned or unzipped locally to create the default Hello Cordova project. (If you unzipped into your user directory then you should run it from there).
     $ cordova-android/bin/create HybridAndroidApp org.sample.hybridandroidapp
    
    You will see output that looks like the following:
     HybridAndroidApp
     Creating Cordova project for the Android platform:
         Path: HybridAndroidApp
         Package: org.example.hybridandroidapp
         Name: HybridAndroidApp
         Activity: MainActivity
         Android target: android-22
     Copying template files...
     Android project created with cordova-android@4.1.0-dev
    

Step 2: Add Plugins

  1. Next use plugman to add any desired plugins. Plugman is the tool used to work with Cordova plugins when we're not using a CLI specifically. While still on the command line, cd into the root project created above:
     $ cd HybridAndroidApp
    
    Now add plugins using plugman from the command line of the root project with the syntax below. For this sample app we'll add the following set of plugins:
     $ plugman install --platform android --project . --plugin cordova-plugin-whitelist        
     $ plugman install --platform android --project . --plugin cordova-plugin-device        
     $ plugman install --platform android --project . --plugin nl.x-services.plugins.toast
    

Step 3: Import the project into Android Studio

Go to File -> Import Project and select the root HybridAndroidApp project created above. Allow the Gradle Sync to occur by clicking Ok in the dialog that pops up:
Stop and run the app now to ensure you see the default Hello Cordova app running and the DEVICE READY message before moving on.

Step 4: Create a layout for a native view

Next create a layout resource file to represent a native list view. The layout resource is an xml file that defines how a view will look. It will be used in the MyListActivity.java Class created in the next step.
To create a layout, right click on the res folder in the project navigator on the left and then select the New -> Android Resource Directory option. In the dialog popup, select layout for the Directory name and Resource type and leave Source set to main.
Now right click on the new layout folder in the project navigator and select New -> Layout Resource file. Put in a name of activity_list and leave the Root element and Directory name as is.
Paste in the following content to represent a simple list view. We'll use this list view to add items when pressing a button from the Cordova view:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">
    <ListView
        android:id="@android:id/list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
    />        
</LinearLayout>

Step 5: Create a Native List Activity

Now we need a native Activity class to represent the logic behind this view. Based on the android docs, an activity is a single, focused thing a user can do. Almost all activities interact with the user, so theActivity class takes care of creating a window for your UI. Create a new Java Class calledMyListActivity in your project's java/ folder at the same level as theMainActivity class. In the sample case it's under org.sample.hybridandroidapp. Paste in the following below the package declaration and save it.
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import java.util.ArrayList;

public class MyListActivity extends ListActivity {

    ArrayList<String> list = new ArrayList<String>();

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        /** Setting a custom layout for the list activity */
        setContentView(R.layout.activity_list);

        Intent intent = this.getIntent();

        if (intent.hasExtra("items")) {
            list = intent.getExtras().getStringArrayList("items");
        }
        /** The adapter to manage the data for the list **/
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, list);

        /** Setting the adapter to the ListView */
        setListAdapter(adapter);

        setResult(RESULT_OK, intent);
    }  
}
Note the line setContentView(R.layout.activity_list);. This is the line where we specify the layout view to associate with this Activity.

Step 6: Add to the AndroidManifest.xml

In this step we'll add our new Activity to the AndroidManifest.xml. Open theAndroidManifest.xml in the root of your project (or it may be listed in Android Studio under amanifests folder depending on your view) and insert an element for MyListActivity in the element as shown below, right below the MainActivity declaration.
    <activity
        android:name=".MyListActivity"
        android:label="MyListActivity">
    </activity>

Step 7: Cordova to Native Communication

Hybrid Plugin

In this section we'll use a custom plugin to communicate between the native and cordova views. You can go through the steps below to create your own plugin, or install or clone it from here for use or if you want to skip the plugin creation process for now and move on to Step 8.
TIP: To directly install it to your project, use the following command from your hybrid android root:
$ plugman install --platform android --plugin https://github.com/hollyschinsky/HybridBridgePlugin.git --project .

Plugin Create Steps (Optional)

  1. Create a new folder somewhere outside of your hybrid android project named HybridBridgePlugin with two subdirectories named src and www.
  2. Next, navigate into the www/js folder and create a JavaScript file for the plugin interface namedHybridBridge.js. Insert the following code:
     var exec = require('cordova/exec'),
         cordova = require('cordova');
    
     function HybridBridge() {
    
     }
     HybridBridge.prototype.addItem = function(item, classname, successCallback, errorCallback) {
         exec(successCallback, errorCallback, "HybridBridge", "addItem", [item, classname]);
     };
    
     module.exports = new HybridBridge();
    
  3. Now create folders to reflect your Java package as subdirectories of the src folder (src/org/sample/hybrid). Navigate into src/org/sample/hybrid and create the Java interface for the plugin in a file named HybridBridge.java. Insert the following code:
     package org.sample.hybrid;
    
     import android.content.Context;
     import android.content.Intent;
    
     import org.apache.cordova.CallbackContext;
     import org.apache.cordova.CordovaPlugin;
     import org.json.JSONArray;
     import org.json.JSONException;
    
     import java.util.ArrayList;
    
     public class HybridBridge extends CordovaPlugin {
         public ArrayList itemsList = new ArrayList();
         public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
             try {
                 if (action.equals("addItem")) {
                     String item = args.getString(0);
                     String className = args.getString(1);
                     Context context = cordova.getActivity().getApplicationContext();
                     Intent intent = new Intent(context,Class.forName(className));
                     itemsList.add(item);
                     intent.putStringArrayListExtra("items", itemsList);
                     cordova.startActivityForResult(this,intent,1);
                     callbackContext.success();
                     return true;
                 }
                 callbackContext.error("Invalid action");
                 return false;
             } catch(Exception e) {
                 System.err.println("Exception: " + e.getMessage());
                 callbackContext.error(e.getMessage());
                 return false;
             }
         }
         public void onActivityResult(int requestCode, int resultCode, Intent data) {
             // Handle a result here if one set in the Activity class started
             System.out.println("Activity Result: " + resultCode); //-1 is RESULT_OK
             if (resultCode==Activity.RESULT_OK) {
                 System.out.println("All good!");
             }
         }     
     }
    
    NOTE: The execute function will create an android Intent for the fully qualified name of theActivity class specified in the parameter. In our sample we will pass in the name of our List Activity class: "org.sample.hybridandroidapp.MyListActivity" and the code will resolve it to the class to be started. The code also adds the latest item to the ArrayList of items being managed for that view and passes in the updated list as an extra to be accessed from the Intent.
  4. Cordova plugins use a plugin.xml file to describe their metadata so they can be added via plugman and submitted to the registry for others to use. In the root of your HybridBridgePlugin folder create a file namedplugin.xml with the following text, replacing with your own plugin details, GitHub repo etc.
     
     <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
           xmlns:android="http://schemas.android.com/apk/res/android"
           id="cordova-plugin-hybrid"
           version="1.0.0">      
       <name>HybridBridge</name>
    
       <description>
           Simple hybrid bridge example
       </description>
    
       <author>Your Name</author>
    
       <license>MIT</license>      
       <keywords>Hybrid, Embedded </keywords>
    
       <engines>
           <engine name="cordova" version=">=3.0.0"/>
       </engines>
    
       <js-module src="www/HybridBridge.js" name="HybridBridge">
           <clobbers target="HybridBridge" />
       </js-module>
    
       
       <platform name="android">
           <config-file target="res/xml/config.xml" parent="/*">
               <feature name="HybridBridge">
                   <param name="android-package" value="org.sample.hybrid.HybridBridge" />
               </feature>
           </config-file>
           <source-file src="src/android/org/sample/hybrid/HybridBridge.java" target-dir="src/org/sample/hybrid"/>
       </platform>      
      </plugin>      
    
    There are also optional repo and issue elements that can also be included if you upload your plugin to a repo and
    helps you share it with others. https://github.com/hollyschinsky/HybridBridgePlugin.githttps://github.com/hollyschinsky/HybridBridgePlugin/issues
    Your final plugin structure should look like the following:
  5. Now, open your terminal and cd into the root of your hybrid android project. Install your new plugin with the following syntax and using the path to your own hybrid plugin after the --plugin option:
       $ plugman install --platform android --plugin ~/HybridBridgePlugin --project .
    
    If you have any issues with the above you can install the sample plugin directly with the following command:
       $ plugman install --platform android --plugin https://github.com/hollyschinsky/HybridBridgePlugin.git --project .
    

  1. Open /assets/www/index.html and modify the app div block to include the new input and button HTML elements shown below:
     <div class="app">
         <h1>Apache Cordova</h1>
         <div id="deviceready" class="blink">
             <p class="event listening">Connecting to Device</p>
             <p class="event received">Device is Ready</p>
         </div>
         <input id="bookmark" type="text"/>
         <button id="btnAdd">ADD ITEM</button>
         <br/>
         <button id="btnDeviceInfo">GET DEVICE INFO</button>
         <br/>
         <button id="btnToast">SHOW TOAST</button>
         <br>
         <button id="btnUrl">OPEN URL</button>
         <br/>
     </div>
    
  2. Open /assets/www/js/index.js and add the following code to handle our new buttons:
    First modify the onDeviceReady function to look as shown here:
      onDeviceReady: function() {
         window.plugins.toast.showLongBottom('Use the back button to return to main.');
         document.getElementById("btnAdd").addEventListener("click", app.addItem);
         document.getElementById("btnToast").addEventListener("click", app.showToast);
         document.getElementById("btnDeviceInfo").addEventListener("click", app.showDeviceInfo);
         document.getElementById("btnUrl").addEventListener("click", app.openWeb);
         app.receivedEvent('deviceready');
      },
    
    Next, still in index.js, define the handlers for each of the buttons registered above directly below thereceivedEvent function:
     addItem: function() {
        console.log("Plugin ADD ITEM CALLED " + HybridBridge);
        var item = document.getElementById("bookmark").value;
        HybridBridge.addItem(item,function(){console.log("Hybrid Bridge Success")},function(e){console.log("Hybrid Bridge Error" + e)});
     },
     showDeviceInfo: function(){
        var message = 'Cordova version: ' + device.cordova;
        message += '\n\nDevice Model: ' + device.model;
        message += '\n\nDevice Version (Android): ' + device.version;
        alert(message);
     },
     showToast: function(){
        window.plugins.toast.showShortCenter('PHONEGAP IS AWESOME!!!');
     },
     openWeb: function(){
        var url = "http://phonegap.com"
        window.open(url)
     }
    

Step 9: Run it!

Run it now from Android Studio and choose either an emulator or device target. Here it is running in a Nexus 5 emulator. Enter text and click Add Item to ensure it's working correctly. Click the other buttons to display device info, show a toast message etc, taking advantage of the other plugins added to the project.

Step 10: Troubleshooting

If you run into any issues, start by checking logcat (the device console for Android) to look for errors. You can use the logcat window from Android Studio or run it from the command line with:
 $ adb logcat
TIP: You can search the output specifically for INFO:CONSOLE to filter the search further and locate your errors.
You could also compare your code to the sample project located here.
Edit this page on GitHub