SlideShare a Scribd company logo
1 of 16
Download to read offline
ANDROID AND
 JELLYBEAN
 TIPS AND TRICKS


Faisal Abid   @faisalabid
              www.faisalabid.com
WHO AM I?

 • Software developer working with Android since 	
 	 the beta days
 • Started working in Node.js and Coffeescript for
 	 the past year.
 • Software Engineer at Kobo
 • Co-Author Flex 3 in Action
 • Entrepreneur, Author, Teacher & Developer




Faisal Abid   @faisalabid
              www.faisalabid.com
ABOUT THIS TALK



 • Learn some of the tips and tricks I’ve learnt over the years
 • Working at Kobo and building an Android tablet, you pick 	
 	 up on a few cool things.
 • I want to share these things with you!




Faisal Abid   @faisalabid
              www.faisalabid.com
1. AppStackNavigation

 • Up and Back are two different things now. As if things 		
 	 weren’t bad enough.
 • Up means going up to the next page in the app.
 • Back means going back irrespective of where you are.
 • You can control this stuff in code but it gets messy.
 • Android Jellybean introduces the new ParentActivity tag 	
 	 in the manifest




Faisal Abid   @faisalabid
              www.faisalabid.com
2. Getting Media Thumbnails

 • Getting thumbnails from Android videos is very weird.
 • ICS’s new MediaMetadataRetriever makes it easy

     private Bitmap getThumbnailForVideoUri(Context cx, Uri contentURI) {
     		       MediaMetadataRetriever retriever = new MediaMetadataRetriever();
     		try {
     			retriever.setDataSource(cx, contentURI);	
     			return retriever.getFrameAtTime();
     		       } catch (Exception e) {
     			// exception
     		}
     	}



Faisal Abid   @faisalabid
              www.faisalabid.com
3. Set Alarm Programmatically

 • I honestly had no idea you could do this!
 • Set an alarm programmatically. Not an AlarmManager 		
 	 alarm, but an actual alarm.


     Intent i = new Intent(AlarmClock.ACTION_SET_ALARM);




Faisal Abid   @faisalabid
              www.faisalabid.com
4. Handle Bitmap OOM Errors



 • Lots and lots of ways exist.
 • Tried many solutions
 • This one worked the best




Faisal Abid   @faisalabid
              www.faisalabid.com
5. Handling Awesome progress animations


 • I love progress loaders. Really set the app apart
 • WhereIsMyBus has a cool progress loader
 • AnimationDrawable will give you OOM.
 • AnimationDrawable loves to load up all the items in 			
 	 memory.
 • Solution is by “Yar” from StackOverFlow
 	 http://bit.ly/OsGSsb




Faisal Abid   @faisalabid
              www.faisalabid.com
6. ActivityAnimations



 • Simple but cool. In Jellybean Android added
 	 new activity animation.
 • Take advantage of them!




Faisal Abid   @faisalabid
              www.faisalabid.com
7. Animation keeps getting better


 • With Project Butter. Android Animation keeps getting 		
 	 better.
 • Use the built-in .animate() class to get full performance.
 • No need to learn OpenGL or anything else for
 	 trivial animations.




Faisal Abid   @faisalabid
              www.faisalabid.com
8. ContentProvider with custom methods!



 • Honeycomb introduced this.
 • Not widely known.
 • call() you can add all the cool stuff you want.
 • Built system wide image cache on the Arc.




Faisal Abid   @faisalabid
              www.faisalabid.com
9. Monkey




 • Still not used as much as you should
 • Simple as running monkeyrunner.




Faisal Abid   @faisalabid
              www.faisalabid.com
10. Async Tasks have changed!




 • ICS, AsyncTasks run in a single threaded threadpool now.
 • To change it run it on an executor.




Faisal Abid   @faisalabid
              www.faisalabid.com
11. Security Changes to Android


 • More of a PSA
 • Soon android users will be required to allow the app to 		
 	 Read SD card.
 • Read_External_storage is a good permission to have, 			
 	 Start thinking about it.
 • You’ll get a filenotfound exception if you don’t have it.
 • If you have Write_External_storage you are good




Faisal Abid   @faisalabid
              www.faisalabid.com
11.5. More security changes




 • As of Android 3.1, no BroadcastReceiver will work until 		
 	 the user has manually launched an activity




Faisal Abid   @faisalabid
              www.faisalabid.com
THANK YOU!


Faisal Abid   @faisalabid
              www.faisalabid.com

More Related Content

What's hot

Introduction to Cross Platform Natitve Mobile Development with C# and Xamarin
Introduction to Cross Platform Natitve Mobile Development with C# and XamarinIntroduction to Cross Platform Natitve Mobile Development with C# and Xamarin
Introduction to Cross Platform Natitve Mobile Development with C# and XamarinJames Montemagno
 
Dallas Android - Android & iOS Development in C# with Xamarin
Dallas Android - Android & iOS Development in C# with XamarinDallas Android - Android & iOS Development in C# with Xamarin
Dallas Android - Android & iOS Development in C# with XamarinJames Montemagno
 
FITC Sneak Peek 2012
FITC Sneak Peek 2012FITC Sneak Peek 2012
FITC Sneak Peek 2012Faisal Abid
 
Building a mobile game in Xamarin.Forms
Building a mobile game in Xamarin.FormsBuilding a mobile game in Xamarin.Forms
Building a mobile game in Xamarin.FormsShaunLawrence9
 
Update Smart: Use a Staging Site!
Update Smart: Use a Staging Site!Update Smart: Use a Staging Site!
Update Smart: Use a Staging Site!Meagan Hanes
 
Tech saloniki - Cross platform mobile development using xamarin
Tech saloniki  - Cross platform mobile development using xamarinTech saloniki  - Cross platform mobile development using xamarin
Tech saloniki - Cross platform mobile development using xamarinGeorge Spyrou
 
Dont Break Live lightning talk
Dont Break Live lightning talkDont Break Live lightning talk
Dont Break Live lightning talkJamie Schmid
 
Web, Native iOS and Native Android with One Ember.js App
Web, Native iOS and Native Android with One Ember.js AppWeb, Native iOS and Native Android with One Ember.js App
Web, Native iOS and Native Android with One Ember.js AppFITC
 
Pain Free Frontend Development
Pain Free Frontend DevelopmentPain Free Frontend Development
Pain Free Frontend DevelopmentVanessa Böhner
 
iOS Development Talk - KP Digital Youth Summit 2014
iOS Development Talk - KP Digital Youth Summit 2014iOS Development Talk - KP Digital Youth Summit 2014
iOS Development Talk - KP Digital Youth Summit 2014Usman Khan
 
Building High Performance Web Applications
Building High Performance Web ApplicationsBuilding High Performance Web Applications
Building High Performance Web ApplicationsJeff Whelpley
 
Couchbase Workshop - Introduction to Xamarin
Couchbase Workshop - Introduction to XamarinCouchbase Workshop - Introduction to Xamarin
Couchbase Workshop - Introduction to XamarinJames Montemagno
 
DevOpsDays Austin - Configuration Management Evolution
DevOpsDays Austin - Configuration Management EvolutionDevOpsDays Austin - Configuration Management Evolution
DevOpsDays Austin - Configuration Management Evolutionjoehack3r
 
SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...
SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...
SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...Sébastien Levert
 
Spooky WordPress: Disturbingly Brilliant Uses of WP
Spooky WordPress: Disturbingly Brilliant Uses of WPSpooky WordPress: Disturbingly Brilliant Uses of WP
Spooky WordPress: Disturbingly Brilliant Uses of WPBrad Williams
 
