Android App Development for Beginners 1 ~ 34 / 77

.


Android App Development for Beginners – 1 – Introduction

.

Go to Google Java SE(Standard Edition), or go to the link below.

http://www.oracle.com/technetwork/java/javase/downloads/index.html

Click on Java Download, or go to the link below.

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Click on Accept License Agreement and on jdk-8u25-windows-x64.exe to start downloading it.

C:\User\Adrian\Downloads\jdk-8u25-windows-x64.exe

Move jdk-8u25-windows-x64.exe into C:\Program Files\.

C:\Program Files\jdk-8u25-windows-x64.exe

Click on jdk-8u25-windows-x64.exe.

User Account Control (Popup)

Click on Yes to allow the installation of it.

Java SE Development Kit 8 Update 25 (64-bit) – Setup (Popup)

Click on Next and confirm the current location for the installation of it, or click on Change.

C:\Program Files\Java\jdk1.8.0_25\  

Click on Next and check the Status until it is completed.

Java SE Development Kit 8 Update 25 (64-bit) – Progress (Popup)

Java Setup Destination Folder  (Popup)

Confirm the current location for the installation of it, or click on Change.

C:\Program Files\Java\jre1.8.0_25\ 

Click on Next and check the Status until it is completed.

Java SE Development Kit 8 Update 25 (64-bit) – Progress (Popup)

Java Setup – Progress (Popup)  

Java SE Development Kit 8 Update 25 (64-bit) – Complete (Popup)

Go to the Windows’ Advanced system settings to add a new System variable as below.

Start > Control Panel > System  > Advanced > Environment Variables > (System variables)

New Variable name: JAVA_HOME 

Variable value: C:\Program Files\Java\jdk1.8.0_25

.


Android App Development for Beginners – 2 – Installing Android Studio

.

Go to Google Android SDK, or go to the link below.  

http://developer.android.com/sdk/index.html

Click on Download Android Studio for Windows, I have read and on Download Android Studio for Windows.

C:\Users\Adrian\Downloads\android-studio-bundle-135.1641136.exe

Move android-studio-bundle-135.1641136.exe into C:\Program Files\.  

C:\Program Files\android-studio-bundle-135.1641136.exe  

Click on android-studio-bundle-135.1641136.exe.

Open FIle – Security Warning (Popup) 

User Account Control (Popup) 

Android Studio Setup (Popup)  

Confirm Android Studio Installation Location and Android SDK Installation Location. 

C:\Program Files\Android\Android Studio

C:\User\Adrian\AppData\Local\Android\sdk

Go to the Windows to locate Android Studio and create a shortcut to desktop.        

Start > All Programs > Android Studio > Android Studio

C:\Program Files\Android\Android Studio\bin\studio64.exe

Right click on the icon, Android Studio  to Run as administrator.

User Account Control (Popup)

Android Studio (Popup)

Click on Configure, and on SDK Manager.

Android SDK Manager (Popup)

Click on Install 9Packages.

Choose Packages to Install (Popup)

Click on Accept License and wait till all the packages are installed.

Close both Android SDK Manager and Android Studio.

Right click on the icon, Android Studio to Run as administrator.

User Account Control (Popup)

Android Studio (Popup)

.


Android App Development for Beginners – 3 – Setting up Your Project

.

Launch Android and click on Start a new Android Studio project and confirm as below or change it.

Create New Project (Popup)

Application name: My Application

Company Domain: adrian.howtochangelife.com

Project location: C:\Users\Adrian\AndroidStudioProjects\MyApplication

Phone and Tablet Minimum SDK: API 8: Android 2.2. (Froyo)

Activity Name: MainActivity

Layout Name: activity_main

Title: MainActivity

Menu Resource Name: menu_main

.


Android App Development for Beginners – 4 – Running a Simple App

.

Click on the icon, SDK Manager and scroll down to confirm Emulator Accelerator is installed.

Android SDK Manager (Popup)

Intel x86 Emulator Accelerator (HAXM installer)

Go to the menu, File,  Project Structure, and then SDK Location.

Confirm SDK & JDK are installed in the right location.

Project Structure (Popup) 

Android SDK location: C:\Users\Adrian\AppData\Local\Android\sdk

JDK location: C:\Program Files\Java\jdk1.8.0_25

Go to the tab, activity_main.xml and click on the icon App Theme to change it to Material Light.

Select Theme (Popup)

Light (icon) 

