[Android studio / Java] What you don't understand when you touch it for the first time

Introduction

About 3 weeks ago, I first touched Android studio (Java) (in the position of a code writer). Since all the words I didn't understand, a memorandum of what I looked up (or an article on the net). (To make it easier for you to find it. Not bad ...)

This and that like super basic things (`・ ω ・ ´)

AndroidManifest.xml A very important file. Reference: Notes on AndroidManifest.xml

Activity Controllers provided for smartphone development, such as Activity and ViewConroller, control the "screen".

For example, if there are two screens A and B as an application, in a general implementation,

Activity for screen A(A_Activity)➕ Layout file(A.xml)
Activity for B screen(B_Activity)➕ Layout file(B.xml)

It seems that

Reference: What is the basic “Activity” of Android application creation? (1/2)

Fragment

Fragment represents the behavior and parts of the Activity UI. Fragment must always be embedded in Activity. Therefore, Fragment is like a "sub-activity" that can be reused in Activity. Fragment has its own life cycle, but is directly influenced by the host Activity. Activities can add or remove Fragments.

Source: Fragment Basics

constructor

I'm sleepy, so I'll omit it.

Reference: [Java] What is a constructor? Meaning of this ()

context

[There are two types of context] ①Activity context (Usage: Activity name.this) Depends on the activity life cycle. When the basic activity is destroyed, it is destroyed together, but if a static variable refers to the context, the memory of the context is not released and there is a possibility of a memory leak. ② Application context (Usage: getApplicationContext ()) Application dependent. Stay alive as long as the application is alive. This is the context referenced by the static variables listed above.

Source: [Android] What is context?

findViewById One of the most frequently used methods of Android API

style

A style is a set of properties that specify the appearance and format of a View or window. Reference: Android Official

R class

A class that manages resources. Reference: [Android Studio] "R. ~" in the java source all became an error

resource

Reference: Providing resources Android Studio Document Japanese Translation

Asset

It is necessary to prepare files for each screen density (mdpi, hdpi, xhdpi).

Layout

Reference: Application Layout

Log output

Log.v: VERVOSE (all log information)
Log.d:DEBUG(Debug information)
Log.i:INFO(information)
Log.w:WARN(warning)
Log.e: ERROR (Fatal problem)

Source: How to output log in Android application development [for beginners]

Screen transition

Reference: Transition the screen of the [Android] application

This and that of the contents of the code (`・ ω ・ ´)

extends Function inherited If you want to use it, write ```extends class name` ``.

private and public

Used when the value of a member variable can be stored and referenced only via a method. Member variables prefixed with "private" are Values can only be stored and retrieved within the class in which the member variables are defined. Therefore, it is possible to prevent creating an object in another class and storing the value directly in the member variable like "object name.member variable name = value".

public may or may not be written, but to make it easier to see the program later, to make it clear that you didn't forget to write "private" but wanted to make it "public" In addition, public should be written.

Quote: public and private

If you want to use it, write `private variable type member variable name;`.

I can understand this area somehow. (Perhaps)

static class (inner class)

It seems to be important in the basics. Recognition that if it is static, it can be called without creating an instance. Is the meaning of iOS different from static? ?? ??

Reference: [Java] How to use inner class (inner class) (static class)

Unit "dp"

Density-independent pixels (dp) Per virtual pixel that should be used when defining the UI layout. Used to represent layout dimensions or positions in a density-independent way. Density-independent pixels are equivalent to one physical pixel on a 160 dpi screen. This is the assumed reference density for "medium" density screens. Scaling in dp units is transparently processed, if necessary, based on the actual density of the screen you are using. Converting from dp units to screen pixels is easy (px = dp * (dpi / 160)). For example, on a 240 dpi screen, 1 dp corresponds to 1.5 physical pixels. Whenever you define your app's UI, you should use dp units to ensure that your UI looks good on screens with different densities.

That's right. For beginners, it is recognized as a person who represents the size of an image.

Reference: The mysterious unit "dp" (Density-independent Pixel). Also, the story of drawable in Android Android Official

import Write like this

import android.net.ConnectivityManager;

When I copy and paste a method I picked up on the net, I get an error saying that ~ ~ cannot be imported. Androidstudio, kind.

Override

override. The superclass method is being rewritten in a subclass.

Reference: What is Java @Override

Class structure and package structure (`・ ω ・ ´)

-[Basics for people who do not know the basics of smartphones (Android), such as the relationship between Activity (controller) and layout file (view)](http://hide1024.hatenablog.com/entry/2015/11/23/ 220025) -I thought about the Android package structure

In the first place, a package is a function to organize classes by something like a folder.

package jp.tuyano.myapp;

The above means ``` this class is prepared in the myapp folder in the tuyano folder in the jp folder. In the package, write the hierarchy using dots.

Quote: Super Introduction to Java for Android Development Beginners

This is Git management (`・ ω ・ ´)

build_file_checksums.ser The one that came out as a difference when I dropped the project from git. Is it okay to add it to gitignore? ??

Reference: Do I need to add [.ideit / cache / build_file_checksums.ser to .gitignore? ](https://translate.googleusercontent.com/translate_c?depth=1&hl=ja&prev=search&rurl=translate.google.co.jp&sl=en&sp=nmt4&u=https://stackoverflow.com/questions/49557737/should-i- add-idea-caches-build-file-checksums-ser-to-gitignore & xid = 17259,15700023,15700124,15700149,15700168,15700186,15700191,15700201,15700208 & usg = ALkJrhi4yP-JfmqQa6ldV3i_a5rzGqrR3g) Things not under version control in Android Studio

that's all.

Recommended Posts

[Android studio / Java] What you don't understand when you touch it for the first time
Android Studio development for the first time (for beginners)
Learning memo when learning Java for the first time (personal learning memo)
Impressions and doubts about using java for the first time in Android Studio
A summary of what Java programmers find when reading Kotlin source for the first time
Introduction to java for the first time # 2
Learning for the first time java [Introduction]
Think when Rails (turbolinks) doesn't load the page for the first time
[Android Studio] Set an arbitrary image for the application background [Java]
Spring AOP for the first time
[Android Studio] What to try when you get into error spitting hell
[First Java] Make something that works with Intellij for the time being
The story of releasing the Android app to the Play Store for the first time.
[Socket communication (Java)] Impressions of implementing Socket communication in practice for the first time
Creating an app and deploying it for the first time on heroku
Programming for the first time in my life Java 1st Hello World
What did I prepare for when I entered an Android application development project while developing the Web in Java?
[Promotion of Ruby comprehension (1)] When switching from Java to Ruby, first understand the difference.
I want you to use Scala as Better Java for the time being
I stumbled on the Java version in Android Studio, so I will summarize it
[Android Studio] If you think you can't find the latest Support Library, you can find it.
I tried using Docker for the first time
What surprised the Java shop when writing PHP
Walls hit by Rspec for the first time
What is the volatile modifier for Java variables?
I tried touching Docker for the first time
Use Java external library for the time being
Run Dataflow, Java, streaming for the time being
First touch of the Files class (or Java 8)
How to delete the tweet associated with the user when you delete it at the same time
You don't have to write for twice when you make a right triangle in Java
[For beginners] Quickly understand the basics of Java 8 Lambda
[Android Studio] [Java] How to fix the screen vertically
Oreore certificate https (2020/12/19) for the first time with nginx
What Java engineers need to prepare for the Java 11 release
How to study kotlin for the first time ~ Part 2 ~
How to study kotlin for the first time ~ Part 1 ~
Access Web API on Android with Get and process Json (Java for the time being)
docker What should I do first? (Somehow I understand the shell, but ... for beginners at the level)
Workaround for issues where you are prompted to install the JDK when trying to build from the command line after installing Android Studio