hacku 2013 : introduction to android programming
TRANSCRIPT
![Page 1: HackU 2013 : Introduction to Android programming](https://reader035.vdocument.in/reader035/viewer/2022062419/55a1f8571a28ab656d8b4699/html5/thumbnails/1.jpg)
Mobile Programming Kalmesh Nyamagoudar 9th August 2013
![Page 2: HackU 2013 : Introduction to Android programming](https://reader035.vdocument.in/reader035/viewer/2022062419/55a1f8571a28ab656d8b4699/html5/thumbnails/2.jpg)
Why Mobile sites/apps??
§ Users carry the device wherever they go § Better interaction with users § Great monetization benefits
09/08/13 2 Yahoo! Confidential & Proprietary.
Issues § Smaller screens § Limited computing power § Limited network connectivity
![Page 3: HackU 2013 : Introduction to Android programming](https://reader035.vdocument.in/reader035/viewer/2022062419/55a1f8571a28ab656d8b4699/html5/thumbnails/3.jpg)
Smart Phones
10/08/13 3 Yahoo! Confidential & Proprietary.
§ iPhone : What I do § Android : What we will talk today…. § Windows 8 : Hidden gem § …. § …. § ….
![Page 4: HackU 2013 : Introduction to Android programming](https://reader035.vdocument.in/reader035/viewer/2022062419/55a1f8571a28ab656d8b4699/html5/thumbnails/4.jpg)
Installations
10/08/13 4 Yahoo! Confidential & Proprietary.
§ JDK : http://jdk7.java.net/ § ADT : http://developer.android.com/sdk/index.html
› Installs both eclipse and android SDK
§ Create AVD : Android Virtual Device
![Page 5: HackU 2013 : Introduction to Android programming](https://reader035.vdocument.in/reader035/viewer/2022062419/55a1f8571a28ab656d8b4699/html5/thumbnails/5.jpg)
Let’s create an android project
10/08/13 5 Yahoo! Confidential & Proprietary.
![Page 6: HackU 2013 : Introduction to Android programming](https://reader035.vdocument.in/reader035/viewer/2022062419/55a1f8571a28ab656d8b4699/html5/thumbnails/6.jpg)
Decide your App UI
10/08/13 6 Yahoo! Confidential & Proprietary.
![Page 7: HackU 2013 : Introduction to Android programming](https://reader035.vdocument.in/reader035/viewer/2022062419/55a1f8571a28ab656d8b4699/html5/thumbnails/7.jpg)
What each UI element represents in Android
10/08/13 7 Yahoo! Confidential & Proprietary.
Text Field Button
Grid Of Images
![Page 8: HackU 2013 : Introduction to Android programming](https://reader035.vdocument.in/reader035/viewer/2022062419/55a1f8571a28ab656d8b4699/html5/thumbnails/8.jpg)
Go to Eclipse : Things to do
10/08/13 8 Yahoo! Confidential & Proprietary.
§ Create all the UI elements(TextField, Button, GridView) › Give ids to all UI elements › Create a variable for each UI element
› Connect each variable with its corresponding UI element
![Page 9: HackU 2013 : Introduction to Android programming](https://reader035.vdocument.in/reader035/viewer/2022062419/55a1f8571a28ab656d8b4699/html5/thumbnails/9.jpg)
10/08/13 9 Yahoo! Confidential & Proprietary.
§ Create a method for Button : OnClick
§ Add Internet permission to Android Manifest
![Page 10: HackU 2013 : Introduction to Android programming](https://reader035.vdocument.in/reader035/viewer/2022062419/55a1f8571a28ab656d8b4699/html5/thumbnails/10.jpg)
10/08/13 10 Yahoo! Confidential & Proprietary.
§ Implement the method that has to execute on click of button
REST Query
• Where to store the results ??? : ArrayList Of ImageResult Objects • Create a separate class : ImageResult with two variables
• thumbUrl • fullUrl
![Page 11: HackU 2013 : Introduction to Android programming](https://reader035.vdocument.in/reader035/viewer/2022062419/55a1f8571a28ab656d8b4699/html5/thumbnails/11.jpg)
10/08/13 11 Yahoo! Confidential & Proprietary.
§ Run your code once on Emulator › Check the output on LogCat’s DEBUG section › URLs of image results are printed
§ How to show these images in GridView? › Create an adapter(A subclass of ArrayAdapter<ImageResult) class › Create an adapter object in main activity › Attach it to gridView
› Populate entries of arraylist into adapter once response is parsed.
§ Run it › URLs instead of images in the Grid View
![Page 12: HackU 2013 : Introduction to Android programming](https://reader035.vdocument.in/reader035/viewer/2022062419/55a1f8571a28ab656d8b4699/html5/thumbnails/12.jpg)
Adding Images to GridView
10/08/13 12 Yahoo! Confidential & Proprietary.
§ Create a new layout (Android XML file) › Add a SmartImageView to the new layout created
§ Change the name of layout in adapter › Dear adapter, please make use of SmartImageView whenever you try to display
something
§ How to load the url into image view?? › Job of adapter
![Page 13: HackU 2013 : Introduction to Android programming](https://reader035.vdocument.in/reader035/viewer/2022062419/55a1f8571a28ab656d8b4699/html5/thumbnails/13.jpg)
10/08/13 13 Yahoo! Confidential & Proprietary.
§ ~~ Launching another screen(activity) › Demo : YahooImageSearch
§ Google Image Search › Demo : GridImageSearch
§ ListView Instead of a GridView?? › Demo : YahooExtendedAnswersClient
§ Oauth?? My Images from Flickr?? › Scribe.jar › https://github.com/thecodepath/android-rest-client-template › Demo : FlickrClient