_BA[ MOBILE 'A' Is for 'Android' "Android is a software stack for mobile devices that includes an operating system, middleware and key applications that use a modified version of the Linux kernel. It was initially developed by Android Inc., a firm later purchased by Google, and lately by the Open Handset Alliance" [http://www.openhandsetalliance.com]. -http://en.wikipedia.org/wiki/Android-(operating-system) W ile G(oogle's Nexus One [http: / /www.google.com/phone] may be the most well-known of the Android phones, the IIT(C l)ream lhttp://www.htc.com/www/product/dream/over view.htmlh, released in late October 2008, was the first phone to run the Android operating system. The Nexus One is manufac- tured for Google by the I ITC Corp. (Taiwan) and became avail- able in early January 2010. As of mid-April 2010, nearly 50 makes and models ofAndroid phones were available, forthcoming, or anticipated. Android- based phone manufacturers include BlackBerry, Dell, HTC.LG, Motorola, Nokia, Panasonic, Philips, Samsung, Sharpe, and Sony Ericsson. The top- ranked phones include Google Nexus One, Motorola DROID A855, HTC DROID Eris, Samsung Moment M900, FIT(' liero, Motorola CLIQ, Samsung Behold II t939, T- Mobile G1, myTouch 3G, and the Motorola Devour A555. In addition to smartphones, the Android operating system has been, or will be, installed on tablet computers, e-readers, and other devices. Market Share In October 2009, Gartner Inc. predicted that by 2012, Android would become the world's second most popular smartphone Gerald McKiernan Associate Professor/Science and Technology Librarian Iowa State University Library platform. In its "Predictions 2010: Enterprise Mobility Acceler- ates Again" report issued in mid-December 2009 thttp://tiny url.com/yaxb6p2j, Forrester Research estimated that mobile devices using the Google Android operating systems would account for 10% of the mobile device market in 2010, due in large part to significant support from Qualcomm, Verizon, Motorola. and Google [http: / /www.inetworkworld.com/ news/2009/ 1224 09-forrester-enterprise-mobility-trends- android.htmlI. In early April 2010, comScore, "a global leader in measuring the digital world and the preferred source of digital marketing intelligence," released its report on key trends in the U.S. mobile phone indus- try for the 3-month period between November 2009 and Febru- ary 2010, which supported this prediction. Based on its research, comScore found that more than 45 million Americans owned smartphones during the period, an increase of more than 20% from the previous quarter. Research In Motion (RIM), maker of the BlackBerry line of devices, remained the mobile smartphone platform leader in the country, with a 41% share of the U.S. smartphone market at the beginning of 2010. According to a pessimistic article in Vhe New York Timesciting a Gartner report lhttp:/ /www.nytimes.com/2010/ 07/26/business/26views.html? r=I&ref=research-in-motion-ltd1, www niolotday co,i vo ,rchor September 2010
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
1. 0. Object-oriented Programming- What is OOP?- What is OOP?
1. 1. 1. 1. Features of OOPFeatures of OOP- Inheritance(- Inheritance(継承継承))- Polymorphism(- Polymorphism(多態性多態性))- Dynamic binding(- Dynamic binding(動的束縛動的束縛))- Encapsulation(- Encapsulation(カプセル化カプセル化))
1. 2. 1. 2. Exception handlingException handling
1. 3. 1. 3. AppendixAppendix
3
IntroductionIntroduction
Object-oriented Programming (OOP)Object-oriented Programming (OOP)::a programming paradigm that represents a programming paradigm that represents concepts as "concepts as "objectsobjects" that have data fields " that have data fields ((attributesattributes that describe the object) and that describe the object) and associated procedures known as associated procedures known as methodsmethods..(from Wikipedia “Object-oriented programming” (at 2013/05/11))(from Wikipedia “Object-oriented programming” (at 2013/05/11))
classclass dog(object): dog(object): # constructor# constructor defdef __init____init__(self, name):(self, name): self.name = nameself.name = name defdef getNamegetName(self):(self): print “this is “ + self.nameprint “this is “ + self.nameclassclass shiba(dog): shiba(dog): defdef __init____init__(self, name):(self, name): self.name = name + “(s)”self.name = name + “(s)”classclass retriever(dog): retriever(dog): passpass
>>> momo = shiba(“Momo”)>>> momo = shiba(“Momo”)>>> momo.getName()>>> momo.getName()this is Momo(s)this is Momo(s)>>> kuro = retriever(“Kuro”)>>> kuro = retriever(“Kuro”)>>> kuro.getName()>>> kuro.getName()this is Kurothis is Kuro
dog
shiba retriever
object
momo kuro
9
Inheritance(Inheritance(継承継承))
「モモ」と「クロ」の子ど「モモ」と「クロ」の子ども「ポチ」は雑種も「ポチ」は雑種ZZ。。
多重継承を使えば、雑種も多重継承を使えば、雑種も表現可能。表現可能。
classclass shiba(dog): shiba(dog): defdef __init____init__(self, name):(self, name): self.name = name + “(s)”self.name = name + “(s)”
>>> momo = shiba(“Momo”)>>> momo = shiba(“Momo”)>>> momo.getName()>>> momo.getName()this is Momo(s)this is Momo(s)>>> kuro = retriever(“Kuro”)>>> kuro = retriever(“Kuro”)>>> kuro.getName()>>> kuro.getName()this is Kurothis is Kuro>>> pochi = Z(“Pochi”)>>> pochi = Z(“Pochi”)>>> pochi.getName()>>> pochi.getName()this is Pochi(s)this is Pochi(s)
>>> m = mayuyu()>>> m = mayuyu()>>> print_catchphrase(m)>>> print_catchphrase(m)((省略省略))>>> m = mariko()>>> m = mariko()>>> print_catchphrase(m)>>> print_catchphrase(m)((省略省略))>>> m = momokuro()>>> m = momokuro()>>> print_catchphrase(m)>>> print_catchphrase(m)今、会えるアイドル、週末ヒロイン。今、会えるアイドル、週末ヒロイン。
1. 0. 1. 0. Object-oriented ProgrammingObject-oriented Programming- What is OOP?- What is OOP?
1. 1. 1. 1. Features of OOPFeatures of OOP- Inheritance(- Inheritance(継承継承))- Polymorphism(- Polymorphism(多態性多態性))- Dynamic binding(- Dynamic binding(動的束縛動的束縛))- Encapsulation(- Encapsulation(カプセル化カプセル化))
1. 2. Exception handling
1. 3. 1. 3. AppendixAppendix
16
Exception handling(Exception handling(例外処理例外処理))
Which do you like when you handling errors?Which do you like when you handling errors?
defdef divdiv(a, b):(a, b): ifif b == 0: b == 0: raiseraise ZeroDivisionError ZeroDivisionError elseelse:: returnreturn a / b a / bdefdef testtest(a, b):(a, b): trytry:: print div(a, b)print div(a, b) exceptexcept ZeroDivisionError: ZeroDivisionError: print "divided by zero!"print "divided by zero!"
>>> test(4, 2)>>> test(4, 2)22>>> test(4, 0)>>> test(4, 0)divided by zero!divided by zero!
defdef divdiv(a, b):(a, b): ifif b == 0: b == 0: returnreturn 0 0 elseelse:: returnreturn a / b a / bdefdef testtest(a, b):(a, b): v = div(a, b)v = div(a, b) if if v == 0 v == 0 andand a != 0: a != 0: print “divided by zero!”print “divided by zero!” elseelse:: print vprint v
>>> test(4, 2)>>> test(4, 2)22>>> test(4, 0)>>> test(4, 0)divided by zero!divided by zero!
defdef getEncodinggetEncoding(str):(str): forfor e e inin ['utf-8', 'shift-jis', 'euc-jp']: ['utf-8', 'shift-jis', 'euc-jp']: trytry:: str.decode(e)str.decode(e) returnreturn e e exceptexcept:: passpass returnreturn None None
>>> getEncoding(">>> getEncoding("ああああああ")")euc-jp (when src is encoded by euc-jp)euc-jp (when src is encoded by euc-jp)>>> getEncoding(u">>> getEncoding(u"ああああああ".encode('utf-8'))".encode('utf-8'))utf-8utf-8