Top 5 Features of Ice Cream Sandwich with Mono for Android 4.0

10,343 views

Published on

Video for these slides: http://www.youtube.com/watch?v=CcdUq1AQfQ8

Mike has been an active member of the community since MonoTouch launched, and recently joined Xamarin's excellent documentation team. In this seminar, Mike shows you how to use 5 of the new APIs available to developers with Mono for Android 4.0 and Ice Cream Sandwich;

Calendar API
ShareActionProvider
Action Bar Tabs
TextureView
Android Beam

Published in: Technology, Business
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
10,343
On SlideShare
0
From Embeds
0
Number of Embeds
6,882
Actions
Shares
0
Downloads
48
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Top 5 Features of Ice Cream Sandwich with Mono for Android 4.0

    1. 1. Xamarin Seminar 9th February 2012 Copyright 2012 © Xamarin Inc. All rights reserved
    2. 2. AgendaTop 5 Features of Ice Cream Sandwich Mike Bluestein Technical Writer Xamarin Documentation Team mike.bluestein@xamarin.com Xamarin Copyright 2012 © Xamarin Inc. All rights reserved
    3. 3. IntroductionThis session will survey some of the new featuresavailable in Android 4 Ice Cream Sandwich (ICS) Xamarin Copyright 2012 © Xamarin Inc. All rights reserved
    4. 4. IntroductionThis session will survey some of the new featuresavailable in Android 4 Ice Cream Sandwich (ICS) Calendar API Xamarin Copyright 2012 © Xamarin Inc. All rights reserved
    5. 5. IntroductionThis session will survey some of the new featuresavailable in Android 4 Ice Cream Sandwich (ICS) Calendar API ShareActionProvider Xamarin Copyright 2012 © Xamarin Inc. All rights reserved
    6. 6. IntroductionThis session will survey some of the new featuresavailable in Android 4 Ice Cream Sandwich (ICS) Calendar API ShareActionProvider Action Bar Tabs Xamarin Copyright 2012 © Xamarin Inc. All rights reserved
    7. 7. IntroductionThis session will survey some of the new featuresavailable in Android 4 Ice Cream Sandwich (ICS) Calendar API ShareActionProvider Action Bar Tabs TextureView Xamarin Copyright 2012 © Xamarin Inc. All rights reserved
    8. 8. IntroductionThis session will survey some of the new featuresavailable in Android 4 Ice Cream Sandwich (ICS) Calendar API ShareActionProvider Action Bar Tabs TextureView Android Beam Xamarin Copyright 2012 © Xamarin Inc. All rights reserved
    9. 9. Calendar API
    10. 10. Calendar API• Official Calendar API
    11. 11. Calendar API• Official Calendar API• Read-write access to calendar data
    12. 12. Calendar API• Official Calendar API• Read-write access to calendar data • android.permission.READ_CALENDAR
    13. 13. Calendar API• Official Calendar API• Read-write access to calendar data • android.permission.READ_CALENDAR • android.permission.WRITE_CALENDAR
    14. 14. Calendar Demo
    15. 15. Calendar Demo
    16. 16. Calendar Demo • Listing Calendars
    17. 17. Calendar Demo • Listing Calendars • Listing Calendar Events
    18. 18. Calendar Demo • Listing Calendars • Listing Calendar Events • Adding an Event
    19. 19. ShareActionProvider
    20. 20. ShareActionProvider• Enables sharing action from the Action Bar
    21. 21. ShareActionProvider• Enables sharing action from the Action Bar• Creates list of app that can handle the a sharing intent
    22. 22. ShareActionProvider• Enables sharing action from the Action Bar• Creates list of app that can handle the a sharing intent• Keeps a history of previously used apps for easy access later
    23. 23. ShareActionProvider• Enables sharing action from the Action Bar• Creates list of app that can handle the a sharing intent• Keeps a history of previously used apps for easy access later• Consistent user experience for sharing data throughout Android
    24. 24. ShareActionProvider Demo
    25. 25. ShareActionProvider Demo• Sharing an Image
    26. 26. ShareActionProvider Demo• Sharing an Image
    27. 27. ShareActionProvider Demo• Sharing an Image
    28. 28. Action Bar Tabs
    29. 29. Action Bar Tabs• TabActivity deprecated in ICS
    30. 30. Action Bar Tabs• TabActivity deprecated in ICS• Action Bar supports tabs in ICS
    31. 31. Action Bar Tabs• TabActivity deprecated in ICS• Action Bar supports tabs in ICS ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;
    32. 32. Tabs Demo
    33. 33. TextureView
    34. 34. TextureView• Hardware accelerated 2D rendering
    35. 35. TextureView• Hardware accelerated 2D rendering• Display video or OpenGL content stream
    36. 36. TextureView• Hardware accelerated 2D rendering• Display video or OpenGL content stream• Supports view transformations
    37. 37. TextureView Example
    38. 38. TextureView Example public class TextureViewActivity : Activity, TextureView.ISurfaceTextureListener { Camera _camera; TextureView _textureView; protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); _textureView = new TextureView (this); _textureView.SurfaceTextureListener = this; SetContentView (_textureView); } public void OnSurfaceTextureAvailable (Android.Graphics.SurfaceTexture surface, int width, int height) { _camera = Camera.Open (); var previewSize = _camera.GetParameters ().PreviewSize; _textureView.LayoutParameters = new FrameLayout.LayoutParams (previewSize.Width, previewSize.Height, (int)GravityFlags.Center); try { _camera.SetPreviewTexture (surface); _camera.StartPreview (); } catch (Java.IO.IOException ex) { Console.WriteLine (ex.Message); } // this is the sort of thing TextureView enables _textureView.Rotation = 45.0f; _textureView.Alpha = 0.5f; } ... }
    39. 39. TextureView Example
    40. 40. Android Beam
    41. 41. Android Beam• Allows sharing data using Near Field Communication (NFC)
    42. 42. Android Beam• Allows sharing data using Near Field Communication (NFC)• Pushes messages when devices are close
    43. 43. Android Beam• Allows sharing data using Near Field Communication (NFC)• Pushes messages when devices are close• Activity on one device creates a message
    44. 44. Android Beam• Allows sharing data using Near Field Communication (NFC)• Pushes messages when devices are close• Activity on one device creates a message • Specifies Activity that can push it
    45. 45. Android Beam• Allows sharing data using Near Field Communication (NFC)• Pushes messages when devices are close• Activity on one device creates a message • Specifies Activity that can push it• Intent invoked on second device contains the message data
    46. 46. Android Beam Example
    47. 47. Android Beam ExampleCreate a message
    48. 48. Android Beam Example Create a messageprotected override void OnCreate (Bundle bundle){ ... _nfcAdapter = NfcAdapter.GetDefaultAdapter (this); _nfcAdapter.SetNdefPushMessageCallback (this, this);}public NdefMessage CreateNdefMessage (NfcEvent evt){ DateTime time = DateTime.Now; var text = ("Beam me up!nn" + "Beam Time: " + time.ToString ("HH:mm:ss")); NdefMessage msg = new NdefMessage ( new NdefRecord[]{ CreateMimeRecord ( "application/com.example.android.beam", Encoding.UTF8.GetBytes (text)) }); } }; return msg;}public NdefRecord CreateMimeRecord (String mimeType, byte [] payload){ byte [] mimeBytes = Encoding.UTF8.GetBytes (mimeType); NdefRecord mimeRecord = new NdefRecord ( NdefRecord.TnfMimeMedia, mimeBytes, new byte [0], payload); return mimeRecord;}
    49. 49. Android Beam Example Create a message Receive a messageprotected override void OnCreate (Bundle bundle){ ... _nfcAdapter = NfcAdapter.GetDefaultAdapter (this); _nfcAdapter.SetNdefPushMessageCallback (this, this);}public NdefMessage CreateNdefMessage (NfcEvent evt){ DateTime time = DateTime.Now; var text = ("Beam me up!nn" + "Beam Time: " + time.ToString ("HH:mm:ss")); NdefMessage msg = new NdefMessage ( new NdefRecord[]{ CreateMimeRecord ( "application/com.example.android.beam", Encoding.UTF8.GetBytes (text)) }); } }; return msg;}public NdefRecord CreateMimeRecord (String mimeType, byte [] payload){ byte [] mimeBytes = Encoding.UTF8.GetBytes (mimeType); NdefRecord mimeRecord = new NdefRecord ( NdefRecord.TnfMimeMedia, mimeBytes, new byte [0], payload); return mimeRecord;}
    50. 50. Android Beam Example Create a message Receive a messageprotected override void OnCreate (Bundle bundle) IParcelable [] rawMsgs = Intent.GetParcelableArrayExtra ({ NfcAdapter.ExtraNdefMessages); ... NdefMessage msg = (NdefMessage)rawMsgs [0]; _nfcAdapter = NfcAdapter.GetDefaultAdapter (this); _nfcAdapter.SetNdefPushMessageCallback (this, this);}public NdefMessage CreateNdefMessage (NfcEvent evt){ DateTime time = DateTime.Now; var text = ("Beam me up!nn" + "Beam Time: " + time.ToString ("HH:mm:ss")); NdefMessage msg = new NdefMessage ( new NdefRecord[]{ CreateMimeRecord ( "application/com.example.android.beam", Encoding.UTF8.GetBytes (text)) }); } }; return msg;}public NdefRecord CreateMimeRecord (String mimeType, byte [] payload){ byte [] mimeBytes = Encoding.UTF8.GetBytes (mimeType); NdefRecord mimeRecord = new NdefRecord ( NdefRecord.TnfMimeMedia, mimeBytes, new byte [0], payload); return mimeRecord;}
    51. 51. Android Beam Example
    52. 52. ReferencesIntroduction to Ice Cream Sandwichhttp://docs.xamarin.com/android/tutorials/Introduction_to_Ice_Cream_Sandwich Xamarin Copyright 2012 © Xamarin Inc. All rights reserved
    53. 53. Xamarin Seminar Please give us your feedback http://bit.ly/xamfeedback Follow us on Twitter @XamarinHQ 9th February 2012 Copyright 2012 © Xamarin Inc. All rights reserved

    ×