모바일

모바일/android

[안드로이드프로그래밍6판] 명시적 인텐트 개념과 예제

1. 명시적 인텐트 1) 형태 Intent intent = new Intent(MainActivity.this, SecondActivity.class); intent.putExtra("Name", etName.getText().toString()); startActivity(intent); Intent intent = getIntent(); tvName.setText("메인에서 읽어들인 이름 = " + intent.getStringExtra("Name")); 2) 특징 - .java - 메인과 또 다른 창 필요(xml도 2개) - AndroidMainfest.xml 에 메인 외 Activity 넣어줘야 함 더보기 2. 예제 실행 화면 메인 세컨드 - 버튼 누르면 돌아오게 함. 세컨드 창을 끄면 되므로 f..

모바일/android

[안드로이드프로그래밍6판] 그림판 응용

1. 들어가기 전에 1) 개념 - Path 란? 그리기(Draw) 를 할때 사용되는 녀석 중. "덤" 정도로 생각하시면 되겠습니다. 쉽게 말해서 도화지에 우리가 선을 긋는데 그냥 그으면 삐뚤삐뚤 해집니다. 하지만 자를대고 선을 그으면 똑바로 그을수가 있죠. 이때 "자"의 역할을 해주는 녀석을 "Path"라 생각 하시면 되겠습니다. 도화지(Canvas)에 어떤 도형(직선, 곡선, 다각형)을 그리는데 미리 그려진 궤적 정보라고 생각하시면 됩니다. 출처: [초보 플밍지기] https://jwandroid.tistory.com/184 2) 본 문제에서 왜 Path가 필요한가? - : 기존 그림 + @ (x) / 매번 새롭게 그림 (o) - 기존 그림 + @ 를 위해서 '저장할 방법' 필요. >> 터치 이벤트를 ..

모바일/android

[안드로이드프로그래밍6판] 직접 풀어보기 9-1, 9-2, 실습 9-1

참고. 모두 그대로 베꼈으므로 재복습 필요! 1. 직접 풀어보기 1) (기초) 9-1 더보기 package com.cookandroid.myself9_1; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import android.content.Context; import android.content.DialogInterface; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Path; import android.graphics..

모바일/android

[안드로이드프로그래밍6판] (대화 상자) 실습 7-3, 직접 풀어보기 7-3

1. 실습 7-3 실행 화면 초기 대화상자 입력창 확인 눌렀을 때 취소 눌렀을 때 Toast 1) xml 코드(단순하므로 모두 접은 글로 표시) 더보기 더보기 더보기 2) java 코드 package com.cookandroid.practice7_3; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import android.content.DialogInterface; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import andr..

hatch
'모바일' 카테고리의 글 목록 (2 Page)