Click on the icon, Options and uncheck Include Device Frames to see a bigger interface.

.


Android App Development for Beginners – 5 – Tour of the Interface

.

Go to the Menu bar to choose any menu and go to the sub menu.

Go to the Tool bar to choose any tool, or make a right click to Customize Menus and Toolbars.

Go to the Navigation bar to choose any file to see the sub files.

Go to the Editor Window to choose any tab  and check how the path is changing on the Navigation Bar.

Go to the Project Window to choose Android, Packages or Project.

Go to the Side bar to choose any to view or hide the related window.

.


Android App Development for Beginners – 6 – Android Studio Tips

 

Go to the menu, Help to open Default Keymap Reference.

http://www.jetbrains.com/idea/docs/IntelliJIDEA_ReferenceCard.pdf (Popup)

Go to the editor, MainActivity.java and right click on the front field to Show Line Numbers.  

(Tab) > (Front field) > Show Line Numbers

Go to the menu, File to open Settings and click on Appearance to change the Theme.

File > Settings > Appearance > Theme

Click on the arrow for Editor to edit Code Folding not to Collapse by default.

File > Settings > Editor > Code Folding > Collapse by default 

Click on Colors & Fonts, to save Font with a Scheme name: Custom.

File > Settings > Editor > Colors & Fonts > Font  > Save As > Custom

Primary font: Source Code Pro   Size: 15  Line spacing: 1.2   > Apply > OK

.


Android App Development for Beginners – 7 – Create a Custom AVD

.

Go to the menu, Tools, Android, and then AVD Manager.

AVD Manager (Popup)

Click on the button, Create Virtual Device.

Virtual Device Configuration (Popup)

Click on PhoneGalaxy Nexus 4.65  720×1280  xhdpi, and then Clone Device.

Hardware Profile Configuration (Popup)

Fill in Deice Name: Slim Shady and then Finish.

Find Slim Sandy on the list and Click on Next.

Click on Lollipop 21 x86 Google APIs, and on Next.

Change the Scale to 4dp on device = 1px on screen and Finish.

Click on Show Advanced Settings, and change to RAM: 512 MB to prevent HAX Error, then Finish.

Creating/Updating AVD (Popup)

Go to the Windows, Advanced system settings to add a new System variable as below.

Start > Control Panel > System  > Advanced > Environment Variables > (System variables) New

Variable name: ANDROID_SDK_HOME 

Variable value: C:\Users\Adrian\.android

Click on the icon for AVD Manager and click on green button to launch the emulator, 5554:Slim Shady API21.

Wait for 10 ~15 minutes to boot it up.  

5554:Slim Shady_API_21(Popup)

.


Android App Development for Beginners – 8 – Basic Overview of an App

.

Click on the activity_main.xml tab, and click on the Design view. Click on Hello, world and delete it. 

Go to the Palette, and drag the Large Text widget, then drop it into the device screen.  

Double click it to set the text:How To Change Life.

Click on the Text view, and add android:background=”#006699″ at the end of  RelativeLayout line.

Click on the Design view, and go to the Component Tree, then select textView – “How To Change Life”.

Go to the Properties, and set the textColor:#ffffff.

Go to the Project Window, and click on the manifests folder, then open the AndroidManifest.xml tab.

.


Android App Development for Beginners – 9 – Activity

.

Go to the MainActivity.java tab, and add import android.util.Log; to the end of import line.

Add private static final String TAG = “adriansMessage”; to the below of public class MainActivity.

Add Log.i(TAG, “onCreate”); to the end of protected void onCreate.

.


Android App Development for Beginners – 10 – Running the State Changing Example

.

Hit fn+alt+insert keys together to have a popup for Generate and choose Override Methods.

Select Methods to Override/Implement (Popup)

Select the methods as below, and add Log.i(TAG, ” “); to the end of each method @Override

@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 onRestart() {
super.onRestart();
Log.i(TAG, “onRestart”);
}
@Override
protected void onDestroy() {
super.onDestroy();
Log.i(TAG, “onDestroy”);
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
Log.i(TAG, “onSaveInstanceState”);
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
Log.i(TAG, “onRestoreInstanceState”);
}

Click on the 6:Android at the bottom

Android DDMS (Popup)

Click the down arrow beside No filters, and open Edit Filter Configuration.

Create New Logcat Filter (Popup)

Set the Name: adrians Message by Log Tag (regex): adriansMessage and OK.