SharePoint Fest DC - SharePoint Framework, Angular and Azure Functions
SharePoint Fest DC - SharePoint Framework, Angular and Azure FunctionsSharePoint Fest DC - SharePoint Framework, Angular and Azure Functions
SharePoint Fest DC - SharePoint Framework, Angular and Azure FunctionsSébastien Levert
 
SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...
SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...
SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...Sébastien Levert
 

What's hot (20)

Introduction to Cross Platform Natitve Mobile Development with C# and Xamarin
Introduction to Cross Platform Natitve Mobile Development with C# and XamarinIntroduction to Cross Platform Natitve Mobile Development with C# and Xamarin
Introduction to Cross Platform Natitve Mobile Development with C# and Xamarin
 
Dallas Android - Android & iOS Development in C# with Xamarin
Dallas Android - Android & iOS Development in C# with XamarinDallas Android - Android & iOS Development in C# with Xamarin
Dallas Android - Android & iOS Development in C# with Xamarin
 
FITC Sneak Peek 2012
FITC Sneak Peek 2012FITC Sneak Peek 2012
FITC Sneak Peek 2012
 
Building a mobile game in Xamarin.Forms
Building a mobile game in Xamarin.FormsBuilding a mobile game in Xamarin.Forms
Building a mobile game in Xamarin.Forms
 
Update Smart: Use a Staging Site!
Update Smart: Use a Staging Site!Update Smart: Use a Staging Site!
Update Smart: Use a Staging Site!
 
Why we choose Skype ?
Why we choose Skype ?Why we choose Skype ?
Why we choose Skype ?
 
Tech saloniki - Cross platform mobile development using xamarin
Tech saloniki  - Cross platform mobile development using xamarinTech saloniki  - Cross platform mobile development using xamarin
Tech saloniki - Cross platform mobile development using xamarin
 
Dont Break Live lightning talk
Dont Break Live lightning talkDont Break Live lightning talk
Dont Break Live lightning talk
 
Web, Native iOS and Native Android with One Ember.js App
Web, Native iOS and Native Android with One Ember.js AppWeb, Native iOS and Native Android with One Ember.js App
Web, Native iOS and Native Android with One Ember.js App
 
Pain Free Frontend Development
Pain Free Frontend DevelopmentPain Free Frontend Development
Pain Free Frontend Development
 
Quick test
Quick testQuick test
Quick test
 
iOS Development Talk - KP Digital Youth Summit 2014
iOS Development Talk - KP Digital Youth Summit 2014iOS Development Talk - KP Digital Youth Summit 2014
iOS Development Talk - KP Digital Youth Summit 2014
 
Building High Performance Web Applications
Building High Performance Web ApplicationsBuilding High Performance Web Applications
Building High Performance Web Applications
 
Couchbase Workshop - Introduction to Xamarin
Couchbase Workshop - Introduction to XamarinCouchbase Workshop - Introduction to Xamarin
Couchbase Workshop - Introduction to Xamarin
 
DevOpsDays Austin - Configuration Management Evolution
DevOpsDays Austin - Configuration Management EvolutionDevOpsDays Austin - Configuration Management Evolution
DevOpsDays Austin - Configuration Management Evolution
 
SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...
SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...
SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...
 
SPA Flask Vue
SPA Flask VueSPA Flask Vue
SPA Flask Vue
 
Spooky WordPress: Disturbingly Brilliant Uses of WP
Spooky WordPress: Disturbingly Brilliant Uses of WPSpooky WordPress: Disturbingly Brilliant Uses of WP
Spooky WordPress: Disturbingly Brilliant Uses of WP
 
SharePoint Fest DC - SharePoint Framework, Angular and Azure Functions
SharePoint Fest DC - SharePoint Framework, Angular and Azure FunctionsSharePoint Fest DC - SharePoint Framework, Angular and Azure Functions
SharePoint Fest DC - SharePoint Framework, Angular and Azure Functions
 
SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...
SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...
SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...
 

Similar to FITC 2012 Jellybean Tips and Tricks

