[JAVA] First Android development for busy people

Introduction

This article is a guide for members who have no experience in Android development in the company to create an application that understands the life cycle of Activity, which is the basis of Android, by movement before self-study. Therefore, please note that most of the detailed explanations are omitted. The development machine is assumed to be a Windows 10 machine.

Before you start

Please prepare the development environment. The following three points need to be prepared. --Android Studio (version at the time of writing is 3.4.1)

Android Studio installation

[Here](https://developer.android.com/studio/?gclid=Cj0KCQjwitPnBRCQARIsAA5n84lkUis7r2qTcFHo4UK1m7AyGlIYs7bbP2By1_zZ9hYPioz39oOtmxMaAsSAEALw_wc The latest version is fine.

Android SDK installation

You can open "SDK Manager" from the button on the upper right of Android Studio. image.png

Create Android Emulator

You can open "Android Virtual Device Manager" from the button on the upper right of Android Studio. Please create the OS with Oreo or above. image.png

Other settings

If you are familiar with Eclipse, you may want to select Eclipse from Settings → Keymap. image.png

Create a new project

image.png

Select Empty Activity image.png

Language: Java Minimum API level:API 27 Use androidx. * artifacts: Check image.png

Life cycle confirmation

Implementation

Check the life cycle of Activity and Fragment while actually moving it. Implement to output the log in the callback of each life cycle.

[About the life cycle of Activity](https://developer.android.com/guide/components/activities.html? hl=ja#ImplementingLifecycleCallbacks)

MainActivity.java


public class MainActivity extends AppCompatActivity {

    private static final String TAG = "MainActivity";

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

        Log.i(TAG, "onCreate");
    }

    @Override
    protected void onRestart() {
        super.onRestart();

        Log.i(TAG, "onRestart");
    }

    @Override
    protected void onStart() {
        super.onStart();

        Log.i(TAG, "onStart");
    }

    @Override
    protected void onResume() {
        super.onResume();

        Log.i(TAG, "onResume");
    }

    @Override
    protected void onPause() {
        super.onPause();

        Log.i(TAG, "onPause");
    }

    @Override
    protected void onStop() {
        super.onStop();

        Log.i(TAG, "onStop");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();

        Log.i(TAG, "onDestroy");
    }
}

Run

When you press the execute button, a list of execution destination devices will appear, so select the device and press OK.

image.png

When the app starts, let's check the timing when the callback is called in the Logcat console of Android Studio. At this time, it will be easier to see if the log level to be displayed is set to Info or higher. image.png

NEXT STEP Next, we will create the UI. First Android UI creation for busy people (In addition, Data Binding experience)

Recommended Posts

First Android development for busy people
First Android development UI creation for busy people (In addition, Data Binding experience)
Android Studio development for the first time (for beginners)
Library collection useful for Android development
Notes for Android application development beginners
Learning guidelines for Android development for iOS engineers
Preparation for Android development of POCOPHONE f1
Android Development App_Preparation
Minimal template code for Android development, RecyclerView implementation
Android development link summary
Android application development preparation 7/15
Android development reference site
Beginner-friendly Android app publishing procedure, struggling for the first release⁈
iOS engineer starts Android development
Android app personal development kickoff
ROS app development on Android
default value for android: exported
Android development ~ Screen transition (intent) ~
First Java development in Eclipse
Build Spring for Android 2.0.0 environment
NoCode Glide's first app development
Introduction to Android App Development 1 Installing JDK and Android Studio for mac