Run the device and check the logs.

.


Android App Development for Beginners – 11 – Designing the User Interface

.

Go to the File menu, and Close Project, then Disconnect

Click on the Start a new Android Studio project.

Create New Project (Popup)

Set the Application name: My Application 2, and Next, then Next.

Click on the Add No Activity, and Finish.

Building ‘My Application 2″ Gradle Project Info (Popup)

My Application 2 -[C:\Users\Adrian\AndroidStudioProjects\MyApplication2] – Android Studio 1.0.1 (Popup) 

Go to the Project sidebar, and go through app, Java, and com.howtochangelife.adrian.myapplication2.

Right click on it, and go through New, Activity, and Blank Activity.

Choose options for your new file (Popup)

Mark on the Launcher Activity and Finish.

Click on the activity_main.xml tab, and click on the Design view. Click on the Hello, world and delete it. 

Go to the Palette, and drag the Large Text widget, then drop it into the device screen. Change the Large Text to Sign In.

Go to the Palette, and drag the Email text field as well as Password text field, then drop it into the device screen.

Go to the Palette, and drag the Button widget, then drop it into the device screen.

.


Android App Development for Beginners – 12 – More on User Interface

.

Click on the Text view. Change android:text=”New Button” to android:text=”Log In”.

Click on Email text field on the screen, and add android:width=”320dp” at the end of <EditText  />.

Click on Password text field on the screen, and add android:width=”320dp” at the end of <EditText  />.

Click on the Design view. Click on the Sign In text, and on the light bulb.

Check the message Hardcoded string “Sign In”, should use @string resource and click on arrow to open Extract String Resource.

Extract Resource (Popup)

Set Resource Name: SignInTitle and OK.

Click on the Text view. Confirm android:text=”Sign In” got changed to android:text=”@string/SignInTitle”.

Go to open strings.xml tab, which is located at app > src > main > res > values >

Confirm or Change <string name =”SignInTitle”>Sign In</string>.

Click on the activity_main.xml tab, and click on the Design view. Click on the Log In button, and on the light bulb.

Check the message Hardcoded string “Log In”, should use @string resource and click on arrow to open Extract String Resource.

Extract Resource (Popup)

Set Resource Name: SignInButtonText and OK.

Click on the Text view. Confirm android:text=”Log In” got changed to android:text=”@string/SignInButtonText”.

Hover on the @string/SignInButtonText, and press down Ctrl key, then click on the link.

Strings.xml (Popup)

Confirm or Change <string name =”SignInButonText”>Log In</string>.

.


Android App Development for Beginners – 13 – Create an Interface with Java.

.

Go to File menu, and Close Project, then Disconnect

Android Studio (Popup)

Click on Start a new Android Studio project.

Create New Project (Popup)

Set Application name: Allison, and Next, then NextClick on Add Blank Activity, and Finish.

Building ‘Allison” Gradle Project Info (Popup)

Allison -[C:\Users\Adrian\AndroidStudioProjects\Allion] – Android Studio 1.0.1 (Popup)

Open MainActivity.java tab, and find setCountentView(R,layout.activity_main), then delete it.

 

Import android.widget.RelativeLayout;  

Import android.widget.Button;

 

super.onCreate(savedInstanceState);

RelativeLayout screensLayout = new RelativeLayout(this);

Button loginButton = new Button(this);

screensLayout.addView(loginButton);

setContentView(screensLayout);

 


Android App Development for Beginners – 14 – Adding Properties to Widgets

 

import android.graphics.Color;

.

//device Screen’s Layout

RelativeLayout deviceScreenLayout = new RelativeLayout(this);

deviceScreenLayout.setBackgroundColor (Color.GREEN);

.

//login Button’s Feature

Button loginButton = new Button(this);

loginButton.setId(1);

loginButton.setText(“Click me, please”);

loginButton.setBackgroundColor (Color.RED);

.

//login Button’s Layout

RelativeLayout.LayoutParams loginButtonLayout = new RelativeLayout.LayoutParams(

RelativeLayout.LayoutParams.WRAP_CONTENT,

RelativeLayout.LayoutParams.WRAP_CONTENT

);

loginButtonLayout.addRule(RelativeLayout.CENTER_HORIZONTAL);

loginButtonLayout.addRule(RelativeLayout.CENTER_VERTICAL);

.

//device Screen’s Layout with login Button’s Layout

devieceScreenLayout.addView(loginButton, loginButtonLayout);

