SlideShare a Scribd company logo
1 of 26
Tips & Third Party
Library for Android
OLEH IBNU SINA WARDY
Overview
Action Bar
Sliding Menu
JSON Parsing
Tablet Dimension
TIPS & THIRD PARTY LIBRARY FOR ANDROID 2
Action Bar
TIPS & THIRD PARTY LIBRARY FOR ANDROID 3
Action Bar
ICS Froyo
TIPS & THIRD PARTY LIBRARY FOR ANDROID 4
Action Bar
ICS Froyo
getActionBar().setDisplayHomeAsUpEnabled(true);
TIPS & THIRD PARTY LIBRARY FOR ANDROID 5
Action Bar
ICS Froyo
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
Library agar ActionBar tetap ada
untuk device di bawah Honeycomb:
ActionBarSherlock
http://actionbarsherlock.com
TIPS & THIRD PARTY LIBRARY FOR ANDROID 6
Cara Pakai
ActionBarSherlock
Import Project di Eclipse dan tambahkan sebagai library untuk aplikasi
Gunakan extend milik library
◦ Activity  SherlockActivity
◦ Fragment  SherlockFragment
◦ FragmentActivity  SherlockFragmentActivity
◦ ListAcitivity  SherlockListAcitivity
Untuk mengakses Action Bar, gunakan getSupportActionBar()
Pastikan gunakan class milik ActionBarSherlock
◦ com.actionbarsherlock.app.ActionBar
◦ com.actionbarsherlock.view.Menu
◦ com.actionbarsherlock.view.MenuItem
◦ com.actionbarsherlock.view.MenuInflater
TIPS & THIRD PARTY LIBRARY FOR ANDROID 7
Sliding Menu
TIPS & THIRD PARTY LIBRARY FOR ANDROID 8
Navigation Drawer
TIPS & THIRD PARTY LIBRARY FOR ANDROID 9
Membuat Drawer Layout
TIPS & THIRD PARTY LIBRARY FOR ANDROID 10
Membuat Aksi Buka / Tutup
DrawerLayout mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close) {
/** Called when a drawer has settled in a completely closed state. */
public void onDrawerClosed(View view) {
getActionBar().setTitle(mTitle);
invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
}
/** Called when a drawer has settled in a completely open state. */
public void onDrawerOpened(View drawerView) {
getActionBar().setTitle(mDrawerTitle);
invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
}
};
// Set the drawer toggle as the DrawerListener
mDrawerLayout.setDrawerListener(mDrawerToggle);
TIPS & THIRD PARTY LIBRARY FOR ANDROID 11
Buka / Tutup dengan icon
up
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
mDrawerToggle = new ActionBarDrawerToggle(
this, /* host Activity */
mDrawerLayout, /* DrawerLayout object */
R.drawable.ic_drawer, /* nav drawer icon to replace 'Up' caret */
R.string.drawer_open, /* "open drawer" description */
R.string.drawer_close /* "close drawer" description */
) {
/** Called when a drawer has settled in a completely closed state. */
public void onDrawerClosed(View view) {
getActionBar().setTitle(mTitle);
}
/** Called when a drawer has settled in a completely open state. */
public void onDrawerOpened(View drawerView) {
getActionBar().setTitle(mDrawerTitle);
}
};
// Set the drawer toggle as the DrawerListener
mDrawerLayout.setDrawerListener(mDrawerToggle);
getActionBar().setDisplayHomeAsUpEnabled(true);
getActionBar().setHomeButtonEnabled(true);
TIPS & THIRD PARTY LIBRARY FOR ANDROID 12
Library SlidingMenu
Url: https://github.com/jfeinstein10/SlidingMenu
Lebih mudah diimplementasikan
Dapat membuat sliding menu di kiri dan di kanan
Tetapi:
◦ Tidak mempunyai icon garis tiga di actionbar
◦ Menu tidak floating di atas konten
TIPS & THIRD PARTY LIBRARY FOR ANDROID 13
Penggunakan SlidingMenu
TIPS & THIRD PARTY LIBRARY FOR ANDROID 14
JSON Parsing
TIPS & THIRD PARTY LIBRARY FOR ANDROID 15
JSON
TIPS & THIRD PARTY LIBRARY FOR ANDROID 16
Basic Parsing
JSONObject jObj = new JSONObject(strFromUrl);
int id = jObj.getInt("id");
String name = jObj.getString("name");
String address = jObj.getString("address");
String contact = jObj.getString("contact");
//.... dan seterusnya
TIPS & THIRD PARTY LIBRARY FOR ANDROID 17
Gson
Unduh library Gson
◦ https://code.google.com/p/google-gson/
Ekstrak hasil unduh dan letakkan library jar ke folder libs di project
Buat kelas model yang mempresentasikan json yang akan diparsing
TIPS & THIRD PARTY LIBRARY FOR ANDROID 18
Contoh kelas model
public class RestaurantDao {
String id;
String name;
String address;
String contact;
String links;
String about;
String lat;
String lng;
String currency;
String minprice;
String maxprice;
//.... dan seterusnya
}
TIPS & THIRD PARTY LIBRARY FOR ANDROID 19
Parsing menggunakan
Gson
Gson gson = new Gson();
RestaurantDao restaurant = gson.fromJson(strFromUrl,
RestaurantDao.class);
TIPS & THIRD PARTY LIBRARY FOR ANDROID 20
Tablet
Dimension
TIPS & THIRD PARTY LIBRARY FOR ANDROID 21
Dimension for Tablet
Nexus S Galaxy Tab 10.1
TIPS & THIRD PARTY LIBRARY FOR ANDROID 22
dimens.xml
/values/dimens.xml
/values-sw600dp/dimens.xml
<resources>
<dimen name=“text_14sp”>14sp</dimen>
<dimen name=“dimen_10dp”>10dp</dimen>
</resources>
<resources>
<dimen name=“text_14sp”>24sp</dimen>
<dimen name=“dimen_10dp”>20dp</dimen>
</resources>
TIPS & THIRD PARTY LIBRARY FOR ANDROID 23
Dimension compatibility
Nexus S Galaxy Tab 10.1
TIPS & THIRD PARTY LIBRARY FOR ANDROID 24
Work with Us - PT GITS Indonesia
Jalan Jatimulya 1 No 14, Bandung
Jalan Rembang No 17, Menteng, Jakarta Pusat
26

