Android Studio(Intellij)提供了一个选项,而不是在注释中使用它时导入类(如下所示):
package com.mypackage;
import android.content.Intent;
/**
* List all request codes used in our app.
* Ex: the request code used to call
* {@link android.app.Activity#startActivityForResult(Intent, int)}
*/
public final class RequestCodes {
public static final int UNDEFINED = 110;
public static final int ACTIVITY_REQUEST_OPEN_ACCOUNT = 21;
public static final int AUTOCOMPLETE = 12;
public static final int BARCODE = 13;
public static final int CAPTURE_CAMERA_REQUEST = 14;
public static final int DISPLAY_TEXT = 5;
public static final int GET_PICTURE_FROM_CAMERA = 16;
public static final int GET_PICTURE_FROM_GALLERY = 17;
public static final int GOOGLE_SIGN_IN_REQUEST_CODE = 18;
public static final int IMAGE_SELECTION = 19;
public static final int MAP_REQUEST = 110;
public static final int SELECT_PHOTO = 111;
public static final int RUNTIME_PERMISSION = 121;
}
在注释中使用限定类名(如下所示):
package com.mypackage;
/**
* List all request codes used in our app.
* Ex: the request code used to call
* {@link android.app.Activity#startActivityForResult(android.content.Intent, int)}
*/
public final class RequestCodes {
.... same as previous
}
评论中是否存在使用android.content.Intent
选项代替import
类的评论?