▶ Android Studio 의 디폴트 셋팅 되어 있는 단축키 목록

DescriptionWindows/LinuxMac
General
Save allControl + SCommand + S
SynchronizeControl + Alt + YCommand + Option + Y
Maximize/minimize editorControl + Shift + F12Control + Command + F12
Add to favoritesAlt + Shift + FOption + Shift + F
Inspect current file with current profileAlt + Shift + IOption + Shift + I
Quick switch schemeControl + ` (backquote)Control + ` (backquote)
Open settings dialogueControl + Alt + SCommand + , (comma)
Open project structure dialogControl + Alt + Shift + SCommand + ; (semicolon)
Switch between tabs and tool windowControl + TabControl + Tab
Navigating and Searching Within Studio
Search everything (including code and menus)Press Shift twicePress Shift twice
FindControl + FCommand + F
Find nextF3Command + G
Find previousShift + F3Command + Shift + G
ReplaceControl + RCommand + R
Find actionControl + Shift + ACommand + Shift + A
Search by symbol nameControl + Alt + Shift + NCommand + Option + O
Find classControl + NCommand + O
Find file (instead of class)Control + Shift + NCommand + Shift + O
Find in pathControl + Shift + FCommand + Shift + F
Open file structure pop-upControl + F12Command + F12
Navigate between open editor tabsAlt + Right/Left ArrowControl + Right/Left Arrow
Jump to sourceF4 / Control + EnterF4 / Command + Down Arrow
Open current editor tab in new windowShift + F4Shift + F4
Recently opened files pop-upControl + ECommand + E
Recently edited files pop-upControl + Shift + ECommand + Shift + E
Go to last edit locationControl + Shift + BackspaceCommand + Shift + Backspace
Close active editor tabControl + F4Command + W
Return to editor window from a tool windowEscEsc
Hide active or last active tool windowShift + EscShift + Esc
Go to lineControl + GCommand + L
Open type hierarchyControl + HControl + H
Open method hierarchyControl + Shift + HCommand + Shift + H
Open call hierarchyControl + Alt + HControl + Option + H
Writing Code
Generate code (getters, setters, constructors, hashCode/equals, toString, new file, new class)Alt + InsertCommand + N
Override methodsControl + OControl + O
Implement methodsControl + IControl + I
Surround with (if...else / try...catch / etc.)Control + Alt + TCommand + Option + T
Delete line at caretControl + YCommand + Backspace
Collapse/expand current code blockControl + minus/plusCommand + minus/plus
Collapse/expand all code blocksControl + Shift + minus/plusCommand + Shift + minus/plus
Duplicate current line or selectionControl + DCommand + D
Basic code completionControl + SpaceControl + Space
Smart code completion (filters the list of methods and variables by expected type)Control + Shift + SpaceControl + Shift + Space
Complete statementControl + Shift + EnterCommand + Shift + Enter
Quick documentation lookupControl + QControl + J
Show parameters for selected methodControl + PCommand + P
Go to declaration (directly)Control + B or Control + ClickCommand + B or Command + Click
Go to implementationsControl + Alt + BCommand + Alt + B
Go to super-method/super-classControl + UCommand + U
Open quick definition lookupControl + Shift + ICommand + Y
Toggle project tool window visibilityAlt + 1Command + 1
Toggle bookmarkF11F3
Toggle bookmark with mnemonicControl + F11Option + F3
Comment/uncomment with line commentControl + /Command + /
Comment/uncomment with block commentControl + Shift + /Command + Shift + /
Select successively increasing code blocksControl + WOption + Up
Decrease current selection to previous stateControl + Shift + WOption + Down
Move to code block startControl + [Option + Command + [
Move to code block endControl + ]Option + Command + ]
Select to the code block startControl + Shift + [Option + Command + Shift + [
Select to the code block endControl + Shift + ]Option + Command + Shift + ]
Delete to end of wordControl + DeleteOption + Delete
Delete to start of wordControl + BackspaceOption + Backspace
Optimize importsControl + Alt + OControl + Option + O
Project quick fix (show intention actions and quick fixes)Alt + EnterOption + Enter
Reformat codeControl + Alt + LCommand + Option + L
Auto-indent linesControl + Alt + IControl + Option + I
Indent/unindent linesTab/Shift + TabTab/Shift + Tab
Smart line joinControl + Shift + JControl + Shift + J
Smart line splitControl + EnterCommand + Enter
Start new lineShift + EnterShift + Enter
Next/previous highlighted errorF2 / Shift + F2F2 / Shift + F2
Build and Run
BuildControl + F9Command + F9
Build and runShift + F10Control + R
Debugging
DebugShift + F9Control + D
Step overF8F8
Step intoF7F7
Smart step intoShift + F7Shift + F7
Step outShift + F8Shift + F8
Run to cursorAlt + F9Option + F9
Evaluate expressionAlt + F8Option + F8
Resume programF9Command + Option + R
Toggle breakpointControl + F8Command + F8
View breakpointsControl + Shift + F8Command + Shift + F8
Refactoring
CopyF5F5
MoveF6F6
Safe deleteAlt + DeleteCommand + Delete
RenameShift + F6Shift + F6
Change signatureControl + F6Command + F6
InlineControl + Alt + NCommand + Option + N
Extract methodControl + Alt + MCommand + Option + M
Extract variableControl + Alt + VCommand + Option + V
Extract fieldControl + Alt + FCommand + Option + F
Extract constantControl + Alt + CCommand + Option + C
Extract parameterControl + Alt + PCommand + Option + P
Version Control / Local History
Commit project to VCSControl + KCommand + K
Update project from VCSControl + TCommand + T
View recent changesAlt + Shift + COption + Shift + C
Open VCS popupAlt + ` (backquote)Control + V



▶ 단축키 변경은 아래와 같은 방법으로 진행 하면 된다.

File > Settings > Keymap (on Windows)

File > Properties > Keymap (on Mac)


 



▶ eclipse 에 익숙한 경우 Keymap 을 eclipse 로 선택 적용 하면 된다 

 



원하는 Keymap 을 선택 한 후 추가적으로 원하는 단축키 설정을 하면 끝


※ 단축키 표 출처 : 

https://developer.android.com/studio/intro/keyboard-shortcuts.html#custom

블로그 이미지

쉬운코딩이최고

Android, Java, jsp, Linux 등의 프로그래밍 언어를 소개 합니다.

,

안드로이드 마시멜로 이상 단말에서는 앱을 사용하기 전, 해당앱에서 사용 하는 기능들에 대한 사용자의 승인을 받아야 한다. 


만약 앱에서 사용하는 기능들이 여러가지 있으나 그중 한가지 이상의 사용자 승인을 받지 않거나 사용자가 승인 거부를 했을 경우 해당 기능을 사용하려 할 경우 오류 발생으로 인한 강제 종료 현상이 발생 할 수도 있다. 물론, 승인 거부를 한 경우 해당 기능을 앱 내부에서 사용하지 못하도록 막을 경우 오류로 인한 강제 종료 현상이 발생 하지 않는다.


그러므로 앱에서 사용 하고자 하는 모든 권한에 대한 정의 및 사용자에게 해당 기능의 사용 승인을 꼭 받아야 한다. 






사용방법


1. AndroidManifest.xml 에 아래와 같은 uses-permission 설정

<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.CAMERA" />


2. 퍼미션 요청

private void requestPermissions(){
if (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {
if (ActivityCompat.shouldShowRequestPermissionRationale(MainActivity.this, Manifest.permission.READ_CONTACTS)) {

} else {
ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.READ_PHONE_STATE}, MY_PERMISSIONS_REQUEST_READ_PHONE_STATE);
}
}

if (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.RECEIVE_SMS) != PackageManager.PERMISSION_GRANTED) {
if (ActivityCompat.shouldShowRequestPermissionRationale(MainActivity.this, Manifest.permission.RECEIVE_SMS)) {

} else {
ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.RECEIVE_SMS}, MY_PERMISSIONS_REQUEST_PROCESS_RECEIVE_SMS);
}
}

if (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
if (ActivityCompat.shouldShowRequestPermissionRationale(MainActivity.this, Manifest.permission.CAMERA)) {

} else {
ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.CAMERA}, MY_PERMISSIONS_REQUEST_PROCESS_CAMERA);
}
}

}


3. 요청한 퍼미션의 결과 처리 (onRequestPermissionResult 호출)

@Override
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
switch (requestCode) {
case MY_PERMISSIONS_REQUEST_READ_PHONE_STATE: {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
requestPermissions();
} else {
// 이 퍼미션과 관련된 기능 사용하지 못하도록 처리 (그렇지 않을 경우 강제 종료 현상 발생)
}
return;
}
case MY_PERMISSIONS_REQUEST_PROCESS_RECEIVE_SMS: {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
requestPermissions();
} else {
// 이 퍼미션과 관련된 기능 사용하지 못하도록 처리 (그렇지 않을 경우 강제 종료 현상 발생)
}
return;
}
case MY_PERMISSIONS_REQUEST_PROCESS_CAMERA: {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
requestPermissions();
} else {
// 이 퍼미션과 관련된 기능 사용하지 못하도록 처리 (그렇지 않을 경우 강제 종료 현상 발생)
}
return;
}
}
}



위와 같이 처리 하는 방식도 있지만 그렇지 않고 permission 들을 array 에 담아서 처리 하는 방식도 있다. 


Runtime Permission 관련하여 아래 링크에서 자세히 설명하고 있다.

https://inthecheesefactory.com/blog/things-you-need-to-know-about-android-m-permission-developer-edition/en


블로그 이미지

쉬운코딩이최고

Android, Java, jsp, Linux 등의 프로그래밍 언어를 소개 합니다.

,