More Related Content

Viewers also liked

Security threats in Android OS + App Permissions
Security threats in Android OS + App PermissionsSecurity threats in Android OS + App Permissions
Security threats in Android OS + App PermissionsHariharan Ganesan
 
Anatomizing online payment systems: hack to shop
Anatomizing online payment systems: hack to shopAnatomizing online payment systems: hack to shop
Anatomizing online payment systems: hack to shopAbhinav Mishra
 
Android training day 4
Android training day 4Android training day 4
Android training day 4Vivek Bhusal
 
Android permission system
Android permission systemAndroid permission system
Android permission systemShivang Goel
 
Sandbox Introduction
Sandbox IntroductionSandbox Introduction
Sandbox Introductionmsimkin
 
Android permission system
Android permission systemAndroid permission system
Android permission systemShivang Goel
 
Android secuirty permission - upload
Android secuirty   permission - uploadAndroid secuirty   permission - upload
Android secuirty permission - uploadBin Yang
 
Android AsyncTask Tutorial
Android AsyncTask TutorialAndroid AsyncTask Tutorial
Android AsyncTask TutorialPerfect APK
 
Android 6.0 permission change
Android 6.0 permission changeAndroid 6.0 permission change
Android 6.0 permission change彥彬 洪
 
Simple JSON parser
Simple JSON parserSimple JSON parser
Simple JSON parserDongjun Lee
 
Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011pundiramit
 
Android webservices
Android webservicesAndroid webservices
Android webservicesKrazy Koder
 
Android json parser tutorial – example
Android json parser tutorial – exampleAndroid json parser tutorial – example
Android json parser tutorial – exampleRajat Ghai
 
Android security
Android securityAndroid security
Android securityKrazy Koder
 

Viewers also liked (20)

Security threats in Android OS + App Permissions
Security threats in Android OS + App PermissionsSecurity threats in Android OS + App Permissions
Security threats in Android OS + App Permissions
 
Android(1)
Android(1)Android(1)
Android(1)
 
Anatomizing online payment systems: hack to shop
Anatomizing online payment systems: hack to shopAnatomizing online payment systems: hack to shop
Anatomizing online payment systems: hack to shop
 
Android training day 4
Android training day 4Android training day 4
Android training day 4
 
Android permission system
Android permission systemAndroid permission system
Android permission system
 
Sandbox Introduction
Sandbox IntroductionSandbox Introduction
Sandbox Introduction
 
Android permission system
Android permission systemAndroid permission system
Android permission system
 
