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

Please download to get full document.

View again

of 53
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Information Report
Category:

Technology

Published:

Views: 3 | Pages: 53

Extension: PDF | Download: 0

Share
Description
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
Transcript
  • 1. Xamarin Seminar 9th February 2012 Copyright 2012 © Xamarin Inc. All rights reserved
  • 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. 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. 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. 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. 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. 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. 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. Calendar API
  • 10. Calendar API• Official Calendar API
  • 11. Calendar API• Official Calendar API• Read-write access to calendar data
  • 12. Calendar API• Official Calendar API• Read-write access to calendar data • android.permission.READ_CALENDAR
  • 13. Calendar API• Official Calendar API• Read-write access to calendar data • android.permission.READ_CALENDAR • android.permission.WRITE_CALENDAR
  • 14. Calendar Demo
  • 15. Calendar Demo
  • 16. Calendar Demo • Listing Calendars
  • 17. Calendar Demo • Listing Calendars • Listing Calendar Events
  • 18. Calendar Demo • Listing Calendars • Listing Calendar Events • Adding an Event
  • 19. ShareActionProvider
  • 20. ShareActionProvider• Enables sharing action from the Action Bar
  • 21. ShareActionProvider• Enables sharing action from the Action Bar• Creates list of app that can handle the a sharing intent
  • 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. 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. ShareActionProvider Demo
  • 25. ShareActionProvider Demo• Sharing an Image
  • 26. ShareActionProvider Demo• Sharing an Image
  • 27. ShareActionProvider Demo• Sharing an Image
  • 28. Action Bar Tabs
  • 29. Action Bar Tabs• TabActivity deprecated in ICS
  • 30. Action Bar Tabs• TabActivity deprecated in ICS• Action Bar supports tabs in ICS
  • 31. Action Bar Tabs• TabActivity deprecated in ICS• Action Bar supports tabs in ICS ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;
  • 32. Tabs Demo
  • 33. TextureView
  • 34. TextureView• Hardware accelerated 2D rendering
  • 35. TextureView• Hardware accelerated 2D rendering• Display video or OpenGL content stream
  • 36. TextureView• Hardware accelerated 2D rendering• Display video or OpenGL content stream• Supports view transformations
  • 37. TextureView Example
  • 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. TextureView Example
  • 40. Android Beam
  • 41. Android Beam• Allows sharing data using Near Field Communication (NFC)
  • 42. Android Beam• Allows sharing data using Near Field Communication (NFC)• Pushes messages when devices are close
  • 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. 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. 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. Android Beam Example
  • 47. Android Beam ExampleCreate a message
  • 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. 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. 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. Android Beam Example
  • 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. 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
  • We Need Your Support
    Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

    Thanks to everyone for your continued support.

    No, Thanks
    SAVE OUR EARTH

    We need your sign to support Project to invent "SMART AND CONTROLLABLE REFLECTIVE BALLOONS" to cover the Sun and Save Our Earth.

    More details...

    Sign Now!

    We are very appreciated for your Prompt Action!

    x