Android development specification

Android development specification

Official Specification

地址: https://source.android.com/source/code-style

Replenish

  1. NDK development: The method name of the native method starts with "native", and follows the small camel case nomenclature, and does not contain '_' in the name.

    For example, the following example is from Bitmap.java:

    private static native Bitmap nativeCreateFromParcel(Parcel p);

    CanvasThere are two ways at the same time, which are confusing :

    private native void native_drawBitmap(long nativeCanvas,
    Bitmap bitmap,
            float srcLeft, float srcTop, float srcRight, float srcBottom,
            float dstLeft, float dstTop, float dstRight, float dstBottom,
            long nativePaintOrZero, int screenDensity, int bitmapDensity);
    private static native void native_drawBitmap(long nativeCanvas, int[] colors,
                                                int offset, int stride, float x,
                                                 float y, int width, int height,
                                                 boolean hasAlpha,
                                                 long nativePaintOrZero);
  2. nativeThe methods all use privatemodifiers by using java method calls.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324771085&siteId=291194637