Android secuirty permission - upload
Android secuirty   permission - uploadAndroid secuirty   permission - upload
Android secuirty permission - upload
 
Android AsyncTask Tutorial
Android AsyncTask TutorialAndroid AsyncTask Tutorial
Android AsyncTask Tutorial
 
Android 6.0 permission change
Android 6.0 permission changeAndroid 6.0 permission change
Android 6.0 permission change
 
Json Tutorial
Json TutorialJson Tutorial
Json Tutorial
 
Android new permission model
Android new permission modelAndroid new permission model
Android new permission model
 
Basic Android Push Notification
Basic Android Push NotificationBasic Android Push Notification
Basic Android Push Notification
 
JSON overview and demo
JSON overview and demoJSON overview and demo
JSON overview and demo
 
Simple JSON parser
Simple JSON parserSimple JSON parser
Simple JSON parser
 
App Permissions
App PermissionsApp Permissions
App Permissions
 
Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011
 
Android webservices
Android webservicesAndroid webservices
Android webservices
 
Android json parser tutorial – example
Android json parser tutorial – exampleAndroid json parser tutorial – example
Android json parser tutorial – example
 
Android security
Android securityAndroid security
Android security
 

Similar to Tips dan Third Party Library untuk Android - Part 1

Material Design and Backwards Compatibility
Material Design and Backwards CompatibilityMaterial Design and Backwards Compatibility
Material Design and Backwards CompatibilityAngelo Rüggeberg
 
Android Lollipop - Webinar am 11.12.2014
Android Lollipop - Webinar am 11.12.2014Android Lollipop - Webinar am 11.12.2014
Android Lollipop - Webinar am 11.12.2014inovex GmbH
 
Android Sliding Menu dengan Navigation Drawer
Android Sliding Menu dengan Navigation DrawerAndroid Sliding Menu dengan Navigation Drawer
Android Sliding Menu dengan Navigation DrawerAgus Haryanto
 
ActionBar and Holo in Android 2+
ActionBar and Holo in Android 2+ActionBar and Holo in Android 2+
ActionBar and Holo in Android 2+Michal Pavlasek
 
APPlause - DemoCamp Munich
APPlause - DemoCamp MunichAPPlause - DemoCamp Munich
APPlause - DemoCamp MunichPeter Friese
 
My Favourite 10 Things about Xcode/ObjectiveC
My Favourite 10 Things about Xcode/ObjectiveCMy Favourite 10 Things about Xcode/ObjectiveC
My Favourite 10 Things about Xcode/ObjectiveCJohnKennedy
 
Action Bar Sherlock tutorial
Action Bar Sherlock tutorialAction Bar Sherlock tutorial
Action Bar Sherlock tutorialAhsanul Karim
 
Android basic 4 Navigation Drawer
Android basic 4 Navigation DrawerAndroid basic 4 Navigation Drawer
Android basic 4 Navigation DrawerEakapong Kattiya
 
Android Support Library: Using ActionBarCompat
Android Support Library: Using ActionBarCompatAndroid Support Library: Using ActionBarCompat
Android Support Library: Using ActionBarCompatcbeyls
 
Dinosaurs and Androids: The Listview Evolution
Dinosaurs and Androids: The Listview EvolutionDinosaurs and Androids: The Listview Evolution
Dinosaurs and Androids: The Listview EvolutionFernando Cejas
 
Workshop 26: React Native - The Native Side
Workshop 26: React Native - The Native SideWorkshop 26: React Native - The Native Side
Workshop 26: React Native - The Native SideVisual Engineering
 
Android App Development - 05 Action bar
Android App Development - 05 Action barAndroid App Development - 05 Action bar
Android App Development - 05 Action barDiego Grancini
 
Android Survival Guide - Two years of software development
Android Survival Guide - Two years of software developmentAndroid Survival Guide - Two years of software development
Android Survival Guide - Two years of software developmentAlfredo Morresi
 
Android Bootstrap
Android BootstrapAndroid Bootstrap
Android Bootstrapdonnfelker
 
Android Design Patterns
Android Design PatternsAndroid Design Patterns
Android Design PatternsGodfrey Nolan
 
More android code puzzles
More android code puzzlesMore android code puzzles
More android code puzzlesDanny Preussler
 

Similar to Tips dan Third Party Library untuk Android - Part 1 (20)

Material Design and Backwards Compatibility
Material Design and Backwards CompatibilityMaterial Design and Backwards Compatibility
Material Design and Backwards Compatibility
 