setContentView(deviceScreenLayout);

.


Android App Development for Beginners – 15 – Adding More Widgets

 

import android.widget.EditText;

.

//login Name’s Feature

EditText loginName = new EditText(this);

loginName.setId(2);

.

//login Name’s Layout

RelativeLayout.LayoutParams loginNameLayout = new RelativeLayout.LayoutParams(

RelativeLayout.LayoutParams.WRAP_CONTENT,

RelativeLayout.LayoutParams.WRAP_CONTENT

);

loginNameLayout.addRule(RelativeLayout.Above, loginButton.getId());

loginNameLayout.addRule(RelativeLayout.CENTER_VERTICAL);

loginNameLayout.setMargins(0, 0, 0, 50);

.

//device Screen’s Layout with login Name’s Layout

deviceScreenLayout.addView(loginNameloginNameLayout);

setContentView(deviceScreenLayout);

.


Android App Development for Beginners – 16 – Converting DIP to Pixels

.

import android.content.res.Resources;

import android.util.TypedValue;

.

Resources r = getResources();

int px = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 200, r.getDisplayMetrics());

.

loginName.setWidth(px);

.


 Android App Development for Beginners – 17 – GridLayout

.

activity_main.xml

Delete the  Hello world!.

Drag and drop the GridLayout to the screen

Click on the icon for Set layout_width to match_parent. 

Click on the icon for Set layout_height to match_parent.

Drag a Button widget, drop and rename it as Center.

Drag a Button widget, drop as [Insert: row 0, before column 0], and rename it as Left.

Drag a Button widget, drop as [Insert: row 0, after column 0], and rename it as Right.

Drag a Button widget, drop as [Insert: after row 0, column 0], and rename it as Bottom.

Choose Right button and go to Properties.

Set Layout:rowSpan with 2 and set Layout:gravity fill with vertical.

Choose Bottom button and go to Properties.

Set Layout:columnSpan with 2 and set Layout:gravity fill with horizontal.

.


Android App Development for Beginners – 18 ~ 20 – Event Listeners and Callback Methods

 

Create a new project, Smart Button

Go to the activity_main.xml

Drag and drop a Large Text, double click on it, set text: Hello and id:shinesText.

There, click on the bulb and go to set Resource name:message_text.

Drag and drop a Button, double click on it, set text: Click on me and id:shinesButton.

There, click on the bulb and go to set Resource name:button_text.

 

Go to the MainActivity.java

Add import android.view.View; import android.widget.Button; import android.widget.TextView;

Add the below under setContenView(R.layout.activity_main);

 

Button shinesButton = (Button) findViewById (shinesButton);

.

shinesButton.setOnClickListener (

new Button.OnClickListener ( ) {

public void onClick (View v) {

TextView shinesText = (TextView) findViewById (R.id.shinesText);

shinesText.setText (“Good Job”);

}

}

);

.

shinesButton.setOnLongClickListener (

new Button.OnLongClickListerner ( ) {

public boolean onLongClick (View v) {

TextView shinesText = (TextView) findViewById (R.id.shinesText);

shinesText.setText (“You clicked on it so long”);

return true;

}

}

);

.


Android App Development for Beginners – 21 ~ 22 – Gestures

.

Create a new project, Swiper

Go to the activity_main.xml

Drag and drop a Large Text, double click on it, set text: Play with Me and id:shinesText.

There, click on the bulb and go to set Resource name:message_text.

.

Go to the MainActivity.java

Add import android.view.View; import android.view.MotionEvent; import android.view.GestureDetector;

Add import android.support.v4.view.GestureDetectorCompat; import android.widget.TextView;

.

Add implements GestureDetector.OnGestureListener, GestureDetector.OnDoubleTapListener to the right of ActionBarActivity.

Add private TextView shinesText;

Add private GestureDetectorCompat gestureDetector;

.

Add the below between setContenView (R.layout.activity_main);  and  }

shinesText = (TextView) findViewById (R.id.shinesText);

this.gestureDetector new GestureDetectorCompat (this, this);

gestureDetector.setOnDoubleTapListener (this);

 

Add the new method by the right click to choose Generate and Implement Methods, then confirm those selected and click on OK.

Find those methods popping up, then add shinesText.setText(” “); into each method accordingly as below.

@Override

public boolean onDoubleTap (MotionEvent e) {

shineText.setText (“onDoubleTap”);

return false;

}

@Override

public boolean onSingleTapConfirmed (MotionEvent e) {

shineText.setText (“onSingleTabConfirmed”);

return false;

}

@Override

public boolean onDoubleTapEvent (MotionEvent e) {

shineText.setText (“onDoubleTabConfirmed”);

return false;

}

@Override

public boolean onDown (MotionEvent e) {

shineText.setText (“onDown”);

return false;

}

@Override

public boolean onShowPress (MotionEvent e) {

shineText.setText (“onShowPress”);

}

@Override

public boolean onSingleTabUp (MotionEvent e) {

shineText.setText (“onSingleTapUp”);

return false;

}

@Override

public boolean onScroll (MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {

shineText.setText (“onScroll”);

return false;

}

@Override

public boolean onLongPress (MotionEvent e) {

shineText.setText (“onLongPress”);

}

@Override

public boolean onFling (MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {

shineText.setText (“onFling”);

return false;

}

.

Add the new method by the right click to choose Generate and Override Methods, then select onTouchEvent under android.app.Activity.

Find that method popping up, then add this.gestureDetector.onTouchEvent(event); shinesText.setText(” “); into it as below.

@Override

public boolean onTouchEvent (MotionEvent event) {

this.gestureDetector.onTouchEvent (event);

shineText.setText (“onTouchEvent”);

return super.onTouchEvent (event);

}

.


Android App Development for Beginners – 23 ~ 30 – Fragments

.

Create a new project, MemeCreator.

Move a picture to drawable under MemeCreator > app > src > main > res.

.

Go to layout under MemeCreator > app > src > main > resand right click on it.

Go through New > Layout resource file > New Layout Resource File.

Fill in File name: with top_section_fragment and Root element: with RelativeLayout.

Confirm top_section_fragment.xml got created, then go to Text view.

Add the below under android:layout_height=“match_parent”>

<EditText

android:id  “@+id/topTextInput”

android:layout_centerHorizontal “true”

android:layout_marginTop “15dp”

android:layout_height “wrap_content”

android:layout_width “wrap_content”

android:width “300dp”/>

<EditText

android:id “@+id/bottomTextInput”

android:layout_below = “@+id/topTextInput”

android:layout_centerHorizontal “true”

android:layout_marginTop “15dp”

android:layout_height “wrap_content”

android:layout_width “wrap_content”

android:width “300dp”/>

<Button

android:id “@+id/button”

android:layout_below“@+id/bottomTextInput”

android:layout_centerHorizontal “true”

android:layout_marginTop “30dp”

android:layout_height “wrap_content”

android:layout_width = “wrap_content”

Go to Design view and double click on the Button, “Dank Memo Bro” and fill in the text: with @string/button_text

.

Go to com.howtochangelife.shine.memecreator under MemeCreator > app > src > main > javaand right click on it.

Go through New > Java class > Create New Class, and fill in Name: with TopSectionFragment.

Confirm TopSectionFragment.java got created,

Add the below under package com.howtochangelife.shine.memecreator;

import android.os.Bundle;

import android.support.annotation.Nullable;

import android.support.v4.app.Fragment;

import android.view.LayoutInflator;

import android.view.View;

import android.view.ViewGroup;

Go to public class TopSectionFragment and add extends Fragment before {

Right click on somewhere between {  }  to go through Generate, Override Methods, onCreateView and OK.

      @override

public View onCreateView

(LayoutInflator inflator, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState){

return super.onCreateView(inflator, container, savedInstanceState);

}

Replace return and the following with the below.

View view = inflator.inflate(R.layout.top_section_fragment, container, false);

return view;

.

Go to layout under MemeCreator > app > src > main > resand right click on it.

Go through New > Layout resource file > New Layout Resource File.

Fill in File name: with bottom_picture_fragment and Root element: with RelativeLayout.

Confirm bottom_picture_fragment.xml got created, then go to Design view.

Go through Properties, Background, and then  go through Project, Drawable, and Shine.

Confirm the picture came up and go to Widgets and draw two Large Text onto the picture’s top and bottom. 

Choose the top Large Text and go to Property and set the textColor with #FFF. Repeat it for bottom Large Text.

Choose the top Large Text and go to Property and set the layout:width with match_parent. Repeat it for bottom Large Text.

Choose the top Large Text and go to Property and set the gravity:center_horizontal marked. Repeat it for bottom Large Text.

Double click on the top Large Text and set the text:top, then click on the bulb to set Resource name:top_text  and OK

Double click on the bottom Large Text and set the text:bottom, then click on the bulb to set Resource name:bottom_text  and OK

.

Go to com.howtochangelife.shine.memecreator under MemeCreator > app > src > main > javaand right click on it.

Go through New > Java class > Create New Class, and fill in Name: with BottomPictureFragment.

Confirm BottomPictureFragment.java got created,

Add the below under package com.howtochangelife.shine.memecreator;

import android.os.Bundle;

import android.support.annotation.Nullable;

import android.support.v4.app.Fragment;

import android.view.LayoutInflator;

import android.view.View;

import android.view.ViewGroup;

Go to public class TopSectionFragment and add extends Fragment before {

Right click on somewhere between {  }  to go through Generate, Override Methods, onCreateView and OK.

      @override

      public View onCreateView

(LayoutInflator inflator, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState){

return super.onCreateView(inflator, container, savedInstanceState);

}

Replace return and the following with the below.

View view = inflator.inflate(R.layout.bottom_picture_fragmentcontainer, false);

return view;

.

Go to activity_main.xml and go through Palette, Custom, <fragment>, TopSectionFragment and OK. 

Place it at the center top and click on Use @layout/top_section_fragment inside of Rendering Problems.

Go to activity_main.xml and go through Palette, Custom, <fragment>, BottomPictureFragment and OK. 

Place it at the center bottom and click on Use @layout/bottom_picture_fragment inside of Rendering Problems.

Go to Properties and set layout:width with 300dp as well as layout:height with 320dp 

.

Go to MainActivity,java and Right click on somewhere above the @Override public boolean onCreateOptionMenu and the following. 

Go through Generate, Override Methods, createMeme and OK.

@Override

public void createMeme (String top, String bottom) {

BottomPictureFragment bottomFragment = (BottomPictureFragment) getSupportFragmentManager( ).findFragmentById (R.id.fragment2);

bottomFragment.setMemeText(top, bottom);

}

}

.


Android App Development for Beginners – 31 ~ 32 – Master Detail Flow

.

Create a new project, MasterFlow.

Add an Activity to Mobile with Mater/Detail Flow 

Fill the Object Kind with Webpage, Object Kind Plural with Webpages, and Title with Webpages, then click on Finish.

 

Go through app > java > shine.howtochangelife.com.masterflow > dummy > DummyContent to open DummyContent.java.

Go to static { and change as below.

static {

addItem (new DummyItem (“1”, “Java Beginner”, “http://howtochangelife.com/java-programming-tutorial-for-beginner-1-87/”));

addItem (new DummyItem (“2”, “Java Intermediate”, “http://howtochangelife.com/java-programming-tutorial-for-intermediate-1-59/”));

addItem (new DummyItem (“3”, “Android”, “http://howtochangelife.com/android-app-development-for-beginners-1-17/”));

}

Go to public static class DummyItem { and change as below.

public static class DummyItem {

public String id;

public String item_name;

public String url;

public DummyItem (String id, String item_name, String url) {

this.id = id;

this.item_name = item_name;

this.url = url;

}

public String toString( ) {

return item_name;

}

}

.

Go to fragment_webpage_detail.xml via app > res > layout and replace all the lines as below.

<?xml version = “1.0” encoding “utf-8”?>

<WebView xmlns:android = “http://schemas.android.com/apk/res/android”

android:id“@+id/webview”

android:layout_width “match_parent”

android:layout_height = “match_parent”

/>

Then, change id to detail_area

.

Go to WebPageDetailFragment.java via app > java > shine.howtochangelife.com.masterflow 

Replace import android.widget.TextEdit; with import android.webkit.WebView;

Go down to public View onCreateView( and replace if (mItem != null) as below.

if (mItem ! = null) {

((WebView) rootView.findViewById(R.id.detail_area)).loadUrl(mItem.url);

}

.

Go to AndroidManifest.xml via app > manifests

Add the line below under package “shine.howtochangelife.com.masterflow”>

<uses-permission android:name “android.permission.INTERNET”/>

.


Android App Development for Beginners – 33 ~ 34 – Overflow Menu

.

Create a new project, OverFlow Menu.

Go to activity_main.xml and replace Hello world with Large Text. 

Click on RelativeLayout on the Component Tree, set the id as main_view.

.

Go to menu_main.xml via app > res > menu.

Replace <item android:id ~ ~ ~ /> with the below.

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *