`

一些随意想到的乱写

阅读更多

1、一些用于被回调的方法,应该声明成 public 的,以免注册了以后,自己的框架没有调用 到。如:cocos2d中: CCCallFunc callBack = CCCallFunc.action(this, "repeatForever"); shitiSprite.runAction(CCSequence.actions(CCSpawn.actions(actionBy2,move2),callBack)); public void repeatForever(){ shitiSprite.runAction(CCRepeatForever.action(CCScaleTo.action(1f,1.5f))); }


2.java中四种访问权限:public,protected,default(不写),private。四中访问权限一次减小。 protected 是同包及子类可以访问,default 是同包中才可以访问。 但是sdk中protected 属性却不可以访问(有待于研究),方法却是可以访问的。 内部类有四种:成员内部类,静态内部类,局部内部类,匿名内部类;成员内部类访问可以访问类中的private属性变量,访问方法:类名.this.属性名


3.AlarmService_Service.this.stopSelf(); 服务停止的方法。

 

4. 注册内部类 :

     <activity android:name=".app.DeviceAdminSample$Controller"

                android:label="@string/activity_sample_device_admin">

            <intent-filter>

                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.SAMPLE_CODE" />

            </intent-filter>

      </activity>

 

5. List  dialog :


    case DIALOG_LIST:

            return new AlertDialog.Builder(AlertDialogSamples.this)

                .setTitle(R.string.select_dialog)

                .setItems(R.array.select_dialog_items, new DialogInterface.OnClickListener() {

                    public void onClick(DialogInterface dialog, int which) {


                        /* User clicked so do some stuff */

                        String[] items = getResources().getStringArray(R.array.select_dialog_items);

                        new AlertDialog.Builder(AlertDialogSamples.this)

                                .setMessage("You selected: " + which + " , " + items[which])

                                .show();

                    }

                })

                .create();

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics