SlideShare a Scribd company logo
ANDROID
Prepared By
Pranav Ashok
Android developer
CONTENTS
 Introduction
 Android Life Cycle
 Activity
 Fragment
 Layout
 Navigation Drawer
 Recycler view
 Shared preference
 Api integration
INTRODUCTION
 HISTORY OF ANDROID
Android Inc.founded in Palo Alto,california ,united states in October
2003 by Andy Rubin.(Rich Miner, Nick sears and Chris white)
 WHAT IS ANDROID?
It is a open source software platform and operating system for mobile
devices , Based on the Linux kernel . Developed by Google and later the
Open Handset Alliance (OHA).
INTRODUCTION
Android version history
Code name Version no. Release date API Level
No codename 1.0 September 23, 2008 1
No codename 1.1 February 9, 2009 2
Cupcake 1.5 April 27, 2009 3
Donut 1.6 September 15, 2009 4
Eclair 2.0 – 2.1 October 26, 2009 5-7
Froyo 2.2 – 2.1 May 20, 2010 8
Gingerbread 2.3 – 2.3.7 December 6, 2010 9-10
Honeycomb 3.0 – 3.2.6 February 22, 2011 11-13
Ice Cream Sandwich 4.0 – 4.0.4 October 18, 2011 14-15
Jelly Bean 4.1 – 4.3.1 July 9, 2012 16-18
KitKat 4.4 – 4.4.4 October 31, 2013 19-20
Lollipop 5.0 - 5.1.1 November 12, 2014 21-22
Mashmallow 6.0 – 6.0.1 October 5, 2015 23
Nougat 7.0 – 7.1.2 August 22, 2016 24-25
Oreo 8.0 August 21, 2017 26
ANDROID LIFE CYCLE
 The steps that an application goes through from starting to finishing
 onCreate()
 onRestart
 onStart()
 onResume()
 onStop()
 onPause()
 onDestroy
ANDROID LIFE CYCLE
 onCreate() - Called before the first components of the application starts.
 onRestart - Called after your activity has been stopped, prior to it being
started again.
 onStart() – Called when the activity is becoming visible to the user.
 onResume() - Called if the activity get visible again.
 onStop() - Called once the activity is no longer visible.
 onPause() - Called once another activity gets into the foreground.
 onDestroy - The final call you receive before your activity is destroyed.
ACTIVITY
 Basic component of most applications
 Most applications have several activities that start each other as needed
 Each is implemented as a subclass of the base Activity class
 The content of the window is a view or a group of views
 Example of views: buttons, text fields, scroll bars, menu items, check boxes,
etc.
 An activity is started by Context.startActivity(Intent intent) or
Activity.startActivityForResult(Intent intent, int RequestCode)
package com.twixt.uaeexportdirectory.view.activity;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
/**
* @author Pranav Ashok on 30-09-2017.
*/
public class Activity extends AppCompatActivity{
@Override
public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) {
super.onCreate(savedInstanceState, persistentState);
setContentView(R.layout.activity_xml);
}
}
ACTIVITY
FRAGMENT
About Fragments
 New in Android 3.0 (Honeycomb, API 11)
 Intended to reuse layouts between tablets and phones But usable for many
more...
 A fragment is a modular section of an activity, which has its own lifecycle.
 A fragment's lifecycle is directly affected by the host activity's lifecycle
 Activity paused: fragments paused
 Activity destroyed: fragments destroyed
 Activity running: fragments can have different states
FRAGMENT LIFECYCLE
FRAGMENT LIFECYCLE
 onAttach() :This method will be called first, even before onCreate(), letting
us know that your fragment has been attached to an activity.
 onCreate() : The system calls this when creating the fragment.
 onCreateView() : The system calls this when it's time for the fragment to
draw its user interface for the first time.
 onViewCreated() : This will be called after onCreateView().
 onPause() : The system calls this method as the first indication that the user
is leaving the fragment (though it does not always mean the fragment is being
destroyed).
 onDestroyView() : It’s called before onDestroy().
