Create a new android project
Steps to follow:
Open the android Studio
Select File -> New -> Android Application Project.
The Android Application window is opened .Once opened fill the following details
1. Application name (Unique name )
2. Project Name
3. Package Name (Unique name )
Once completed the details do all the check mark like , class name and project location then press the next button bottom of the android application window
Then activity window opened name it whatever (As per java Standard).
MainActivity[MainActivity.class]
package com.androidfeeders.activitylifecycle;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
public class MainActivity extends AppCompatActivity {
public static final String TAG=MainActivity.class.getSimpleName();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// log message to see in android monitor
Log.d(TAG,"onCreate method");
}
@Override
protected void onResume() {
super.onResume();
Log.d(TAG,"onResume method");
}
@Override
protected void onPause() {
super.onPause();
Log.d(TAG,"onPause method");
}
@Override
protected void onStop() {
super.onStop();
Log.d(TAG,"onSTop method");
}
@Override
protected void onRestart() {
super.onRestart();
Log.d(TAG,"onRestart method");
}
@Override
protected void onDestroy() {
super.onDestroy();
Log.d(TAG,"onDestroy method");
}
}
Gradle Scripts~build.gradle[Module:app]
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.androidfeeders.activitylifecycle"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
Gradle Scripts~build.gradle[Project:AndroidstudioSampleCode]
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Resource[strings.xml]
<resources>
<string name="app_name">ActivityLifeCycle</string>
</resources>
manifests
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.androidfeeders.activitylifecycle">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".ActivityLifeCycle">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I started to learn android and Kotlin and iOS and Hybrid application and i cant code IOS very well. But i love more interesting to code and finding new developer minds who are join to me You're welcome to keep on using my website.Instead, you can join our FB page for developer comments and post there: https://www.facebook.com/ramasamy.m.779 Best wishes :) Ramasamy(Software Developer)
See what's new in Android & IOS & Hybrid development … explore and learn in site
Ramasamy
5 min agoKotlin and React native example too
ReplyRamasamy
5 min agoKotlin and React native example too
ReplyRamasamy
5 min agoKotlin and React native example too
Reply