Android Lollipop - Webinar am 11.12.2014
Android Lollipop - Webinar am 11.12.2014Android Lollipop - Webinar am 11.12.2014
Android Lollipop - Webinar am 11.12.2014
 
Android Sliding Menu dengan Navigation Drawer
Android Sliding Menu dengan Navigation DrawerAndroid Sliding Menu dengan Navigation Drawer
Android Sliding Menu dengan Navigation Drawer
 
Action bar
Action barAction bar
Action bar
 
ActionBar and Holo in Android 2+
ActionBar and Holo in Android 2+ActionBar and Holo in Android 2+
ActionBar and Holo in Android 2+
 
APPlause - DemoCamp Munich
APPlause - DemoCamp MunichAPPlause - DemoCamp Munich
APPlause - DemoCamp Munich
 
My Favourite 10 Things about Xcode/ObjectiveC
My Favourite 10 Things about Xcode/ObjectiveCMy Favourite 10 Things about Xcode/ObjectiveC
My Favourite 10 Things about Xcode/ObjectiveC
 
Action Bar Sherlock tutorial
Action Bar Sherlock tutorialAction Bar Sherlock tutorial
Action Bar Sherlock tutorial
 
Android basic 4 Navigation Drawer
Android basic 4 Navigation DrawerAndroid basic 4 Navigation Drawer
Android basic 4 Navigation Drawer
 
Android Support Library: Using ActionBarCompat
Android Support Library: Using ActionBarCompatAndroid Support Library: Using ActionBarCompat
Android Support Library: Using ActionBarCompat
 
Dinosaurs and Androids: The Listview Evolution
Dinosaurs and Androids: The Listview EvolutionDinosaurs and Androids: The Listview Evolution
Dinosaurs and Androids: The Listview Evolution
 
Action Bar in Android
Action Bar in AndroidAction Bar in Android
Action Bar in Android
 
Workshop 26: React Native - The Native Side
Workshop 26: React Native - The Native SideWorkshop 26: React Native - The Native Side
Workshop 26: React Native - The Native Side
 
Android App Development - 05 Action bar
Android App Development - 05 Action barAndroid App Development - 05 Action bar
Android App Development - 05 Action bar
 
Android Survival Guide - Two years of software development
Android Survival Guide - Two years of software developmentAndroid Survival Guide - Two years of software development
Android Survival Guide - Two years of software development
 
Android Bootstrap
Android BootstrapAndroid Bootstrap
Android Bootstrap
 
Fewd week6 slides
Fewd week6 slidesFewd week6 slides
Fewd week6 slides
 
Android Design Patterns
Android Design PatternsAndroid Design Patterns
Android Design Patterns
 
More android code puzzles
More android code puzzlesMore android code puzzles
More android code puzzles
 
Android 3
Android 3Android 3
Android 3
 

Recently uploaded

Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 

