Practical Android: 14 Complete Projects on Advanced Techniques and Approaches

"Development Environment
Increasingly, Android developers are migrating to Google's Android Studio development environment." (Frontmatter section)

I migrated from Eclipse ADT to Android Studio.

Created: 2019-06-18 22:29:06 Last updated: 2019-06-18 22:29:06

"1.3 JSON Overview

As a data-interchange format, JSON provides a method for us to communicate with the server. JSON is built on two data structures that are common in nearly all programming languages: a collection of name/value pairs, and an ordered list of values.

In JSON, there are two primitives that are used to represent these data structures. Using only these primitives, you will be able to construct complex structures that can represent almost any type of data relationship.

  1. JSON Object: An unordered set or collection of name/value pairs
  2. JSON Array: An ordered list of values
Both JSON objects and JSON arrays contain values. A value can be a string in double quotes, or a number, or true or false or null, or another JSON object or JSON array. These structures can be nested, which is why JSON is so powerful for data structures." (Section "1. Introduction to JSON")

I am using JSON Objects for an Android app to communicate with the server. That is how I provide the values that the app needs to work. I am using nested structures of JSON objects. This is an example of the JSON that my URL returns from the server, which is the input provided to the Android app in the form of a JSON structure:

{"result":"Success","Deals":[{"id":"9247","short_name":"Reducci\u00f3n de Ojeras y Aumento de Volumen e Hidrataci\u00f3n de Labios","slug":"reducci\u00f3n-de-ojeras-y-aumento","original_price":"69.00","discounted_price":"12.00","start_date":"2019-07-16 17:20:00","end_date":"2019-07-24 01:00:00","zone":"","industry":"","currency_code":"USD","currency_symbol":"$","City":{"id":"42553","name":"San Salvador","slug":"San-salvador"},"Company":{"id":"1366","name":"Glamure Spa","latitude":"13.702917","longitude":"-89.239685"},"Attachment":{"id":"14376","dir":"Deal\/9247","filename":"GlamureSpa_Ojeras.jpg","width":"800","height":"450"},"imageUrl":"https:\/\/m.cuponclub.net\/img\/wide_small_big_thumb\/Deal\/14376.83e73e3667867efa57e780ac835e72f1.jpg"},{"id":"9246","short_name":"28 Ex\u00e1menes de Laboratorio","slug":"28-ex\u00e1menes-de-laboratorio","original_price":"127.00","discounted_price":"18.00","start_date":"2019-07-16 15:30:00","end_date":"2019-07-24 01:00:00","zone":"","industry":"","currency_code":"USD","currency_symbol":"$","City":{"id":"42553","name":"San Salvador","slug":"San-salvador"},"Company":{"id":"1786","name":"Laboratorio Koneman","latitude":"13.703160","longitude":"-89.245438"},"Attachment":{"id":"14375","dir":"Deal\/9246","filename":"Koneman2.jpg","width":"796","height":"450"},"imageUrl":"https:\/\/m.cuponclub.net\/img\/wide_small_big_thumb\/Deal\/14375.2db3a0e751998a0c0afea2ceba8b4755.jpg"},{"id":"9241","short_name":"Prueba de ADN de Paternidad o de Ascendencia Gen\u00e9tica","slug":"prueba-de-adn-de-paternidad-o-2","original_price":"585.00","discounted_price":"270.00","start_date":"2019-07-15 15:05:00","end_date":"2019-07-23 01:00:00","zone":"","industry":"","currency_code":"USD","currency_symbol":"$","City":{"id":"42553","name":"San Salvador","slug":"San-salvador"},"Company":{"id":"1354","name":"Laboratorio Cl\u00ednico Progenetix","latitude":"13.712425","longitude":"-89.203865"},"Attachment":{"id":"14370","dir":"Deal\/9241","filename":"PROGENETIX.jpg","width":"579","height":"327"},"imageUrl":"https:\/\/m.cuponclub.net\/img\/wide_small_big_thumb\/Deal\/14370.d9dce2abc4777338fb7db5dcfb893a6b.jpg"},{"id":"9243","short_name":"Pastel Gravity de 15 Porciones","slug":"pastel-gravity-de-15-porciones","original_price":"40.00","discounted_price":"20.00","start_date":"2019-07-15 17:45:00","end_date":"2019-07-23 01:00:00","zone":"","industry":"","currency_code":"USD","currency_symbol":"$","City":{"id":"42553","name":"San Salvador","slug":"San-salvador"},"Company":{"id":"1430","name":"Kunzcake","latitude":"13.681243","longitude":"-89.223419"},"Attachment":{"id":"14372","dir":"Deal\/9243","filename":"Kunzcake2.jpg","width":"796","height":"450"},"imageUrl":"https:\/\/m.cuponclub.net\/img\/wide_small_big_thumb\/Deal\/14372.940dfcc26d68575fc60cd390cf19174c.jpg"},{"id":"9238","short_name":"4 Cortes de Cabello + 4 Lavados y M\u00e1s","slug":"4-cortes-de-cabello-4-lavados-4","original_price":"36.00","discounted_price":"9.00","start_date":"2019-07-14 15:00:00","end_date":"2019-07-22 01:00:00","zone":"","industry":"","currency_code":"USD","currency_symbol":"$","City":{"id":"42553","name":"San Salvador","slug":"San-salvador"},"Company":{"id":"1202","name":"Macho's Barber Shop","latitude":"13.706629","longitude":"-89.235817"},"Attachment":{"id":"14367","dir":"Deal\/9238","filename":"Machos.jpg","width":"796","height":"450"},"imageUrl":"https:\/\/m.cuponclub.net\/img\/wide_small_big_thumb\/Deal\/14367.86fce5665a1bc2b50d00e351bf3c449c.jpg"},{"id":"9239","short_name":"Limpieza Dental con Ultrasonido + Pulido Dental y M\u00e1s","slug":"limpieza-dental-con-ultrasonid-6","original_price":"50.00","discounted_price":"9.00","start_date":"2019-07-14 15:00:00","end_date":"2019-07-22 01:00:00","zone":"","industry":"","currency_code":"USD","currency_symbol":"$","City":{"id":"42553","name":"San Salvador","slug":"San-salvador"},"Company":{"id":"1752","name":"Cl\u00ednica Odonto Home","latitude":"13.669062","longitude":"-89.256187"},"Attachment":{"id":"14368","dir":"Deal\/9239","filename":"OdontoHome3.jpg","width":"796","height":"450"},"imageUrl":"https:\/\/m.cuponclub.net\/img\/wide_small_big_thumb\/Deal\/14368.b60f4a51b2914ca89487fb666328e8b9.jpg"},{"id":"9234","short_name":"Curso de Buceo en El Lago de Ilopango","slug":"curso-de-buceo-en-el-lago-de-i-2","original_price":"95.00","discounted_price":"40.00","start_date":"2019-07-13 15:00:00","end_date":"2019-07-21 01:00:00","zone":"","industry":"","currency_code":"USD","currency_symbol":"$","City":{"id":"42553","name":"San Salvador","slug":"San-salvador"},"Company":{"id":"1541","name":"Centro de Buceo Oceanica","latitude":"13.707072","longitude":"-89.240707"},"Attachment":{"id":"14363","dir":"Deal\/9234","filename":"Ocenica.png","width":"800","height":"450"},"imageUrl":"https:\/\/m.cuponclub.net\/img\/wide_small_big_thumb\/Deal\/14363.ebde0fd8af42d0a19caea442f5d57ddf.jpg"},{"id":"9235","short_name":"Estad\u00eda para 2 personas en Destino a Elecci\u00f3n: Atitl\u00e1n, Livingston o Pet\u00e9n","slug":"estad\u00eda-para-2-personas-en-de","original_price":"122.00","discounted_price":"61.00","start_date":"2019-07-13 15:00:00","end_date":"2019-07-21 01:00:00","zone":"","industry":"","currency_code":"USD","currency_symbol":"$","City":{"id":"42553","name":"San Salvador","slug":"San-salvador"},"Company":{"id":"1721","name":"Villas de Guatemala","latitude":"14.605404","longitude":"-90.513191"},"Attachment":{"id":"14364","dir":"Deal\/9235","filename":"VillaGT2 1.jpg","width":"796","height":"450"},"imageUrl":"https:\/\/m.cuponclub.net\/img\/wide_small_big_thumb\/Deal\/14364.2ca9ac34ec6fd103140fa26534dcbf9e.jpg"},{"id":"9228","short_name":"Tratamiento Capilar de Arg\u00e1n o Coco","slug":"tratamiento-capilar-de-arg\u00e1n","original_price":"43.00","discounted_price":"10.00","start_date":"2019-07-12 15:00:00","end_date":"2019-07-20 01:00:00","zone":"","industry":"","currency_code":"USD","currency_symbol":"$","City":{"id":"42553","name":"San Salvador","slug":"San-salvador"},"Company":{"id":"1946","name":"Adara Beauty Studio ","latitude":"13.709452","longitude":"-89.240295"},"Attachment":{"id":"14356","dir":"Deal\/9228","filename":"Adara.jpg","width":"796","height":"450"},"imageUrl":"https:\/\/m.cuponclub.net\/img\/wide_small_big_thumb\/Deal\/14356.721fb970db3f7461416d4e7611b9dbe7.jpg"},{"id":"9229","short_name":"Micropigmentaci\u00f3n de Cejas + Extensi\u00f3n de Pesta\u00f1as","slug":"micropigmentaci\u00f3n-de-cejas-ex","original_price":"278.00","discounted_price":"125.00","start_date":"2019-07-12 15:00:00","end_date":"2019-07-20 01:00:00","zone":"","industry":"","currency_code":"USD","currency_symbol":"$","City":{"id":"42553","name":"San Salvador","slug":"San-salvador"},"Company":{"id":"1945","name":"Visage and Body","latitude":"13.699752","longitude":"-89.235901"},"Attachment":{"id":"14357","dir":"Deal\/9229","filename":"VisageBody.jpg","width":"796","height":"450"},"imageUrl":"https:\/\/m.cuponclub.net\/img\/wide_small_big_thumb\/Deal\/14357.7164c65352aa0acbcefb8a16a6a178e6.jpg"},{"id":"9226","short_name":"34 Tratamientos de Tonificaci\u00f3n y Reducci\u00f3n de Abdomen","slug":"shortname-34-tratamientos-de-t","original_price":"100.00","discounted_price":"25.00","start_date":"2019-07-11 16:10:00","end_date":"2019-07-19 01:00:00","zone":"","industry":"","currency_code":"USD","currency_symbol":"$","City":{"id":"42553","name":"San Salvador","slug":"San-salvador"},"Company":{"id":"1114","name":"Biom\u00e9dica Reducci\u00f3n de Peso & Urban Spa","latitude":"13.707535","longitude":"-89.248726"},"Attachment":{"id":"14353","dir":"Deal\/9226","filename":"Biomedica.jpg","width":"796","height":"450"},"imageUrl":"https:\/\/m.cuponclub.net\/img\/wide_small_big_thumb\/Deal\/14353.49463ff2c8e8460b0a35d6cdf5e6c45e.jpg"},{"id":"9227","short_name":"Photobook Tipo Revista con 50 Fotograf\u00edas","slug":"photobook-tipo-revista-con-50-1","original_price":"25.00","discounted_price":"12.00","start_date":"2019-07-11 17:51:00","end_date":"2019-07-19 01:00:00","zone":"","industry":"","currency_code":"USD","currency_symbol":"$","City":{"id":"42553","name":"San Salvador","slug":"San-salvador"},"Company":{"id":"1588","name":"Innovarte","latitude":"13.664843","longitude":"-89.263306"},"Attachment":{"id":"14354","dir":"Deal\/9227","filename":"Innovarte3.jpg","width":"796","height":"450"},"imageUrl":"https:\/\/m.cuponclub.net\/img\/wide_small_big_thumb\/Deal\/14354.a2851ef5afe2b1c5ed382faf79bb6345.jpg"},{"id":"9222","short_name":"Pizzer\u00eda Krisppy's: Paga $10 y Consume $20 en Todo el Men\u00fa","slug":"pizzer\u00eda-krisppy-s-paga-$10-y-1","original_price":"20.00","discounted_price":"10.00","start_date":"2019-07-10 15:30:00","end_date":"2019-07-18 01:00:00","zone":"","industry":"","currency_code":"USD","currency_symbol":"$","City":{"id":"42553","name":"San Salvador","slug":"San-salvador"},"Company":{"id":"1699","name":"Krisppy's","latitude":"13.696752","longitude":"-89.245201"},"Attachment":{"id":"14349","dir":"Deal\/9222","filename":"Krisppys.jpg","width":"796","height":"450"},"imageUrl":"https:\/\/m.cuponclub.net\/img\/wide_small_big_thumb\/Deal\/14349.91a16230c75246a8f0565a56000ec78f.jpg"},{"id":"9223","short_name":"Cambio de Aceite de Caja ATF Syntetic Blend","slug":"cambio-de-aceite-de-caja-atf-s-2","original_price":"149.00","discounted_price":"50.00","start_date":"2019-07-10 16:15:00","end_date":"2019-07-18 01:00:00","zone":"","industry":"","currency_code":"USD","currency_symbol":"$","City":{"id":"42553","name":"San Salvador","slug":"San-salvador"},"Company":{"id":"1417","name":"Full Services Taller Automotriz","latitude":"13.682205","longitude":"-89.274216"},"Attachment":{"id":"14350","dir":"Deal\/9223","filename":"FullServices_18diciembre.jpg","width":"579","height":"327"},"imageUrl":"https:\/\/m.cuponclub.net\/img\/wide_small_big_thumb\/Deal\/14350.81b486072a6d64a9f35721334375805e.jpg"},{"id":"9203","short_name":"500 Tarjetas de Presentaci\u00f3n","slug":"500-tarjetas-de-presentaci\u00f3n-4","original_price":"36.63","discounted_price":"7.50","start_date":"2019-07-06 15:00:00","end_date":"2019-07-17 01:00:00","zone":"","industry":"","currency_code":"USD","currency_symbol":"$","City":{"id":"42553","name":"San Salvador","slug":"San-salvador"},"Company":{"id":"1449","name":"Innovaci\u00f3n Digital ","latitude":"13.694928","longitude":"-89.228920"},"Attachment":{"id":"14330","dir":"Deal\/9203","filename":"Innovacin Digital.jpg","width":"579","height":"327"},"imageUrl":"https:\/\/m.cuponclub.net\/img\/wide_small_big_thumb\/Deal\/14330.f00b252f7b9f0f4537d731bbf559e8aa.jpg"},{"id":"9211","short_name":"Valle Dorado, Guatemala: Estad\u00eda para 2 + Ingreso al Parque Acu\u00e1tico y M\u00e1s ","slug":"valle-dorado,-guatemala-estad","original_price":"155.00","discounted_price":"75.00","start_date":"2019-07-06 15:00:00","end_date":"2019-07-17 01:00:00","zone":"","industry":"","currency_code":"USD","currency_symbol":"$","City":{"id":"42553","name":"San Salvador","slug":"San-salvador"},"Company":{"id":"856","name":"Valle Dorado Resort & Parque Acu\u00e1tico","latitude":"15.044868","longitude":"-89.583717"},"Attachment":{"id":"14338","dir":"Deal\/9211","filename":"ValleDorado1_2.jpg","width":"795","height":"450"},"imageUrl":"https:\/\/m.cuponclub.net\/img\/wide_small_big_thumb\/Deal\/14338.649c9341b4f9d5be963bce366e5cf51f.jpg"},{"id":"9208","short_name":"12 Meses de Clases Online de Adobe, Autodesk, Office o Programaci\u00f3n","slug":"12-meses-de-clases-online-de-a-4","original_price":"99.00","discounted_price":"24.00","start_date":"2019-07-07 15:00:00","end_date":"2019-07-17 01:00:00","zone":"","industry":"","currency_code":"USD","currency_symbol":"$","City":{"id":"42553","name":"San Salvador","slug":"San-salvador"},"Company":{"id":"814","name":"Mottion Studios","latitude":"14.592817","longitude":"-90.510735"},"Attachment":{"id":"14335","dir":"Deal\/9208","filename":"Mottions.jpg","width":"579","height":"327"},"imageUrl":"https:\/\/m.cuponclub.net\/img\/wide_small_big_thumb\/Deal\/14335.a8415218166ac1f714a3ca199fa8a3e5.jpg"},{"id":"9210","short_name":"1 Sesi\u00f3n Fotogr\u00e1fica en Estudio o PhotoBox para hasta 5 Personas","slug":"1-sesi\u00f3n-fotogr\u00e1fica-en-estu-1","original_price":"75.00","discounted_price":"20.00","start_date":"2019-07-07 15:00:00","end_date":"2019-07-17 01:00:00","zone":"","industry":"","currency_code":"USD","currency_symbol":"$","City":{"id":"42553","name":"San Salvador","slug":"San-salvador"},"Company":{"id":"1429","name":"Eliphotography","latitude":"13.738215","longitude":"-89.354706"},"Attachment":{"id":"14337","dir":"Deal\/9210","filename":"Eli_Photography.jpg","width":"579","height":"327"},"imageUrl":"https:\/\/m.cuponclub.net\/img\/wide_small_big_thumb\/Deal\/14337.a4b29ee24ca5b0d110333e28ca20541f.jpg"},{"id":"9213","short_name":"Alisado de Nanoplast\u00eda, Cherry, 24K, Chocolate o Keratina-Coco","slug":"alisado-de-nanoplast\u00eda,-cherr-1","original_price":"150.00","discounted_price":"25.00","start_date":"2019-07-08 16:00:00","end_date":"2019-07-17 01:00:00","zone":"","industry":"","currency_code":"USD","currency_symbol":"$","City":{"id":"42553","name":"San Salvador","slug":"San-salvador"},"Company":{"id":"108","name":"InStyle Salon and Spa","latitude":"13.693328","longitude":"-89.234749"},"Attachment":{"id":"14340","dir":"Deal\/9213","filename":"InStyle6.jpg","width":"796","height":"450"},"imageUrl":"https:\/\/m.cuponclub.net\/img\/wide_small_big_thumb\/Deal\/14340.69a0b118259294fab6b809ae787e170c.jpg"},{"id":"9215","short_name":"Ultrasonograf\u00eda a Elecci\u00f3n","slug":"ultrasonograf\u00eda-a-elecci\u00f3n","original_price":"45.00","discounted_price":"13.00","start_date":"2019-07-08 16:45:00","end_date":"2019-07-17 01:00:00","zone":"","industry":"","currency_code":"USD","currency_symbol":"$","City":{"id":"42553","name":"San Salvador","slug":"San-salvador"},"Company":{"id":"1932","name":"Multiclinicas Radiologicas Escal\u00f3n","latitude":"13.703732","longitude":"-89.235451"},"Attachment":{"id":"14342","dir":"Deal\/9215","filename":"DraColato2.jpg","width":"796","height":"450"},"imageUrl":"https:\/\/m.cuponclub.net\/img\/wide_small_big_thumb\/Deal\/14342.b1843605b5e9bb62fa5a78677adf327b.jpg"},{"id":"9217","short_name":"Cauterizaci\u00f3n para Eliminar hasta 20 Verrugas","slug":"cauterizaci\u00f3n-para-eliminar-h","original_price":"375.00","discounted_price":"18.00","start_date":"2019-07-09 16:00:00","end_date":"2019-07-17 01:00:00","zone":"","industry":"","currency_code":"USD","currency_symbol":"$","City":{"id":"42553","name":"San Salvador","slug":"San-salvador"},"Company":{"id":"1654","name":"Cl\u00ednica de Medicina Biol\u00f3gica y Est\u00e9tica SV ","latitude":"13.678228","longitude":"-89.244194"},"Attachment":{"id":"14344","dir":"Deal\/9217","filename":"ClnicaDraRomero4 1.jpg","width":"796","height":"450"},"imageUrl":"https:\/\/m.cuponclub.net\/img\/wide_small_big_thumb\/Deal\/14344.76be8edfa51e0f0972cb23f088a7c0f1.jpg"},{"id":"9219","short_name":"L\u00e1ser para 5 U\u00f1as con Hongos","slug":"l\u00e1ser-para-5-u\u00f1as-con-hongos","original_price":"325.00","discounted_price":"35.00","start_date":"2019-07-09 16:20:00","end_date":"2019-07-17 01:00:00","zone":"","industry":"","currency_code":"USD","currency_symbol":"$","City":{"id":"42553","name":"San Salvador","slug":"San-salvador"},"Company":{"id":"776","name":"Venolaser","latitude":"13.711559","longitude":"-89.202614"},"Attachment":{"id":"14346","dir":"Deal\/9219","filename":"Venolaser4.jpg","width":"795","height":"450"},"imageUrl":"https:\/\/m.cuponclub.net\/img\/wide_small_big_thumb\/Deal\/14346.cdd2a965e5039e1a7fb532024d3f9059.jpg"}]}

Created: 2019-07-16 22:38:21 Last updated: 2019-07-16 22:38:21

Top