package com.twixt.uaeexportdirectory.view.activity;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
/**
* @author Pranav Ashok on 30-09-2017.
*/
public class Activity extends AppCompatActivity{
@Override
public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle
persistentState) {
super.onCreate(savedInstanceState, persistentState);
setContentView(R.layout.activity_xml);
//type your code here
}
}
FRAGMENT
getFragmentManager().beginTransaction()
.add(R.id.activity_xml, new YourFragment(), Activity.class.getName())
.commit();
package com.twixt.uaeexportdirectory.view.activity;
import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.xtronlabs.uaeexportdirectory.R;
/**
* @author Pranav Ashok on 30-09-2017.
*/
public class YourFragment extends Fragment{
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle
savedInstanceState) {
View view=inflater.inflate(R.layout.your_fragment_xml,container,false);
return view;
}
}
FRAGMENT
LAYOUT
 What is a Layout?
Your layout is the architecture for the user interface in an Activity.
It defines the layout structure and holds all the elements that appear
to the user.
 How to declare a Layout?
Option #1: Declare UI elements in XML
Option #2: Instantiate layout elements at runtime
LAYOUT
Types of Layouts
 RelativeLayout
 LinearLayout
 FrameLayout
 GridLayout
 TableLayout
 ConstraintLayout
NAVIGATION DRAWER
 For opening drawer (using java code)
drawer_layout_id.openDrawer(Gravity.LEFT);
drawerLayout.openDrawer(Gravity.RIGHT);
 For closing drawer (using java code)
drawer_layout_id.closeDrawers();
NAVIGATION DRAWER
RECYCLERVIEW
RECYCLERVIEW
 This widget is a container for displaying large data sets that can be scrolled
very efficiently by maintaining a limited number of views.
 You need to include gradle file in the dependencies (build.gradle module)
 Compile 'com.android.support:recyclerview-v7:25.+'
RECYCLERVIEW
RECYCLERVIEW
public Rv_Adapter rv_Adapter;
public RecyclerView r_v;
Rv_Adapter = new Rv_Adapter (getActivity());
r_v.setAdapter(rv_Adapter);
r_v.setLayoutManager(new LinearLayoutManager(getActivity()));
//in main xml page
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_id"
android:layout_width="match_parent"
android:layout_height="wrap_content“/>
SHARED PREFERENCE
 The shared preference is a class that provide a storage area to store a small
amount of temporary data you can save.
 Shared preference in Android are used to keep track of application and user
preferences.
 Android applications can store data in application preferences.
 In any application, there are default preferences that can accessed through
the PreferenceManager instance and its related
method getDefaultSharedPreferences(Context)
 With the SharedPreference instance one can retrieve the int value of the any
preference with the getInt(String key, intdefVal).
 We can modify the SharedPreference instance in our case using the <br
/>edit() and use the putInt(String key, intnewVal)
SHARED PREFERENCE
SharedPreferences sp =
getActivity().getSharedPreferences("sp_file",Context.MODE_PRIVATE);
String i=sp.getString (“key", “default string");
SharedPreferences s_p =
getActivity().getSharedPreferences(“sp_file",Context.MODE_PRIVATE);
SharedPreferences.Editor editor=s_p.edit();
editor.putString(“key", " your_string ");
editor.commit();
//default SharedPreference
SharedPreferences sp =
getActivity().PreferenceManager.getDeaultSharedPreferences(this);
API INTEGRATION
 Connect to the Network
<uses-permission android:name="android.permission.INTERNET" />
 Manage Network Usage
Minimize the amount of sensitive or personal user data that you transmit
over the network.
 Parsing XML Data
Integrate data in your xml fields
API INTEGRATION
Things to remember before integrating
 In manifests
<uses-permission android:name="android.permissionINTERNET" />
 In build.gradle(Module:app)
packagingOptions {
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
API INTEGRATION
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.6.0'
compile 'com.squareup.retrofit2:converter-jackson:2.1.0'
Things to remember before integrating
 In build.gradle(Module:app)
API INTEGRATION
 Create an Interface Class
public interface Interface_all_links_here {
@GET("aps_api/get_all_ads")
Call<Api_Responce[]> getDATA();
}
API INTEGRATION
 Create an Interface Class for processor responce
public interface ProcessResponceIntrphase<T> {
void processResponce(T responce);
}
API INTEGRATION
 Create an Rrequest Class for Api
API INTEGRATION
 Create an Rrequest Class for Api
public class Api_Request extends AbstractRequest<Api_Responce[]> {
public Api_Request(Context context,
ProcessResponceIntrphase<Api_Responce[]> responcec_Handeler) {
super(context, responcec_Handeler);
}
public void get_Data() {
Call<Api_Responce[]> call = _interface.getDATA();
call.enqueue(this);
}
}
API INTEGRATION
 Create an Response Class for Api
API INTEGRATION
 Main activity/fragement
TIPS FOR BEGINNER
 Accounts
 https://stackoverflow.com
 https://github.com
 References
 https://www.tutorialspoint.com/android
 https://developer.android.com/training/index.html
 https://www.javatpoint.com/android-tutorial
 https://www.youtube.com
Android

More Related Content

What's hot

Anatomy of android application
Anatomy of android applicationAnatomy of android application
Anatomy of android application
Nikunj Dhameliya
 
android activity
android activityandroid activity
android activity
Deepa Rani
 
Android apps development
Android apps developmentAndroid apps development
Android apps development
Raman Pandey
 
Introduction to Android Fragments
Introduction to Android FragmentsIntroduction to Android Fragments
Introduction to Android Fragments
Sergi Martínez
 
Android Fragment
Android FragmentAndroid Fragment
Android Fragment
Kan-Han (John) Lu
 
Presentation on Android application life cycle and saved instancestate
Presentation on Android application life cycle and saved instancestatePresentation on Android application life cycle and saved instancestate
Presentation on Android application life cycle and saved instancestate
Osahon Gino Ediagbonya
 
Activities, Fragments, and Events
Activities, Fragments, and EventsActivities, Fragments, and Events
Activities, Fragments, and Events
Henry Osborne
 
Introduction to fragments in android
Introduction to fragments in androidIntroduction to fragments in android
Introduction to fragments in android
Prawesh Shrestha
 
[Individual presentation] android fragment
[Individual presentation] android fragment[Individual presentation] android fragment
[Individual presentation] android fragment
Gabriele Vecchia
 
04 activities - Android
04   activities - Android04   activities - Android
04 activities - Android
Wingston
 
Android Tutorial For Beginners Part-1
Android Tutorial For Beginners Part-1Android Tutorial For Beginners Part-1
Android Tutorial For Beginners Part-1
Amit Saxena
 
Android Development project
Android Development projectAndroid Development project
Android Development project
Minhaj Kazi
 
Android - Working with Fragments
Android - Working with FragmentsAndroid - Working with Fragments
Android - Working with Fragments
Can Elmas
 
Google Plus SignIn : l'Authentification Google
Google Plus SignIn : l'Authentification GoogleGoogle Plus SignIn : l'Authentification Google
Google Plus SignIn : l'Authentification Google
Mathias Seguy
 
Android by Swecha
Android by SwechaAndroid by Swecha
Fragments: Why, How, What For?
Fragments: Why, How, What For?Fragments: Why, How, What For?
Fragments: Why, How, What For?
Brenda Cook
 
Android 3
Android 3Android 3
Android 3
Robert Cooper
 
Android App Development - 06 Fragments
Android App Development - 06 FragmentsAndroid App Development - 06 Fragments
Android App Development - 06 Fragments
Diego Grancini
 

What's hot (18)

Anatomy of android application
Anatomy of android applicationAnatomy of android application
Anatomy of android application
 
android activity
android activityandroid activity
android activity
 
Android apps development
Android apps developmentAndroid apps development
Android apps development
 
Introduction to Android Fragments
Introduction to Android FragmentsIntroduction to Android Fragments
Introduction to Android Fragments
 
Android Fragment
Android FragmentAndroid Fragment
Android Fragment
 
Presentation on Android application life cycle and saved instancestate
Presentation on Android application life cycle and saved instancestatePresentation on Android application life cycle and saved instancestate
Presentation on Android application life cycle and saved instancestate
 
Activities, Fragments, and Events
Activities, Fragments, and EventsActivities, Fragments, and Events
Activities, Fragments, and Events
 
Introduction to fragments in android
Introduction to fragments in androidIntroduction to fragments in android
Introduction to fragments in android
 
[Individual presentation] android fragment
[Individual presentation] android fragment[Individual presentation] android fragment
[Individual presentation] android fragment
 
04 activities - Android
04   activities - Android04   activities - Android
04 activities - Android
 
Android Tutorial For Beginners Part-1
Android Tutorial For Beginners Part-1Android Tutorial For Beginners Part-1
Android Tutorial For Beginners Part-1
 
Android Development project
Android Development projectAndroid Development project
Android Development project
 
Android - Working with Fragments
Android - Working with FragmentsAndroid - Working with Fragments
Android - Working with Fragments
 
Google Plus SignIn : l'Authentification Google
Google Plus SignIn : l'Authentification GoogleGoogle Plus SignIn : l'Authentification Google
Google Plus SignIn : l'Authentification Google
 
Android by Swecha
Android by SwechaAndroid by Swecha
Android by Swecha
 
Fragments: Why, How, What For?
Fragments: Why, How, What For?Fragments: Why, How, What For?
Fragments: Why, How, What For?
 
Android 3
Android 3Android 3
Android 3
 
Android App Development - 06 Fragments
Android App Development - 06 FragmentsAndroid App Development - 06 Fragments
Android App Development - 06 Fragments
 

Similar to Android

Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
Aly Abdelkareem
 
Stmik bandung
Stmik bandungStmik bandung
Stmik bandung
farid savarudin
 
android training_material ravy ramio
android training_material ravy ramioandroid training_material ravy ramio
android training_material ravy ramio
slesulvy
 
Answer1)Responsive design is the idea where all the developed pag.pdf
Answer1)Responsive design is the idea where all the developed pag.pdfAnswer1)Responsive design is the idea where all the developed pag.pdf
Answer1)Responsive design is the idea where all the developed pag.pdf
ankitcomputer11
 
Android terminologies
Android terminologiesAndroid terminologies
Android terminologies
jerry vasoya
 
Android activity, service, and broadcast recievers
Android activity, service, and broadcast recieversAndroid activity, service, and broadcast recievers
Android activity, service, and broadcast recievers
Utkarsh Mankad
 
"Android" mobilių programėlių kūrimo įvadas #2
"Android" mobilių programėlių kūrimo įvadas #2"Android" mobilių programėlių kūrimo įvadas #2
"Android" mobilių programėlių kūrimo įvadas #2
Tadas Jurelevičius
 
Android Development Basics
Android Development BasicsAndroid Development Basics
Android Development Basics
Prajakta Dharmpurikar
 
Activity
ActivityActivity
Activity
NikithaNag
 
Activity
ActivityActivity
Activity
roopa_slide
 
Activity
ActivityActivity
Activity
NikithaNag
 
Android
AndroidAndroid
Android apps development
Android apps developmentAndroid apps development
Android apps development
Monir Zzaman
 
Android best practices
Android best practicesAndroid best practices
Android best practices
Jose Manuel Ortega Candel
 
Android beginners David
Android beginners DavidAndroid beginners David
Android beginners David
Arun David Johnson R
 
Synapseindia android application development tutorial
Synapseindia android application development tutorialSynapseindia android application development tutorial
Synapseindia android application development tutorial
Synapseindiappsdevelopment
 
Synapseindia android apps development tutorial
Synapseindia android apps  development tutorialSynapseindia android apps  development tutorial
Synapseindia android apps development tutorial
Synapseindiappsdevelopment
 
What's New in Android
What's New in AndroidWhat's New in Android
What's New in Android
Robert Cooper
 
Native Android Development Practices
Native Android Development PracticesNative Android Development Practices
Native Android Development Practices
Roy Clarkson
 
02 hello world - Android
02   hello world - Android02   hello world - Android
02 hello world - Android
Wingston
 

Similar to Android (20)

Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
 
Stmik bandung
Stmik bandungStmik bandung
Stmik bandung
 
android training_material ravy ramio
android training_material ravy ramioandroid training_material ravy ramio
android training_material ravy ramio
 
Answer1)Responsive design is the idea where all the developed pag.pdf
Answer1)Responsive design is the idea where all the developed pag.pdfAnswer1)Responsive design is the idea where all the developed pag.pdf
Answer1)Responsive design is the idea where all the developed pag.pdf
 
Android terminologies
Android terminologiesAndroid terminologies
Android terminologies
 
Android activity, service, and broadcast recievers
Android activity, service, and broadcast recieversAndroid activity, service, and broadcast recievers
Android activity, service, and broadcast recievers
 
"Android" mobilių programėlių kūrimo įvadas #2
"Android" mobilių programėlių kūrimo įvadas #2"Android" mobilių programėlių kūrimo įvadas #2
"Android" mobilių programėlių kūrimo įvadas #2
 
Android Development Basics
Android Development BasicsAndroid Development Basics
Android Development Basics
 
Activity
ActivityActivity
Activity
 
Activity
ActivityActivity
Activity
 
Activity
ActivityActivity
Activity
 
Android
AndroidAndroid
Android
 
Android apps development
Android apps developmentAndroid apps development
Android apps development
 
Android best practices
Android best practicesAndroid best practices
Android best practices
 
Android beginners David
Android beginners DavidAndroid beginners David
Android beginners David
 
Synapseindia android application development tutorial
Synapseindia android application development tutorialSynapseindia android application development tutorial
Synapseindia android application development tutorial
 
Synapseindia android apps development tutorial
Synapseindia android apps  development tutorialSynapseindia android apps  development tutorial
Synapseindia android apps development tutorial
 
What's New in Android
What's New in AndroidWhat's New in Android
What's New in Android
 
Native Android Development Practices
Native Android Development PracticesNative Android Development Practices
Native Android Development Practices
 
02 hello world - Android
02   hello world - Android02   hello world - Android
02 hello world - Android
 

Recently uploaded

RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
Himanshu Rai
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
Nguyen Thanh Tu Collection
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
IGCSE Biology Chapter 14- Reproduction in Plants.pdf
IGCSE Biology Chapter 14- Reproduction in Plants.pdfIGCSE Biology Chapter 14- Reproduction in Plants.pdf
IGCSE Biology Chapter 14- Reproduction in Plants.pdf
Amin Marwan
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
Wahiba Chair Training & Consulting
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
สมใจ จันสุกสี
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
EduSkills OECD
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Leena Ghag-Sakpal
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
ZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptxZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptx
dot55audits
 
Solutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptxSolutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptx
spdendr
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
imrankhan141184
 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
PsychoTech Services
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
haiqairshad
 

Recently uploaded (20)

RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
IGCSE Biology Chapter 14- Reproduction in Plants.pdf
IGCSE Biology Chapter 14- Reproduction in Plants.pdfIGCSE Biology Chapter 14- Reproduction in Plants.pdf
IGCSE Biology Chapter 14- Reproduction in Plants.pdf
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
ZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptxZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptx
 
Solutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptxSolutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptx
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
 

Android

  • 2. CONTENTS  Introduction  Android Life Cycle  Activity  Fragment  Layout  Navigation Drawer  Recycler view  Shared preference  Api integration
  • 3. INTRODUCTION  HISTORY OF ANDROID Android Inc.founded in Palo Alto,california ,united states in October 2003 by Andy Rubin.(Rich Miner, Nick sears and Chris white)  WHAT IS ANDROID? It is a open source software platform and operating system for mobile devices , Based on the Linux kernel . Developed by Google and later the Open Handset Alliance (OHA).
  • 5. Android version history Code name Version no. Release date API Level No codename 1.0 September 23, 2008 1 No codename 1.1 February 9, 2009 2 Cupcake 1.5 April 27, 2009 3 Donut 1.6 September 15, 2009 4 Eclair 2.0 – 2.1 October 26, 2009 5-7 Froyo 2.2 – 2.1 May 20, 2010 8 Gingerbread 2.3 – 2.3.7 December 6, 2010 9-10 Honeycomb 3.0 – 3.2.6 February 22, 2011 11-13 Ice Cream Sandwich 4.0 – 4.0.4 October 18, 2011 14-15 Jelly Bean 4.1 – 4.3.1 July 9, 2012 16-18 KitKat 4.4 – 4.4.4 October 31, 2013 19-20 Lollipop 5.0 - 5.1.1 November 12, 2014 21-22 Mashmallow 6.0 – 6.0.1 October 5, 2015 23 Nougat 7.0 – 7.1.2 August 22, 2016 24-25 Oreo 8.0 August 21, 2017 26
  • 6. ANDROID LIFE CYCLE  The steps that an application goes through from starting to finishing  onCreate()  onRestart  onStart()  onResume()  onStop()  onPause()  onDestroy
  • 7.
  • 8. ANDROID LIFE CYCLE  onCreate() - Called before the first components of the application starts.  onRestart - Called after your activity has been stopped, prior to it being started again.  onStart() – Called when the activity is becoming visible to the user.  onResume() - Called if the activity get visible again.  onStop() - Called once the activity is no longer visible.  onPause() - Called once another activity gets into the foreground.  onDestroy - The final call you receive before your activity is destroyed.
  • 9. ACTIVITY  Basic component of most applications  Most applications have several activities that start each other as needed  Each is implemented as a subclass of the base Activity class  The content of the window is a view or a group of views  Example of views: buttons, text fields, scroll bars, menu items, check boxes, etc.  An activity is started by Context.startActivity(Intent intent) or Activity.startActivityForResult(Intent intent, int RequestCode)
  • 10. package com.twixt.uaeexportdirectory.view.activity; import android.os.Bundle; import android.os.PersistableBundle; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; /** * @author Pranav Ashok on 30-09-2017. */ public class Activity extends AppCompatActivity{ @Override public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) { super.onCreate(savedInstanceState, persistentState); setContentView(R.layout.activity_xml); } } ACTIVITY
  • 11. FRAGMENT About Fragments  New in Android 3.0 (Honeycomb, API 11)  Intended to reuse layouts between tablets and phones But usable for many more...  A fragment is a modular section of an activity, which has its own lifecycle.  A fragment's lifecycle is directly affected by the host activity's lifecycle  Activity paused: fragments paused  Activity destroyed: fragments destroyed  Activity running: fragments can have different states
  • 13. FRAGMENT LIFECYCLE  onAttach() :This method will be called first, even before onCreate(), letting us know that your fragment has been attached to an activity.  onCreate() : The system calls this when creating the fragment.  onCreateView() : The system calls this when it's time for the fragment to draw its user interface for the first time.  onViewCreated() : This will be called after onCreateView().  onPause() : The system calls this method as the first indication that the user is leaving the fragment (though it does not always mean the fragment is being destroyed).  onDestroyView() : It’s called before onDestroy().
  • 14. package com.twixt.uaeexportdirectory.view.activity; import android.os.Bundle; import android.os.PersistableBundle; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; /** * @author Pranav Ashok on 30-09-2017. */ public class Activity extends AppCompatActivity{ @Override public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) { super.onCreate(savedInstanceState, persistentState); setContentView(R.layout.activity_xml); //type your code here } } FRAGMENT getFragmentManager().beginTransaction() .add(R.id.activity_xml, new YourFragment(), Activity.class.getName()) .commit();
  • 15. package com.twixt.uaeexportdirectory.view.activity; import android.app.Fragment; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.xtronlabs.uaeexportdirectory.R; /** * @author Pranav Ashok on 30-09-2017. */ public class YourFragment extends Fragment{ @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) { View view=inflater.inflate(R.layout.your_fragment_xml,container,false); return view; } } FRAGMENT
  • 16. LAYOUT  What is a Layout? Your layout is the architecture for the user interface in an Activity. It defines the layout structure and holds all the elements that appear to the user.  How to declare a Layout? Option #1: Declare UI elements in XML Option #2: Instantiate layout elements at runtime
  • 17. LAYOUT Types of Layouts  RelativeLayout  LinearLayout  FrameLayout  GridLayout  TableLayout  ConstraintLayout
  • 18.
  • 19. NAVIGATION DRAWER  For opening drawer (using java code) drawer_layout_id.openDrawer(Gravity.LEFT); drawerLayout.openDrawer(Gravity.RIGHT);  For closing drawer (using java code) drawer_layout_id.closeDrawers();
  • 22. RECYCLERVIEW  This widget is a container for displaying large data sets that can be scrolled very efficiently by maintaining a limited number of views.  You need to include gradle file in the dependencies (build.gradle module)  Compile 'com.android.support:recyclerview-v7:25.+'
  • 24. RECYCLERVIEW public Rv_Adapter rv_Adapter; public RecyclerView r_v; Rv_Adapter = new Rv_Adapter (getActivity()); r_v.setAdapter(rv_Adapter); r_v.setLayoutManager(new LinearLayoutManager(getActivity())); //in main xml page <android.support.v7.widget.RecyclerView android:id="@+id/rv_id" android:layout_width="match_parent" android:layout_height="wrap_content“/>
  • 25.
  • 26. SHARED PREFERENCE  The shared preference is a class that provide a storage area to store a small amount of temporary data you can save.  Shared preference in Android are used to keep track of application and user preferences.  Android applications can store data in application preferences.  In any application, there are default preferences that can accessed through the PreferenceManager instance and its related method getDefaultSharedPreferences(Context)  With the SharedPreference instance one can retrieve the int value of the any preference with the getInt(String key, intdefVal).  We can modify the SharedPreference instance in our case using the <br />edit() and use the putInt(String key, intnewVal)
  • 27. SHARED PREFERENCE SharedPreferences sp = getActivity().getSharedPreferences("sp_file",Context.MODE_PRIVATE); String i=sp.getString (“key", “default string"); SharedPreferences s_p = getActivity().getSharedPreferences(“sp_file",Context.MODE_PRIVATE); SharedPreferences.Editor editor=s_p.edit(); editor.putString(“key", " your_string "); editor.commit(); //default SharedPreference SharedPreferences sp = getActivity().PreferenceManager.getDeaultSharedPreferences(this);
  • 28. API INTEGRATION  Connect to the Network <uses-permission android:name="android.permission.INTERNET" />  Manage Network Usage Minimize the amount of sensitive or personal user data that you transmit over the network.  Parsing XML Data Integrate data in your xml fields
  • 29. API INTEGRATION Things to remember before integrating  In manifests <uses-permission android:name="android.permissionINTERNET" />  In build.gradle(Module:app) packagingOptions { packagingOptions { exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/NOTICE' exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt' } }
  • 30. API INTEGRATION compile 'com.squareup.retrofit2:retrofit:2.1.0' compile 'com.squareup.okhttp3:logging-interceptor:3.6.0' compile 'com.squareup.retrofit2:converter-jackson:2.1.0' Things to remember before integrating  In build.gradle(Module:app)
  • 31. API INTEGRATION  Create an Interface Class public interface Interface_all_links_here { @GET("aps_api/get_all_ads") Call<Api_Responce[]> getDATA(); }
  • 32. API INTEGRATION  Create an Interface Class for processor responce public interface ProcessResponceIntrphase<T> { void processResponce(T responce); }
  • 33. API INTEGRATION  Create an Rrequest Class for Api
  • 34. API INTEGRATION  Create an Rrequest Class for Api public class Api_Request extends AbstractRequest<Api_Responce[]> { public Api_Request(Context context, ProcessResponceIntrphase<Api_Responce[]> responcec_Handeler) { super(context, responcec_Handeler); } public void get_Data() { Call<Api_Responce[]> call = _interface.getDATA(); call.enqueue(this); } }
  • 35. API INTEGRATION  Create an Response Class for Api
  • 36. API INTEGRATION  Main activity/fragement
  • 37. TIPS FOR BEGINNER  Accounts  https://stackoverflow.com  https://github.com  References  https://www.tutorialspoint.com/android  https://developer.android.com/training/index.html  https://www.javatpoint.com/android-tutorial  https://www.youtube.com

Editor's Notes

  1. <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="#00e4c9"> <android.support.v7.widget.RecyclerView android:layout_width="match_parent" android:background="@color/colorAccent" android:alpha=".6" android:layout_margin="5dp" android:layout_height="match_parent" /> </RelativeLayout> <RelativeLayout android:layout_width="200dp" android:layout_height="match_parent" android:layout_gravity="left" android:background="#6200ff"> </RelativeLayout> <RelativeLayout android:layout_width="200dp" android:layout_height="match_parent" android:layout_gravity="right" android:background="#ff6f00"> </RelativeLayout> </android.support.v4.widget.DrawerLayout>
  2. public class Adapter_for_rv extends RecyclerView.Adapter<Adapter_for_rv.ViewHolder> { Context context; public Adapter_for_rv(Context con) { context = con; } @Override public Adapter_for_rv.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { LayoutInflater layoutInflater = LayoutInflater.from(context); return new ViewHolder(layoutInflater.inflate(R.layout.rvlayout, parent, false)); } @Override public void onBindViewHolder(Adapter_for_rv.ViewHolder holder, int position) { //code -> action to be done } @Override public int getItemCount() { return length; } public class ViewHolder extends RecyclerView.ViewHolder { // declarations public ViewHolder(final View itemView) { super(itemView); // finding declared fields and actions here } } }
  3. package com.twixt.nd; import android.content.Context; import android.util.Log; import java.util.concurrent.TimeUnit; import okhttp3.OkHttpClient; import okhttp3.logging.HttpLoggingInterceptor; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; import retrofit2.Retrofit; import retrofit2.converter.jackson.JacksonConverterFactory; /** * @author pranav Ashok on 06-10-2017. */ public abstract class AbstractRequest<T> implements Callback<T> { private static final String base_url = "http://apps.cloudsoftct.com/"; protected Context context; protected Interface_all_links_here _interface; private ProcessResponceIntrphase<T> responcehandler; public AbstractRequest(Context con,ProcessResponceIntrphase<T> rhandler){ context= con; responcehandler =rhandler; HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(); loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY); Retrofit retrofit= new Retrofit.Builder() .baseUrl(base_url) .client(new OkHttpClient.Builder().addNetworkInterceptor(loggingInterceptor) .connectTimeout(300, TimeUnit.SECONDS) .readTimeout(300,TimeUnit.SECONDS) .build()) .addConverterFactory(JacksonConverterFactory.create()) .build(); _interface=retrofit.create(Interface_all_links_here.class); } @Override public void onResponse(Call<T> call, Response<T> response) { Log.e("response", " ok"); processResponse(response.body()); } @Override public void onFailure(Call<T> call, Throwable t) { Log.e("response ", t.getMessage()+" poe"); processResponse(null); } private void processResponse(T response){ if(responcehandler != null){ responcehandler.processResponce(response); } } }