2010年2月11日 星期四

功率量測步驟





























































2010年2月9日 星期二

Android Activity Life Cycle Demo



public class LifeCycleTest extends Activity {
    private static final String TAG = "ActivityLifeTest";

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Log.v(TAG, "onCreate");
        
        Uri uri = Uri.parse("http://maps.google.com/maps?f=d&saddr=startLat%20startLng&daddr=endLat%20endLng&hl=en");  
        Intent it = new Intent(Intent.ACTION_VIEW, uri);  
        startActivity(it);  
    }

    public void onStart() {
        super.onStart();
        Log.v(TAG, "onStart");
    }

    public void onResume() {
        super.onResume();
        Log.v(TAG, "onResume");
    }

    public void onPause() {
        super.onPause();
        Log.v(TAG, "onPause");
    }

    public void onStop() {
        super.onStop();
        Log.v(TAG, "onStop");
    }

    public void onRestart() {
        super.onRestart();
        Log.v(TAG, "onReStart");
    }

    public void onDestroy() {
        super.onDestroy();
        Log.v(TAG, "onDestroy");
    }
}








First, new a project with Google APIs.
Then, Run it.



We can see that Log:ActivityLifeTest is onPause now. It means the Intent start another Activity.
If we press “BACK”, Activity:LifeCycleTest will resume again.


Now, restart the Activity, and press “Maps”.



We can find out that Activity:LifeCycleTest  is stopped. It means Activity:LifeCycleTest  is no longer visible.

Finally, press “BACK” to the Activity:LifeCycleTest, and Activity:LifeCycleTest will restart.





If we leave the Activity:LifeCycleTest, Activity:LifeCycleTest will be destroyed.





Reference:
http://stenlyho.blogspot.com/search/label/Android
http://code.google.com/p/androidbmi/wiki/LifeCycle
http://developer.android.com/intl/zh-TW/guide/topics/fundamentals.html
üW





üWe

2010年2月4日 星期四

Run linux kernel on PXA270



After the connection between host and hardware devices, we install the driver so that we can use host's COM to connect the device.
go http://www.squarechair.net/arkmicro/ first,
then go to http://www.cpu.com.tw/kh/comp/usb/usb4.html download drivers.
Install both, and you can see one more COM at 裝置管理員 




We need shared folders between Windows and VirtualBox.

Fisrt,
    Turn on the Virtual Box.








Right click at the red block of following picture.





Logout and login
Then type sudo mount.vboxsf "windows shared folder name" "linux shared folder path"




Copy file to the shared folders.
    \critical\research_Embedded\Creator PXA270 v107\Linux\bin\arm-linux-toolchain-bin.4.0.2.tar.gz
    \critical\research_Embedded\Creator PXA270 v107\Linux\src\linux-2.6.15.3-creator-pxa270.patch
    \critical\research_Embedded\Creator PXA270 v107\Linux\src\mt-linux-2.6.15.3.tar.gz


look at linux..






Then we need install tool chain first.
PDF at \critical\research_Embedded\Creator PXA270 v107\Linux\Doc
                       \Linux for Creator-XScale-PXA270 User Guide.pdf
see chapter 2-1-3
Turn on the Linux Terminal
Type:
    $cp /arm-linux-toolchain-bin.4.0.2.tar.gz /
    $cd /
    $tar -zxvf arm-linux-toolchain-bin.4.0.2.tar.gz


    $vim /etc/bash.bashrc


Add the following text at the end of bash.bashrc
    PATH=/opt/microtime/pro/devkit/arm/pxa270/gcc-4.0.2-glibc-2.3.3/arm-unknown-linux-gnu/bin:$PATH
    export PATH

Turn off the terminal, and restart it.
Test by typing arm- [tab] [tab]
you will see 


Now, install Creator-XSale-PXA270 kernel source and file patch
see the Linux for Creator-XScale-PXA270 User Guide.pdf chapter 3
We can ignore 3-2-2: set root filesystem.

Turn on 超級終端機 on windows.








Turn on the PXA270.











set pxa270 ip and server(windows) ip.(at 超級終端機)
    $setenv ipaddr xxx.xxx.xxx.www
    $setenv serverip yyy.yyy.yyy.zzz
note: xxx.xxx.xxx must be the same as yyy.yyy.yyy
    $saveenv

We need tftp to push uImage in pxa270.
So, download tftp server at http://tftpd32.jounin.net/
and we put uImage at tftp shared folder.
note: uImage at linux /usr/src/microtime/build-linux/output/flash_boot/uImage








Type command at 超級終端機:
    $tftp 0xa1000000 uImage
    $bootm 0xa1000000


Done!
Result:






Reference:

2010年2月3日 星期三

JBox2D Demo on Eclipse



  • In Eclipse: 
  • Open New->Java project->create project from existing source
  • Type project name and browse the file which is extracted from Pendulum_src.zip => finish
  • Create a folder /lib/ at project
  • Right Click on /lib, select Import 
  • Select General / File System 
  • Choose the directory of 
  • Import the file jbox2d.jar 
  • Right click on the project and select "Properties" 
  • Click on "Java Build Path" and select the "Libraries" tab 
  • Click on "Add JARs..." and pick the file



After some sets.
result: