直接將自己舊的 java 手機程式改成 Android 版本。
http://www.youtube.com/v/bYORe68RixQ
2010年5月23日 星期日
Android TabLayout 使用心得
Android 2.2 SDK 己經出了…
http://developer.android.com/sdk/index.html
最近也在學習,還好之前有 java/javaME 的基礎,還算順利。
Google 官方有提供教學網頁…
http://developer.android.com/resources/index.html
很不錯。
不過其中一個範例 TabLayout 的使用…
http://developer.android.com/resources/tutorials/views/hello-tabwidget.html
這個範例對初學者來講比較複雜。
底下是比較簡單易理解的版本…
HelloTabWidgetNoIcon.java
main.xml
對照一下 HelloTabWidgetNoIcon.java 及 main.xml 就可以了解程式碼跟 layout 間的對應關係了(tab0,tab1,tab2)。
跟官方的範例不同的地方在於,官方的還多加了…
一、Tab 的小圖示( ic_tab_artists.xml, ic_tab_albums.xml, ic_tab_songs.xml 及圖片 )
二、動態的 Tab View ( ArtistsActivity.java, AlbumsActivity.java, SongsActivity.java )
所以才比較複雜並且要多撰寫一些 xml 碼。
不過,若真的要用在手機上,當然還是用圖示比較吸引人嘍。
http://developer.android.com/sdk/index.html
最近也在學習,還好之前有 java/javaME 的基礎,還算順利。
Google 官方有提供教學網頁…
http://developer.android.com/resources/index.html
很不錯。
不過其中一個範例 TabLayout 的使用…
http://developer.android.com/resources/tutorials/views/hello-tabwidget.html
這個範例對初學者來講比較複雜。
底下是比較簡單易理解的版本…
HelloTabWidgetNoIcon.java
package com.study.HelloTabWidgetNoIcon;
import android.app.TabActivity;
import android.os.Bundle;
import android.widget.TabHost;
public class HelloTabWidgetNoIcon extends TabActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TabHost tabHost = getTabHost(); // The activity TabHost
TabHost.TabSpec spec; // Resusable TabSpec for each tab
// Initialize a TabSpec for each tab and add it to the TabHost
spec = tabHost.newTabSpec("artists").setIndicator("Artists").setContent(R.id.tab0);
tabHost.addTab(spec);
// Do the same for the other tabs
spec = tabHost.newTabSpec("albums").setIndicator("Albums").setContent(R.id.tab1);
tabHost.addTab(spec);
spec = tabHost.newTabSpec("songs").setIndicator("Songs").setContent(R.id.tab2);
tabHost.addTab(spec);
tabHost.setCurrentTab(0);
}
}
main.xml
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp" >
<TextView
android:text="tab0"
android:id="@+id/tab0"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:text="tab1"
android:id="@+id/tab1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:text="tab2"
android:id="@+id/tab2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</FrameLayout>
</LinearLayout>
</TabHost>
對照一下 HelloTabWidgetNoIcon.java 及 main.xml 就可以了解程式碼跟 layout 間的對應關係了(tab0,tab1,tab2)。
跟官方的範例不同的地方在於,官方的還多加了…
一、Tab 的小圖示( ic_tab_artists.xml, ic_tab_albums.xml, ic_tab_songs.xml 及圖片 )
二、動態的 Tab View ( ArtistsActivity.java, AlbumsActivity.java, SongsActivity.java )
所以才比較複雜並且要多撰寫一些 xml 碼。
不過,若真的要用在手機上,當然還是用圖示比較吸引人嘍。
2010年5月2日 星期日
申請使用GoogleApps免費服務記錄
Google Apps 是 GOOGLE 提供的一項很好用的服務,提供免費的網頁、EMAIL服務…,一些小公司、小企業、社群團體都應該考慮使用這項免費的服務,其中EMAIL服務算是最重要的,有了這個,你再也不用自己架設、管理MAIL伺服器,可以節省一大筆開銷又能同時獲得很穩定的EMAIL服務(己使用二年的經驗來看算是非常穩定的)
你需要…
一個有效的網域名稱 ( 可以申請免費服務 )
一台DNS伺服器 ( 可以申請免費服務 )
一台網頁伺服器 ( 驗證用,透過其它驗證方式,可以省掉不用 )
換句話說,你完全不需要準備任何伺服器,就可以完成 GOOGLE APPS 服務的申請。
底下是簡單的申請步驟抓圖記錄
到申請首頁輸入你的網域名稱(透過購買或從網路上申請免費網域名稱)
輸入申請資料
輸入管理理帳戶資料
初步申請完成
進行「網域名稱驗證」,以驗證這個網域確實是你的,二種驗證方式,CNAME不需要主機,只需要DNS服務,網頁方式則需要透過上傳網頁的方式來進行,選取後GOOGLE會導引你進行驗證。
這邊是使用網頁的方式進行驗證(需要有自己的網頁伺服器)
再來是EMAIL的設定,需要設定DNS的MX記錄,指向GOOGLE的MAIL管理伺服器,才能讓GOOGL順利利用此網域收發信
這邊使用免費網域twbbs,設定MX記錄讓EMAIL生效
幾小時後,你的email服務就可以使用了!!
2010年4月29日 星期四
GOOGLE MAP 導航
使用 FLEX 測試 GOOGLE MAP API ,簡單的導航功能的應用。
線上DEMO:
http://www.asn.com.tw/flex/GoogleMapTest/GoogleMapTest.html
20110827連結更新…
http://www.vercenter.nknu.edu.tw/flex/GoogleMapTest/GoogleMapTest.html
mxml 原始碼:
http://docs.google.com/Doc?docid=0AQb8tm8yloBcZGZ2NnhuNWRfMTgwN2Q5NjlkcWNq&hl=zh_TW
參考教學:
http://code.google.com/intl/zh-TW/apis/maps/documentation/flash/
關鍵字:Marker,Directions,ClientGeocoder
線上DEMO:
http://www.asn.com.tw/flex/GoogleMapTest/GoogleMapTest.html
20110827連結更新…
http://www.vercenter.nknu.edu.tw/flex/GoogleMapTest/GoogleMapTest.html
mxml 原始碼:
http://docs.google.com/Doc?docid=0AQb8tm8yloBcZGZ2NnhuNWRfMTgwN2Q5NjlkcWNq&hl=zh_TW
參考教學:
http://code.google.com/intl/zh-TW/apis/maps/documentation/flash/
關鍵字:Marker,Directions,ClientGeocoder
2010年4月27日 星期二
2010年3月19日 星期五
FLEX AIR 包裝應用程式 ICON 的問題
在開發 AIR 應用程式後,若要包裝自己的應用程式,並且加上自訂的圖示的話,可以到 project\src\your-app.xml 找到…
<!-- <icon>
<image16x16></image16x16>
<image32x32></image32x32>
<image48x48></image48x48>
<image128x128></image128x128>
</icon> -->
修改成…
<icon>
<image32x32>images/icon.png</image32x32>
</icon>
要注意,若你只有一個 32x32 的 ICON 就只要留下 <image32x32></image32x32> 這行即可,千萬別把其它留空白,否則會包裝失敗還一直查不出原因…錯誤示範如下…
<icon>
<image16x16></image16x16>
<image32x32>images/icon.png</image32x32>
<image48x48></image48x48>
<image128x128></image128x128>
</icon>
<!-- <icon>
<image16x16></image16x16>
<image32x32></image32x32>
<image48x48></image48x48>
<image128x128></image128x128>
</icon> -->
修改成…
<icon>
<image32x32>images/icon.png</image32x32>
</icon>
要注意,若你只有一個 32x32 的 ICON 就只要留下 <image32x32></image32x32> 這行即可,千萬別把其它留空白,否則會包裝失敗還一直查不出原因…錯誤示範如下…
<icon>
<image16x16></image16x16>
<image32x32>images/icon.png</image32x32>
<image48x48></image48x48>
<image128x128></image128x128>
</icon>
FMS串流撥放FLV(或RTMP)時截取其BITMAP的方式
在透過 FMS 撥放 rtmp 串流影音時,若你的 CLIENT 端除了撥放,還要抓圖作處理的話,會遇到如下的例外…
SecurityError: Error #2123: Security sandbox violation:
BitmapData.draw: file:///xxx/xxx/xxx.swf
cannot access rtmp://xxx.xxx.xxx/live. No policy files granted access.
解決方式如下…
1. COPY 安裝範例 C:\Program Files\Adobe\Flash Media Server 3.5\samples\applications\vod 到你自己的應用程式。(有興趣可以研究看看其寫法)
2. 修改 Application.xml 檔,在 <client></client> 區間加入…
<Access>
<VideoSampleAccess enabled="true">/</VideoSampleAccess>
</Access>
3. 修改 main.asc (即 Server-side-code)…
找到 application.onConnect = function( p_client, p_autoSenseBW )
這邊是用來處理當有 client 連到這個 server app 時的對應函式,幾個相關參數設定如下…
writeAccess:
若你有用到 shared object 或 live streams,就把它註解掉
//p_client.writeAccess = ""; // prevents creating shared object or live streams.
audioSampleAccess:
允許 client side 直接抓取音效 raw data,利用 SoundMixer.computeSpectrum() 處理音效
p_client.audioSampleAccess = "/";
audioSampleAccess:
允許 client side 直接抓取影片 raw data,利用 BitmapData.draw() 抓圖
p_client.videoSampleAccess = "/";
參考這篇: http://www.thebluepipe.com/Developer/tutorials/as3/Crossdomain-Video-Snapshot-Fixing-BitmapData-draw-Security-Sandbox-Violation.html
SecurityError: Error #2123: Security sandbox violation:
BitmapData.draw: file:///xxx/xxx/xxx.swf
cannot access rtmp://xxx.xxx.xxx/live. No policy files granted access.
解決方式如下…
1. COPY 安裝範例 C:\Program Files\Adobe\Flash Media Server 3.5\samples\applications\vod 到你自己的應用程式。(有興趣可以研究看看其寫法)
2. 修改 Application.xml 檔,在 <client></client> 區間加入…
<Access>
<VideoSampleAccess enabled="true">/</VideoSampleAccess>
</Access>
3. 修改 main.asc (即 Server-side-code)…
找到 application.onConnect = function( p_client, p_autoSenseBW )
這邊是用來處理當有 client 連到這個 server app 時的對應函式,幾個相關參數設定如下…
writeAccess:
若你有用到 shared object 或 live streams,就把它註解掉
//p_client.writeAccess = ""; // prevents creating shared object or live streams.
audioSampleAccess:
允許 client side 直接抓取音效 raw data,利用 SoundMixer.computeSpectrum() 處理音效
p_client.audioSampleAccess = "/";
audioSampleAccess:
允許 client side 直接抓取影片 raw data,利用 BitmapData.draw() 抓圖
p_client.videoSampleAccess = "/";
參考這篇: http://www.thebluepipe.com/Developer/tutorials/as3/Crossdomain-Video-Snapshot-Fixing-BitmapData-draw-Security-Sandbox-Violation.html
訂閱:
文章 (Atom)
VirtualBox 空間減肥
@windows vm sdelete64 -z c: @macos VBoxManage modifymedium disk "/Users/fellow/VirtualBox VMs/Win10/Win10.vdi" --compact *.vdi...
-
ARis... ARis 是日本一間公司出品的產品,應用了 ARToolKit 技術。 展示影片在這… http://www.youtube.com/watch?v=yCCx7zANsGE YouTube上可以找到更多類似的影片。 這邊是我用 FLARToolK...
-
install… sudo apt-get install bluez sudo hciconfig hci0 up scan… sudo hcitool lescan or scan if no response... sudo bluetoothctl ...
-
由於ASSEMBLA即將開始收費,因此要把所有的SVN進行大搬家,連帶的一些教學文件也跟著搬家了,看來還是GOOGLE的窩最舒適(重點是免費) FPPA實驗平台教學教材-使用C語言 FPPA實驗平台簡介 實驗(一) 8位元LED輸出單元 與 模組設計總論 實驗(二) 按鍵開關輸入...