Google's Obsession with Sweet Treats. What's new in ICS and the Future of And...
Google's Obsession with Sweet Treats. What's new in ICS and the Future of And...Google's Obsession with Sweet Treats. What's new in ICS and the Future of And...
Google's Obsession with Sweet Treats. What's new in ICS and the Future of And...Faisal Abid
 
Phonegap - An Introduction
Phonegap - An IntroductionPhonegap - An Introduction
Phonegap - An IntroductionTyler Johnston
 
Firebase remote config tips & tricks
Firebase remote config tips & tricksFirebase remote config tips & tricks
Firebase remote config tips & tricksGameCamp
 
Rise of the hybrids
Rise of the hybridsRise of the hybrids
Rise of the hybridsOron Ben Zvi
 
Discover Android Wear
Discover Android WearDiscover Android Wear
Discover Android WearTroy Miles
 
Joomla as a mobile App backend - ideas, examples and experiences
Joomla as a mobile App backend - ideas, examples and experiencesJoomla as a mobile App backend - ideas, examples and experiences
Joomla as a mobile App backend - ideas, examples and experiencesAndy_Gaskell
 
React native - React(ive) Way To Build Native Mobile Apps
React native - React(ive) Way To Build Native Mobile AppsReact native - React(ive) Way To Build Native Mobile Apps
React native - React(ive) Way To Build Native Mobile AppsJimit Shah
 
Build Your First Android App Session #1
Build Your First Android App Session #1Build Your First Android App Session #1
Build Your First Android App Session #1Troy Miles
 
Appcelerator Titanium Intro
Appcelerator Titanium IntroAppcelerator Titanium Intro
Appcelerator Titanium IntroNicholas Jansma
 
«I knew there had to be a better way to build mobile app»​
«I knew there had to be a better way to build mobile app»​«I knew there had to be a better way to build mobile app»​
«I knew there had to be a better way to build mobile app»​FDConf
 
AliExpress’ Way to Microservices - microXchg 2017
AliExpress’ Way to Microservices  - microXchg 2017AliExpress’ Way to Microservices  - microXchg 2017
AliExpress’ Way to Microservices - microXchg 2017juvenxu
 
[React-Native Tutorial 10] Camera Roll / Gallery / Camera / Native Modules by...
[React-Native Tutorial 10] Camera Roll / Gallery / Camera / Native Modules by...[React-Native Tutorial 10] Camera Roll / Gallery / Camera / Native Modules by...
[React-Native Tutorial 10] Camera Roll / Gallery / Camera / Native Modules by...Kobkrit Viriyayudhakorn
 
11 Amazing things I Learnt At Word Camp Sydney 2014
11 Amazing things I Learnt At Word Camp Sydney 201411 Amazing things I Learnt At Word Camp Sydney 2014
11 Amazing things I Learnt At Word Camp Sydney 2014WordPressBrisbane
 
Skip the IDE with PhoneGap Build
Skip the IDE with PhoneGap BuildSkip the IDE with PhoneGap Build
Skip the IDE with PhoneGap BuildTerry Ryan
 
Server Driven UI in iOS
Server Driven UI in iOSServer Driven UI in iOS
Server Driven UI in iOSMohammad Azam
 
I knew there had to be a better way to build mobile apps
I knew there had to be a better way to build mobile appsI knew there had to be a better way to build mobile apps
I knew there had to be a better way to build mobile appsAlius Petraška
 
Ionic intro + tips
Ionic intro + tipsIonic intro + tips
Ionic intro + tipsTony May
 
Experiences building apps with React Native @DomCode 2016
Experiences building apps with React Native @DomCode 2016Experiences building apps with React Native @DomCode 2016
Experiences building apps with React Native @DomCode 2016Adrian Philipp
 
Reark : a Reference Architecture for Android using RxJava
Reark : a Reference Architecture for Android using RxJavaReark : a Reference Architecture for Android using RxJava
Reark : a Reference Architecture for Android using RxJavaFuturice
 