Recently uploaded (20)

Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Tips dan Third Party Library untuk Android - Part 1

  • 1. Tips & Third Party Library for Android OLEH IBNU SINA WARDY
  • 2. Overview Action Bar Sliding Menu JSON Parsing Tablet Dimension TIPS & THIRD PARTY LIBRARY FOR ANDROID 2
  • 3. Action Bar TIPS & THIRD PARTY LIBRARY FOR ANDROID 3
  • 4. Action Bar ICS Froyo TIPS & THIRD PARTY LIBRARY FOR ANDROID 4
  • 6. Action Bar ICS Froyo getSupportActionBar().setDisplayHomeAsUpEnabled(true); Library agar ActionBar tetap ada untuk device di bawah Honeycomb: ActionBarSherlock http://actionbarsherlock.com TIPS & THIRD PARTY LIBRARY FOR ANDROID 6
  • 7. Cara Pakai ActionBarSherlock Import Project di Eclipse dan tambahkan sebagai library untuk aplikasi Gunakan extend milik library ◦ Activity  SherlockActivity ◦ Fragment  SherlockFragment ◦ FragmentActivity  SherlockFragmentActivity ◦ ListAcitivity  SherlockListAcitivity Untuk mengakses Action Bar, gunakan getSupportActionBar() Pastikan gunakan class milik ActionBarSherlock ◦ com.actionbarsherlock.app.ActionBar ◦ com.actionbarsherlock.view.Menu ◦ com.actionbarsherlock.view.MenuItem ◦ com.actionbarsherlock.view.MenuInflater TIPS & THIRD PARTY LIBRARY FOR ANDROID 7
  • 8. Sliding Menu TIPS & THIRD PARTY LIBRARY FOR ANDROID 8
  • 9. Navigation Drawer TIPS & THIRD PARTY LIBRARY FOR ANDROID 9
  • 10. Membuat Drawer Layout TIPS & THIRD PARTY LIBRARY FOR ANDROID 10
  • 11. Membuat Aksi Buka / Tutup DrawerLayout mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close) { /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { getActionBar().setTitle(mTitle); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } /** Called when a drawer has settled in a completely open state. */ public void onDrawerOpened(View drawerView) { getActionBar().setTitle(mDrawerTitle); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } }; // Set the drawer toggle as the DrawerListener mDrawerLayout.setDrawerListener(mDrawerToggle); TIPS & THIRD PARTY LIBRARY FOR ANDROID 11
  • 12. Buka / Tutup dengan icon up mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerToggle = new ActionBarDrawerToggle( this, /* host Activity */ mDrawerLayout, /* DrawerLayout object */ R.drawable.ic_drawer, /* nav drawer icon to replace 'Up' caret */ R.string.drawer_open, /* "open drawer" description */ R.string.drawer_close /* "close drawer" description */ ) { /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { getActionBar().setTitle(mTitle); } /** Called when a drawer has settled in a completely open state. */ public void onDrawerOpened(View drawerView) { getActionBar().setTitle(mDrawerTitle); } }; // Set the drawer toggle as the DrawerListener mDrawerLayout.setDrawerListener(mDrawerToggle); getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar().setHomeButtonEnabled(true); TIPS & THIRD PARTY LIBRARY FOR ANDROID 12
  • 13. Library SlidingMenu Url: https://github.com/jfeinstein10/SlidingMenu Lebih mudah diimplementasikan Dapat membuat sliding menu di kiri dan di kanan Tetapi: ◦ Tidak mempunyai icon garis tiga di actionbar ◦ Menu tidak floating di atas konten TIPS & THIRD PARTY LIBRARY FOR ANDROID 13
  • 14. Penggunakan SlidingMenu TIPS & THIRD PARTY LIBRARY FOR ANDROID 14
  • 15. JSON Parsing TIPS & THIRD PARTY LIBRARY FOR ANDROID 15
  • 16. JSON TIPS & THIRD PARTY LIBRARY FOR ANDROID 16
  • 17. Basic Parsing JSONObject jObj = new JSONObject(strFromUrl); int id = jObj.getInt("id"); String name = jObj.getString("name"); String address = jObj.getString("address"); String contact = jObj.getString("contact"); //.... dan seterusnya TIPS & THIRD PARTY LIBRARY FOR ANDROID 17
  • 18. Gson Unduh library Gson ◦ https://code.google.com/p/google-gson/ Ekstrak hasil unduh dan letakkan library jar ke folder libs di project Buat kelas model yang mempresentasikan json yang akan diparsing TIPS & THIRD PARTY LIBRARY FOR ANDROID 18
  • 19. Contoh kelas model public class RestaurantDao { String id; String name; String address; String contact; String links; String about; String lat; String lng; String currency; String minprice; String maxprice; //.... dan seterusnya } TIPS & THIRD PARTY LIBRARY FOR ANDROID 19
  • 20. Parsing menggunakan Gson Gson gson = new Gson(); RestaurantDao restaurant = gson.fromJson(strFromUrl, RestaurantDao.class); TIPS & THIRD PARTY LIBRARY FOR ANDROID 20
  • 21. Tablet Dimension TIPS & THIRD PARTY LIBRARY FOR ANDROID 21
  • 22. Dimension for Tablet Nexus S Galaxy Tab 10.1 TIPS & THIRD PARTY LIBRARY FOR ANDROID 22
  • 23. dimens.xml /values/dimens.xml /values-sw600dp/dimens.xml <resources> <dimen name=“text_14sp”>14sp</dimen> <dimen name=“dimen_10dp”>10dp</dimen> </resources> <resources> <dimen name=“text_14sp”>24sp</dimen> <dimen name=“dimen_10dp”>20dp</dimen> </resources> TIPS & THIRD PARTY LIBRARY FOR ANDROID 23
  • 24. Dimension compatibility Nexus S Galaxy Tab 10.1 TIPS & THIRD PARTY LIBRARY FOR ANDROID 24
  • 25.
  • 26. Work with Us - PT GITS Indonesia Jalan Jatimulya 1 No 14, Bandung Jalan Rembang No 17, Menteng, Jakarta Pusat 26