[Intel] 15주차 회고록

LHW·2023년 10월 27일
0

Intel교육과정

목록 보기
14/15

Intel AI for Future Workforce 15주차 회고록

14주차는 데이터베이스를 진행했다고 들었는데 예비군으로 인해서 참석하지 못했다.. 슬퍼.. 😭

📱Android Studio

이번주의 시작은 안드로이드 스튜디오를 활용한 어플 개발로 시작했다. 함께 사용하는 언어로는 Kotlin이 아니라 Java로 진행했다. 국내 개발 시장에서 Java가 폭넓게 쓰이고 있다는 이유로 .. !

프로젝트 만들기

이번주는 아무런 레이아웃이 들어있지 않은 프로젝트를 생성해서 진행했다. 요소 하나하나 어떤 기능들을 하는지, 어떤 방식으로 사용하는지 직접 구성해보면서 어느정도 좀 익숙해진 상태다.

Minimum SDK version은 API 29로 설정했고, Kotlin이 아닌 Java로 생성했다.

activity_main.xml

안드로이드 스튜디오의 경우 MarkUpLanguage로 xml을 사용했다. html과 비슷한 결이지만 용법이 좀 달랐던 것을 확인할 수 있었다.

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

<!-- 이하 생략 -->

이 activity_main.xml은 메인 Activity의 UI를 구성하는 부분에 해당된다. 직접 배치하는 텍스트, 버튼 등등의 요소들이 자동으로 xml파일에 작성되는 방식으로 구성되는 듯 했다.

MainActivity.java

UI에 배치된 여러 요소들에 Event를 발생시키는 메소드를 Java로 정의하는 파일이다.

package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}

기본적으로 구성되는 요소들은 위와 같으며, AppCompatActivity를 상속받아 구현되어있다. onCreate의 경우에는 AppCompatActivity의 메소드를 Overriding해서, activity_main.xml UI가 띄워질 때 행할 행동들을 안에 정의할 수 있었다.

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        Intent fromMain = getIntent();
        quizType = fromMain.getStringExtra("quizType");
        
        TextView nextBtn = findViewById(R.id.nextBtn);
        LinearLayout hintArea = findViewById(R.id.hintArea);
        TextView hintText1 = findViewById(R.id.hintText3);
        TextView hintText2 = findViewById(R.id.hintText2);
        TextView hintText3 = findViewById(R.id.hintText1);
        TextView question1 = findViewById(R.id.question1);
        ImageButton imgBtn = findViewById(R.id.question1Play);
		
        // 모두 숨기기
        hintArea.setVisibility(View.INVISIBLE);
        nextBtn.setVisibility(View.INVISIBLE);
        hintText1.setVisibility(View.INVISIBLE);
        hintText2.setVisibility(View.INVISIBLE);
        hintText3.setVisibility(View.INVISIBLE);
}

이런식으로 레이아웃이 구성될 때 바로 행하게 될 동작들을 설정할 수 있었다.

etc.

이외에도 사용해본 것이 많았다.

  • Spinner
  • RadioGroup, RadioButton
  • string value xml file
  • string-array value xml file
  • MediaPlayer
  • CheckBox
  • Intent

등등 다양한 요소들을 추가해서 간단한 퀴즈 프로그램을 생성해보았다.

코드는 https://github.com/LeeHeonWoo1/AndroidStudio/tree/master/MusicQuiz/app/src/main 에서 확인할 수 있다.

마무리

아마 앱도 마무리하는 단계에서 DB와 연결해서 뭔가를 진행하는 것 같은데 예비군때문에 그냥 아예 못들었던 탓에 슬슬 불안하다. MySQL을 사용해보면서 대강적인 지식이나 쿼리문만 알고 있지 사실상 거의 다 까먹은 수준이기에 새로 복습을 하면서 ORACLE도 익혀야할 듯 하다.

profile
하루가 다르게 성장하기

0개의 댓글