Similar to FITC 2012 Jellybean Tips and Tricks (20)

Google's Obsession with Sweet Treats. What's new in ICS and the Future of And...
Google's Obsession with Sweet Treats. What's new in ICS and the Future of And...Google's Obsession with Sweet Treats. What's new in ICS and the Future of And...
Google's Obsession with Sweet Treats. What's new in ICS and the Future of And...
 
Phonegap - An Introduction
Phonegap - An IntroductionPhonegap - An Introduction
Phonegap - An Introduction
 
Firebase remote config tips & tricks
Firebase remote config tips & tricksFirebase remote config tips & tricks
Firebase remote config tips & tricks
 
Rise of the hybrids
Rise of the hybridsRise of the hybrids
Rise of the hybrids
 
Discover Android Wear
Discover Android WearDiscover Android Wear
Discover Android Wear
 
Joomla as a mobile App backend - ideas, examples and experiences
Joomla as a mobile App backend - ideas, examples and experiencesJoomla as a mobile App backend - ideas, examples and experiences
Joomla as a mobile App backend - ideas, examples and experiences
 
React native - React(ive) Way To Build Native Mobile Apps
React native - React(ive) Way To Build Native Mobile AppsReact native - React(ive) Way To Build Native Mobile Apps
React native - React(ive) Way To Build Native Mobile Apps
 
Build Your First Android App Session #1
Build Your First Android App Session #1Build Your First Android App Session #1
Build Your First Android App Session #1
 
Appcelerator Titanium Intro
Appcelerator Titanium IntroAppcelerator Titanium Intro
Appcelerator Titanium Intro
 
«I knew there had to be a better way to build mobile app»​
«I knew there had to be a better way to build mobile app»​«I knew there had to be a better way to build mobile app»​
«I knew there had to be a better way to build mobile app»​
 
AliExpress’ Way to Microservices - microXchg 2017
AliExpress’ Way to Microservices  - microXchg 2017AliExpress’ Way to Microservices  - microXchg 2017
AliExpress’ Way to Microservices - microXchg 2017
 
[React-Native Tutorial 10] Camera Roll / Gallery / Camera / Native Modules by...
[React-Native Tutorial 10] Camera Roll / Gallery / Camera / Native Modules by...[React-Native Tutorial 10] Camera Roll / Gallery / Camera / Native Modules by...
[React-Native Tutorial 10] Camera Roll / Gallery / Camera / Native Modules by...
 
Hybrid app development with ionic
Hybrid app development with ionicHybrid app development with ionic
Hybrid app development with ionic
 
11 Amazing things I Learnt At Word Camp Sydney 2014
11 Amazing things I Learnt At Word Camp Sydney 201411 Amazing things I Learnt At Word Camp Sydney 2014
11 Amazing things I Learnt At Word Camp Sydney 2014
 
Skip the IDE with PhoneGap Build
Skip the IDE with PhoneGap BuildSkip the IDE with PhoneGap Build
Skip the IDE with PhoneGap Build
 
Server Driven UI in iOS
Server Driven UI in iOSServer Driven UI in iOS
Server Driven UI in iOS
 
I knew there had to be a better way to build mobile apps
I knew there had to be a better way to build mobile appsI knew there had to be a better way to build mobile apps
I knew there had to be a better way to build mobile apps
 
Ionic intro + tips
Ionic intro + tipsIonic intro + tips
Ionic intro + tips
 
Experiences building apps with React Native @DomCode 2016
Experiences building apps with React Native @DomCode 2016Experiences building apps with React Native @DomCode 2016
Experiences building apps with React Native @DomCode 2016
 
Reark : a Reference Architecture for Android using RxJava
Reark : a Reference Architecture for Android using RxJavaReark : a Reference Architecture for Android using RxJava
Reark : a Reference Architecture for Android using RxJava
 

