본문 바로가기

안드로이드스튜디오4

Android Studio , 리소스 & values 파일 Resource res 파일 : 리소스 파일 이미지를 플러그인을 통해 해상도 별로 변환 돋보기 - plugins - drawable importer 설치 / 사진 복사 -> drawable 에 붙이기 가능 drawable 파일에 넣기 : drawable 폴더 (마우스 오른쪽 – New – Batch Drawable Import 사용) 여백 관리 : scaletype = “fitXY” (내용 중요) , “centerCrop”(이미지 비율 중요) l minmap 폴더 : 앱 아이콘 이미지 넣기 res 폴더 우클릭 - path에서 이미지 선택 values 폴더 colors.xml : 색, 색상 Key 입력 – 메인 xml 에서 그 Key를 넣는다. @ff0000 , 투명도 포함 #5ff0000 사용 : : a.. 2020. 8. 16.
Android Studio , Service & Intent Service & Forground Service Service 서비스 백그라운드 처리, 쓰레드와 다른 작업할 때 Activity는 화면을 가지고 있어 화면이 보이는 동안 동작 안드로이드 7버전은 서비스 액티비티(어플) 종료시 다시 쓰레드 동작 , 8이후는 종료 New -> serivce //쓰레드 추가 가능 //서비스가 가동될 때 호출되는 메서드 @Override public int onStartCommand(Intent intent, int flags, int startId) { return super.onStartCommand(intent, flags, startId); } //서비스가 중지되면 호출되는 메서드 @Override public void onDestroy() { super.onDestroy(); } serviceIntent = new .. 2020. 8. 5.
Android Studio , 시스템 메시지 : BroadcastReceiver [문자 메시지 읽기] 1. 권한 설정 2. BroadcastReceiver 파일 생성 public class SystemReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { //메니페스트의 인텐트 필터를 intent가 받는다. //안드로이드 os가 리시버를 찾기 위해 사용했던 이름을 추출한다. String action = intent.getAction(); //리시버의 이름으로 분기한다. switch (action) { case "android.intent.action.BOOT_COMPLETED" : Toast.makeText(context,"부팅완료",Toast.LENGTH_SHORT).show.. 2020. 8. 2.
Android Studio , Intent 로 객체 전달하기, Parcelable 세컨드 액티비티로 넘어갈때 인텐트로 값을 넘긴다. public class MainActivity extends AppCompatActivity { TextView text2; final int SECOND_ACTIVITY =1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); text2 = findViewById(R.id.textView); } public void btnClicked(View view) //메인A -> 2A { Intent intent = new Intent(this, SecondActiv.. 2020. 7. 28.