lgxqf  
日历

导航

 

2010年1月20日

public class HowToUseArray {
    
public static void main(String[] args)
    {

        //Correct usage 

 

        int [] ary;
        
        
int [] aryA = {1,2};
        
        
int [] aryB = new int[2];
        aryB[
0= 1;
        aryB[
1= 2;
        
        
int [] aryC = new int[]{1,2};
        
        
//Wrong usage
        
        
//int [] aryD = new int[2]{1,2};
     //
Cannot define dimension expressions when an array initializer is provided

        
//int aryE[4];
    }
}
posted @ 2010-01-20 23:32 Justin_Ma 阅读(56) 评论(0) 编辑
 
Extract Google's Android file system image from Android 1.5 SDK release

     Info of busybox http://www.loveandroid.com/viewthread.php?tid=53

     Download busybox http://benno.id.au/android/busybox

 

1.Uncompress ramdisk img.
    $cd ./Android/tools/lib/images/ramdisk.img
    $ gzip -cd ramdisk.img > ramdisk
    $ cpio -iv -F ramdisk
2.Open the emulator
    $ ./emulator &
3.Enter into Android shell and remount rootfs .
    (Since rootfs is mounted as read only, you need to remount.)
    $ ./adb shell
    # mount -o remount,rw rootfs /
    # mkdir /tmp
4.Push busybox in the tmp folder
    $ ./adb push busybox /tmp
5.Open a Android shell command window
    $ ./adb shell
    # chmod 555 /tmp/busybox
6. Create the tarball for /system and /data:
    # /busybox tar system 2. Open the emulator
    # ./busybox tar cvf /tmp/data.tar /data
    # ./busybox tar cvf /tmp/dev.tar /dev
7.Pull the tarball file from the Google Android
    $ ./adb pull /tmp/system.tar .
    $ ./adb pull /tmp/data.tar .
    $ ./adb pull /tmp/dev.
8.Get boot log of the emulator
    # mkdir /tmp
    # /system/bin/dumpstate
    # exit
    $ ./adb pull /tmp/state state.log
    $ more state.log
posted @ 2010-01-20 10:28 Justin_Ma 阅读(134) 评论(0) 编辑
 

 

Android 通过Uri来定义资源的位置。


Content Proivder
    它是不同应用程序间共享数据的唯一方法。
    Content Provider通过URI来查询表中的数据。每个表都必须有一列为_Id
    Content Provider资源的标准URI结构:
        <standard_prefix>://<authority>/<data_path>/<id>
        所有的providers的standard_prefix都是content
        例如:
        1) 取得浏览器所有“书签”信息: content://browser/bookmarks
        2) 取得系统通讯录中的信息: content://contacts/people (如果取得某一个特定通讯记录,在路径URI的末端指定一个ID号:content://contacts/people/5)
        
        Android提供的Content Providers列表 D:/Linux/Adnroid%20Tools/android-sdk-windows-1.5_r3/docs/reference/android/provider/package-summary.html
    
Intent 显示调用
    process内部 intent显示调用
        一个process中的activity需要相互访问时,可以用intent的显示调用完成相应操作
        Intent intent = new Intent(this, TestActivity.class);
        startActivity(intent);
        在manifest中声明指定加入新的acivity标签,并指定其所用的Java class是TestActivity.class
        <activity android:name=".ShowMeActivity" />
    process外部 intent显示调用
        需指写包名和class的名称
        Intent intent = new Intent();
        intent.setClassName("com.tope.samples.intent.simple", "com.tope.samples.intent.simple.TestActivity");
        第一个参数为包名,第二个参数为包内的acivity所对应的class的名称
        
指定process中的启动activity
    当一个process中有多个activity时,manifest.xml中包含下面内容的acvitity为process时启动时调用的activity
    详细阅读SDK中关于activtion name部分的内容 会对.HelloActivity前面的"."做详细解释
    <activity android:name=".HellowActivity" android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

显示当前系统定义的permission
    adb shell pm list permissions

Intent中的action的值与其它activity中定义的intent-filter中的 action的name 是相对应的。
    若Activity A中的intent filter定义如下:
        <intent-filter>
            <action android:name="com.irdeto.test" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    若想在Activity B中启动 Activity A 那么它需要在intent的action传入com.irdeto.test
        Intent intent = new Intent("com.irdeto.test");
        StartActivity(intent);
posted @ 2010-01-20 09:58 Justin_Ma 阅读(117) 评论(0) 编辑
 
Copyright © Justin_Ma Powered by: 博客园 模板提供:沪江博客