FITC 2012 Jellybean Tips and Tricks

  • 1. ANDROID AND JELLYBEAN TIPS AND TRICKS Faisal Abid @faisalabid www.faisalabid.com
  • 2. WHO AM I? • Software developer working with Android since the beta days • Started working in Node.js and Coffeescript for the past year. • Software Engineer at Kobo • Co-Author Flex 3 in Action • Entrepreneur, Author, Teacher & Developer Faisal Abid @faisalabid www.faisalabid.com
  • 3. ABOUT THIS TALK • Learn some of the tips and tricks I’ve learnt over the years • Working at Kobo and building an Android tablet, you pick up on a few cool things. • I want to share these things with you! Faisal Abid @faisalabid www.faisalabid.com
  • 4. 1. AppStackNavigation • Up and Back are two different things now. As if things weren’t bad enough. • Up means going up to the next page in the app. • Back means going back irrespective of where you are. • You can control this stuff in code but it gets messy. • Android Jellybean introduces the new ParentActivity tag in the manifest Faisal Abid @faisalabid www.faisalabid.com
  • 5. 2. Getting Media Thumbnails • Getting thumbnails from Android videos is very weird. • ICS’s new MediaMetadataRetriever makes it easy private Bitmap getThumbnailForVideoUri(Context cx, Uri contentURI) { MediaMetadataRetriever retriever = new MediaMetadataRetriever(); try { retriever.setDataSource(cx, contentURI); return retriever.getFrameAtTime(); } catch (Exception e) { // exception } } Faisal Abid @faisalabid www.faisalabid.com
  • 6. 3. Set Alarm Programmatically • I honestly had no idea you could do this! • Set an alarm programmatically. Not an AlarmManager alarm, but an actual alarm. Intent i = new Intent(AlarmClock.ACTION_SET_ALARM); Faisal Abid @faisalabid www.faisalabid.com
  • 7. 4. Handle Bitmap OOM Errors • Lots and lots of ways exist. • Tried many solutions • This one worked the best Faisal Abid @faisalabid www.faisalabid.com
  • 8. 5. Handling Awesome progress animations • I love progress loaders. Really set the app apart • WhereIsMyBus has a cool progress loader • AnimationDrawable will give you OOM. • AnimationDrawable loves to load up all the items in memory. • Solution is by “Yar” from StackOverFlow http://bit.ly/OsGSsb Faisal Abid @faisalabid www.faisalabid.com
  • 9. 6. ActivityAnimations • Simple but cool. In Jellybean Android added new activity animation. • Take advantage of them! Faisal Abid @faisalabid www.faisalabid.com
  • 10. 7. Animation keeps getting better • With Project Butter. Android Animation keeps getting better. • Use the built-in .animate() class to get full performance. • No need to learn OpenGL or anything else for trivial animations. Faisal Abid @faisalabid www.faisalabid.com
  • 11. 8. ContentProvider with custom methods! • Honeycomb introduced this. • Not widely known. • call() you can add all the cool stuff you want. • Built system wide image cache on the Arc. Faisal Abid @faisalabid www.faisalabid.com
  • 12. 9. Monkey • Still not used as much as you should • Simple as running monkeyrunner. Faisal Abid @faisalabid www.faisalabid.com
  • 13. 10. Async Tasks have changed! • ICS, AsyncTasks run in a single threaded threadpool now. • To change it run it on an executor. Faisal Abid @faisalabid www.faisalabid.com
  • 14. 11. Security Changes to Android • More of a PSA • Soon android users will be required to allow the app to Read SD card. • Read_External_storage is a good permission to have, Start thinking about it. • You’ll get a filenotfound exception if you don’t have it. • If you have Write_External_storage you are good Faisal Abid @faisalabid www.faisalabid.com
  • 15. 11.5. More security changes • As of Android 3.1, no BroadcastReceiver will work until the user has manually launched an activity Faisal Abid @faisalabid www.faisalabid.com
  • 16. THANK YOU! Faisal Abid @faisalabid www.faisalabid.com