Muhammad Rehan Qadri Muhammad Rehan Qadri - 11 months ago 42
Android Question

Cannot parse JSON - android

I'm new to android, I can't understand why am I getting this exception when trying to parse JSON. Please help, or suggest any alternative.

Json File containing all countries with their cities:
citiesjson.txt

A sample of above file is:

{"China":["Guangzhou","Fuzhou","Beijing","Baotou","Hohhot","Guiyang","Yinchuan","Nanjing","Changzhou","Chuzhou","Jiaoyun","Guizhoumanzuxiang","Qingzhen","Changde","Xianning","Jiaozhou","Weifang","Tai'an","Luoxi","Guoji","Guangdong","Sijiqing","Huzhou","Panjin Shi","Daqing","Jilin City","Lianyungang","Yancheng","Yuehu","Kunshan","Taicang","Lianshui","Nantong","Jiaotong","Changshu City","Xingxiangcun","Jinsha","Jiangyan","Chaigoubu","Ma'anshan","Huainan","Haibei","Shenlong","Nangxian","Rongsheng","Changfeng","Chengqiao","Jiafu","Shenzhou","Shantou","Qingyuan","Gyari","Xinshijie","Zhaoqing","Zhanjiang","Kuicheng","Taoyuan","Jincheng","Caishen","Shiyan","Liaoyang","Xingtai","Wenchang","Wanning","Qionghai","Huilongba","Dingcheng","Baodian","Wuzhishan","Chengmai","Yinggen","Ledong","Lincheng","Baisha","Changjiang","Dongfang","Changjian","Jinmao","Yangpu","Baipo","Jiefang","Danzhou","Lingshui","Haidian","Sanya","Rongjiang","Longyan","Jinghe","Zhangjiakou","Renqiu","Yaocheng","Kaifeng","Hebi","Jiaozuo","Pingdingshan","Anshan","Dandong","Haitang","Tongchuan","Ankang","Guozhen","Shangluo","Yulong","Haixing","Sanjiaocheng","Pinghu","Jinling","Fengming","Tongxiang","Puyuan","Dingqiao","Yanjiang","Wutong","Pingchuan","Dushu","Nanxun","Wuxing","Yangzhou","Hongyuan","Anji","Shangying","Deqing","Digang","Sanguan","Yuantong","Changxin","Huating","Putuoshan","Jinyuan","Dinghai","Xiangnan","Putuo","Xintian","Donghuxu","Zhuji","Jingcheng","Jiangtian","Xingchang","Jindou","Xinchang","Baiyun","Qianqing","Tianchang","Tianchi","Luzhou","Qinjiang","Tianzhu","Mingdu","Shenjiamen","Longshan","Dengbu","Xiushan","Daizhong","Longteng","Beiyuan","Taili","Choucheng","Lucheng","Chengxiang","Dongying","Gangcun","Sailing","Shifan","Yaohua","Jingyuan","Fengtai","Gaocheng","Gu'an","Shuangshipu","Li'ao","Xi'ao","Tang Xian","Tara","Li'an","Hu'an","Datang","Tumu","Shuyi","Gaoxin","Bo’ao","Baocheng","Haifu","Xiuying","Xuanzhou","Gongjiang","Huayuji","Qu'an","Fuhao","Weiyang","Laohekou","Nanshan","Chen Xian","Siting","Wuhou","Ji’an","Fuxin","Xiqu","Wangluo","Erqi","Donghong","Gaobeidian","Lianhua","Chenzhou","Dajie","Chenghua","Dongfeng","Zhu'ang","Maji","Songling","Chum","Cenyang","Hanshan","Xiaomi","Luohu","Hainan","Guangxi","Changle","Linfen","Yuanping","Jiazhuang","Heibei","Liaocheng","Huaihua","Rizhao","Fuzhou","Duyun","Tianshui","Guli","Jinhai","Chaoyang","Taixing","Fengxiang","Jinpan","Yizheng","Yunfu","Xinhui","Wenlan","Tieli","Taihe","Liuzhou","Hechi","Yunyang","Zhuxi Chengguanzhen","Heze","Shiqiaopu","Jiangbei","Shanzhuang","Danyang","Huai'an","Yantan","Guangchang","Xiguan","Xigu","Anying","Xiangtong","Guixi","Xidian","Pingliang","Pinghu","Changhe","Yangshan","Suji","Baizhang","Shuangxi","Yanming","Yiqiao","Xinxing","Dabao","Sanyuanpu","Gaobu","Linghu","Qingtong","Shuanglin","Dampu","Qi'an","Gouzhuang","Changsheng","Qianyu","Datong","Sandu","Anjiang","Huangjue","Name","Linqi","Zhanghe","Zheshang","Huadian","Kangcun","Zhangshan","Shouchang","Qiantan","Hongpan","Lin'an","Dingzhou","Jiuzong","Yuting","Guali","Jianci","Kaiyun","Chunhua","Hongwei","Shuguang","Diankou","Lidong","Fengqing","Fengqiao","Fengqi","Rongle","Huangzhai","Wuning","Yahao","Jifeng","Ancheng","Shangfang","Jiahu","Jinpu","Potang","Shangjiang","Xingqiao","Doujiang","Nyingchi County","Yangxunqiao","Chadianzi","Zhongyicun","Jialing","Jianxing","Xichong","Sanyi","Hongyan","Base","Yongxing","Nanhe","Naxi Yaozuxiang","Dongxing","Rongxian","Jinghong","Ning'er","Zhuozhou","Luquan","Li'an","Suqian","Dabu","Luoyang","Feiyun"],"Japan":["Tokyo",


My code:

JSONArray jsonArray = new JSONArray(jsonString);


throws exception
where jsonString = enter image description here

And the exception is:



02-08 11:29:45.239 558-589/? E/SWIPE﹕ clear()
02-08 11:29:45.239 558-589/? D/SWIPE﹕ Check swipe down for x/y: 249.0 / 173.0
02-08 11:29:45.279 558-589/? D/SWIPE﹕ touch up event 249.0 173.0
02-08 11:29:45.279 558-589/? D/SWIPE﹕ send replay touch down event
02-08 11:29:45.329 3385-3385/com.zerotech.cricketscoring.cricketscoring D/BYD_Flex﹕ getValue() name = @NOKIAFLEX@packageNeedData
02-08 11:29:45.509 3385-3385/com.zerotech.cricketscoring.cricketscoring D/BYD_Flex﹕ getValue() readFlexFromXml = TypedValue{t=0x0/d=0x0}
02-08 11:29:45.509 3385-3385/com.zerotech.cricketscoring.cricketscoring D/BYD_Flex﹕ getValue() name = @NOKIAFLEX@setDataUsageReminder
02-08 11:29:45.679 3385-3385/com.zerotech.cricketscoring.cricketscoring D/BYD_Flex﹕ getValue() readFlexFromXml = TypedValue{t=0x0/d=0x0}
02-08 11:29:45.719 3385-3385/com.zerotech.cricketscoring.cricketscoring W/dalvikvm﹕ VFY: unable to resolve virtual method 11351: Landroid/view/ViewGroup;.onNestedScrollAccepted (Landroid/view/View;Landroid/view/View;I)V
02-08 11:29:45.719 3385-3385/com.zerotech.cricketscoring.cricketscoring W/dalvikvm﹕ VFY: unable to resolve virtual method 11357: Landroid/view/ViewGroup;.onStopNestedScroll (Landroid/view/View;)V
02-08 11:29:45.729 3385-3385/com.zerotech.cricketscoring.cricketscoring W/dalvikvm﹕ VFY: unable to resolve virtual method 9043: Landroid/support/v7/internal/widget/ActionBarOverlayLayout;.stopNestedScroll ()V
02-08 11:29:45.769 3385-3385/com.zerotech.cricketscoring.cricketscoring W/dalvikvm﹕ VFY: unable to resolve virtual method 11354: Landroid/view/ViewGroup;.onRtlPropertiesChanged (I)V
02-08 11:29:45.779 3385-3385/com.zerotech.cricketscoring.cricketscoring W/dalvikvm﹕ VFY: unable to resolve virtual method 368: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
02-08 11:29:45.779 3385-3385/com.zerotech.cricketscoring.cricketscoring W/dalvikvm﹕ VFY: unable to resolve virtual method 390: Landroid/content/res/TypedArray;.getType (I)I
02-08 11:29:45.869 701-701/? D/Swype﹕ [IME] onStartInput(): false
02-08 11:29:45.919 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 295K, 7% free 8369K/8903K, paused 13ms+13ms, total 43ms
02-08 11:29:46.169 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 133K, 7% free 8542K/9095K, paused 15ms, total 15ms
02-08 11:29:46.199 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 75K, 8% free 8575K/9223K, paused 15ms, total 15ms
02-08 11:29:46.299 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 108K, 9% free 8872K/9671K, paused 12ms+12ms, total 57ms
02-08 11:29:46.359 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 162K, 10% free 8710K/9671K, paused 14ms, total 14ms
02-08 11:29:46.439 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 243K, 9% free 8831K/9671K, paused 15ms, total 15ms
02-08 11:29:46.479 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed <1K, 9% free 9378K/10247K, paused 12ms+12ms, total 37ms
02-08 11:29:46.619 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 365K, 13% free 9014K/10247K, paused 15ms, total 15ms
02-08 11:29:46.649 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed <1K, 12% free 9834K/11079K, paused 12ms+2ms, total 27ms
02-08 11:29:46.819 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 547K, 17% free 9287K/11079K, paused 15ms, total 15ms
02-08 11:29:46.859 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed <1K, 15% free 10518K/12359K, paused 12ms+13ms, total 38ms
02-08 11:29:47.129 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 821K, 22% free 9697K/12359K, paused 14ms, total 14ms
02-08 11:29:47.169 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed <1K, 19% free 11543K/14215K, paused 12ms+3ms, total 27ms
02-08 11:29:47.559 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 1232K, 28% free 10313K/14215K, paused 15ms, total 15ms
02-08 11:29:47.599 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed <1K, 8% free 13081K/14215K, paused 13ms+3ms, total 35ms
02-08 11:29:47.759 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 1846K, 21% free 11235K/14215K, paused 14ms, total 14ms
02-08 11:29:47.789 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 0K, 7% free 13320K/14215K, paused 15ms+2ms, total 31ms
02-08 11:29:47.789 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ WAIT_FOR_CONCURRENT_GC blocked 15ms
02-08 11:29:47.799 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 2768K, 26% free 10551K/14215K, paused 15ms, total 15ms
02-08 11:29:47.839 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed <1K, 12% free 12636K/14215K, paused 13ms+3ms, total 36ms
02-08 11:29:47.839 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ WAIT_FOR_CONCURRENT_GC blocked 17ms
02-08 11:29:47.859 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 12% free 12636K/14215K, paused 18ms, total 18ms
02-08 11:29:47.899 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 0K, 10% free 15762K/17351K, paused 12ms+2ms, total 28ms
02-08 11:29:47.899 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ WAIT_FOR_CONCURRENT_GC blocked 11ms
02-08 11:29:47.909 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 2084K, 22% free 13678K/17351K, paused 15ms, total 15ms
02-08 11:29:47.939 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 0K, 10% free 15762K/17351K, paused 12ms+3ms, total 27ms
02-08 11:29:47.939 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ WAIT_FOR_CONCURRENT_GC blocked 5ms
02-08 11:29:47.959 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 0K, 10% free 15762K/17351K, paused 15ms, total 15ms
02-08 11:29:48.029 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 1K, 9% free 17864K/19463K, paused 12ms+29ms, total 64ms
02-08 11:29:50.209 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 8013K, 42% free 11804K/20039K, paused 12ms+27ms, total 90ms
02-08 11:29:51.559 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 409K, 38% free 12555K/20039K, paused 12ms+21ms, total 86ms
02-08 11:29:53.179 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 484K, 33% free 13488K/20039K, paused 13ms+23ms, total 108ms
02-08 11:29:55.189 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 601K, 27% free 14633K/20039K, paused 12ms+13ms, total 129ms
02-08 11:29:57.459 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 675K, 21% free 15935K/20039K, paused 13ms+24ms, total 159ms
02-08 11:29:59.839 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 661K, 15% free 17211K/20039K, paused 12ms+31ms, total 179ms
02-08 11:29:59.989 558-588/? W/PowerManager﹕ accept Wake require,start process. the mTag is:AlarmManager, the mFlags is:1
02-08 11:30:00.019 558-575/? W/PowerManager﹕ accept Wake release,start process. the mTag is:AlarmManager, the mFlags is:1
02-08 11:30:01.639 558-588/? W/PowerManager﹕ accept Wake require,start process. the mTag is:AlarmManager, the mFlags is:1
02-08 11:30:01.649 558-707/? D/NtpTrustedTime﹕ forceRefresh() from cache miss
02-08 11:30:01.649 558-575/? W/PowerManager﹕ accept Wake release,start process. the mTag is:AlarmManager, the mFlags is:1
02-08 11:30:01.649 558-707/? D/SntpClient﹕ request time failed: java.net.UnknownHostException: Unable to resolve host "2.android.pool.ntp.org": No address associated with hostname
02-08 11:30:01.649 558-707/? W/ThrottleService﹕ unable to find stats for iface rmnet0
02-08 11:30:08.389 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 1280K, 12% free 17822K/20039K, paused 71ms, total 71ms
02-08 11:30:13.059 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 649K, 10% free 18145K/20039K, paused 72ms, total 72ms
02-08 11:30:19.949 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 970K, 14% free 18630K/21511K, paused 73ms, total 73ms
02-08 11:30:20.069 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed <1K, 13% free 20813K/23751K, paused 12ms+13ms, total 107ms
02-08 11:30:22.949 558-584/? D/BatteryService﹕ level:99 scale:100 status:2 health:2 present:true voltage: 4196 temperature: 410 technology: Li-ion AC powered:false USB powered:true icon:17303055 invalid charger:0
02-08 11:30:28.729 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 1457K, 19% free 19358K/23751K, paused 72ms, total 72ms
02-08 11:30:28.819 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 0K, 18% free 21442K/25863K, paused 12ms+3ms, total 86ms
02-08 11:30:28.819 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ WAIT_FOR_CONCURRENT_GC blocked 64ms
02-08 11:30:28.889 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 0K, 18% free 21442K/25863K, paused 73ms, total 73ms
02-08 11:30:28.999 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 0K, 16% free 23527K/27975K, paused 12ms+3ms, total 98ms
02-08 11:30:28.999 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ WAIT_FOR_CONCURRENT_GC blocked 81ms
02-08 11:30:29.069 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 2182K, 24% free 21344K/27975K, paused 73ms, total 73ms
02-08 11:30:29.169 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 2084K, 20% free 22386K/27975K, paused 12ms+3ms, total 97ms
02-08 11:30:29.169 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ WAIT_FOR_CONCURRENT_GC blocked 84ms
02-08 11:30:29.249 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 2084K, 28% free 20302K/27975K, paused 81ms, total 81ms
02-08 11:30:29.339 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed <1K, 20% free 22387K/27975K, paused 12ms+3ms, total 86ms
02-08 11:30:29.339 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ WAIT_FOR_CONCURRENT_GC blocked 73ms
02-08 11:30:29.409 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 3126K, 32% free 19260K/27975K, paused 73ms, total 73ms
02-08 11:30:29.499 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed <1K, 24% free 21344K/27975K, paused 12ms+3ms, total 86ms
02-08 11:30:29.499 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ WAIT_FOR_CONCURRENT_GC blocked 74ms
02-08 11:30:29.579 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 0K, 24% free 21344K/27975K, paused 83ms, total 83ms
02-08 11:30:29.679 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed <1K, 17% free 23429K/27975K, paused 13ms+3ms, total 98ms
02-08 11:30:30.579 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 2084K, 24% free 21344K/27975K, paused 73ms, total 73ms
02-08 11:30:30.679 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 0K, 22% free 24471K/31111K, paused 12ms+13ms, total 97ms
02-08 11:30:31.579 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 2084K, 29% free 22386K/31111K, paused 73ms, total 73ms
02-08 11:30:31.619 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ org.json.JSONException: Value {"Belarus":["Minsk","Mogilev","Brest","Vitebsk","Dvor-Gomel'","Hrodna","Navapolatsk","Lida","Horki","Borisov","Lyakhovichi","Radoshkovichi","Polatsk","Orsha","Valer'yanovo","Baranovichi","Mazyr","Lyaskavichy","Zhodzina","Zaslawye","Lahoysk","Shklow","Mozyr'","Dzyarzhynsk","Pinsk"],"":[""],"Philippines":["Manila","Ayala","Bayan","Roosevelt","Blumentritt","Cardona","Pasong Tamo","Valenzuela","Caloocan City","Taytay","Quezon City","Las Pinas","Makati City","Marikina City","San Juan","Pasig","Paranaque City","Muntinlupa","Salinas","Poblacion","Roxas City","Puerto Princesa City","Pasay","Caloocan","Buting","Lipa City","Taguig","Baguio City","San Pablo City","San Mateo","Rizal","Dasmarinas","Sucat","Sampaloc","Marilag","Angeles City","Mandaluyong City","Malabon","Rodriguez","Fairview","Angeles City","Davao City","Iligan","Cagayan de Oro","Tagum","Butuan","Mawab","Ozamiz City","Bacoor","Cavite City","Carmona","Imus","Tacurong","Pateros","Dumaguete","Carolinas","San Pedro","General Santos","Malolos","Cebu City","Malate","New Manila","Antipolo","Villanueva","Concepcion","Koronadal","Pandi","West","Lucena City","Balayan","Laguna","Calamba","Subic","Bonifacio","Quezon","Lapu-Lapu City","Tagaytay","San Carlos City","San Jose","Asia","Subic","Libis","Palma Gil","Fernandez","Kalibo","Santos","Vargas","Novaliches","Plaza","San Antonio","Philippine","Rizal","Alabang","Legaspi","Laguna","Summit","Bates","Bagumbayan","Salcedo","Batis","Cubao","Binondo","Balabag","General","Guagua","Liberty","Tandang Sora","Capitol","Naga City","Binangonan","San Francisco","Mabalacat","Pikit","Antipolo","Imus","Tarlac City","Batangas","Calapan","Binan","Cabuyao","Hilongos","Mandaue City","Tanza","Caloocan","Silang","Malabon","Navotas","Angat","Navotas","Bulacan","Laoag","Bocaue","Dagupan","Calasiao","Dingras","Cainta","Iloilo City","Iloilo City","Tagbilaran City","Balanga","Pulilan","Olongapo City","Marilao","San Jose","San Fernando","Plaridel","Baliuag","Cabanatuan City","Bataan","Navotas","San Fernando","Meycauayan","Manila","Kawit","Bacolod City","Angono","Los Banos","Paete","Santa Rosa","Calamba City","Santa Cruz","Pangil","Canlubang","Tayabas","Pagsanjan","Zamboanga City","Talisay City","Mandaue City","Ugong Norte","Luna","Olongapo City","Tanauan","Cabatuan","Pasig","West Triangle","Pias","San Pedro","Dipolog City","Victorias City","Zamboanga City","Subic","Abucay","Samal","Orion","Arayat","Boac","Siniloan","San Agustin","Cotabato City","Veronica","Masbate","Bool","Tacloban City","Danao","Rosario West","Taft","Sulo","Centre","Santo","Pagasinan","Cafe","Leyte","Interior","Pagadian","Molave","Palo","Mamungan","Hagonoy","Paul","Bagong Nayon","Mauban","La Trinidad","Apalit","Mariveles","General Trias","Cabugao","Province of Pangasinan","Urdaneta","Alaminos","Malasiqui","Bay","Balungao","Amadeo","Macabebe","Del Monte","Limay","Calbayog City","Real","Tanay","Kapatagan","Trece Martires City","Lamitan","Bagac","Jagna","Obando","Balagtas","Kidapawan","Pampanga","Naga","Diliman Primero","Baao","Cauayan","Pacita","Central","Rosales","Bulacan","Roque","Silang","La Salette","San Miguel","Baclaran","Marcos","Suyo","Maquiling","Plaridel","Los Martires","Acacia","Minalin","Salle","Agusan Pequeno","Gitagum","Pardo","Gallego","Gloria","Nueva","Upper Bicutan","Wines","Vito","La Union","Poblacion, San Felipe","Lawis","Toledo City","Concepcion","Digos","Cogan","Calinan","Mindanaw","Dagupan","Barbar","Mangaldan","San Fabian","Alcala","Bautista","Aquino","Ilog","Manaoag","Tayug","Luzon","San Miguel","Victory","Sta Cruz","Sultan Kudarat","Magsaysay","Dapitan","Mangrove","Tanauan","Alfonso","Island Park","Maria","Tigbauan","Campus","Valencia","Occidental","Panabo","Munoz East","Aguilar","Fortuna","Matandang Balara","Osmena","Leon","Balamban","Cotabato City","Cavinti","Alitagtag","Trinidad","Lilio","Carlos","Vigan","Domingo","Candon","Norte","Oara","Alaminos","Calaca","Padre Garcia","Bauan","Cagayan","Tuguegarao City","Ilagan","Santiago","Llanera","China","Ramon","Feliciano","Marina","Cruz","Ventura","Tambo","Tejer
02-08 11:30:31.629 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at org.json.JSON.typeMismatch(JSON.java:111)
02-08 11:30:31.629 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at org.json.JSONArray.<init>(JSONArray.java:91)
02-08 11:30:31.629 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at org.json.JSONArray.<init>(JSONArray.java:103)
02-08 11:30:31.629 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at ui.CreateNewTeamActivity.populateCitySpinner(CreateNewTeamActivity.java:66)
02-08 11:30:31.629 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at ui.CreateNewTeamActivity.populateSpinners(CreateNewTeamActivity.java:56)
02-08 11:30:31.629 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at ui.CreateNewTeamActivity.onCreate(CreateNewTeamActivity.java:50)
02-08 11:30:31.639 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at android.app.Activity.performCreate(Activity.java:5181)
02-08 11:30:31.639 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
02-08 11:30:31.639 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2031)
02-08 11:30:31.639 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at android.app.ActivityThread.startActivityNow(ActivityThread.java:1908)
02-08 11:30:31.639 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:135)
02-08 11:30:31.639 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:347)
02-08 11:30:31.639 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:694)
02-08 11:30:31.649 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at android.widget.TabHost.setCurrentTab(TabHost.java:358)
02-08 11:30:31.649 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at android.widget.TabHost$2.onTabSelectionChanged(TabHost.java:150)
02-08 11:30:31.649 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at android.widget.TabWidget$TabClickListener.onClick(TabWidget.java:548)
02-08 11:30:31.649 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at android.view.View.performClick(View.java:4084)
02-08 11:30:31.649 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at android.view.View$PerformClick.run(View.java:16987)
02-08 11:30:31.649 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at android.os.Handler.handleCallback(Handler.java:615)
02-08 11:30:31.659 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at android.os.Handler.dispatchMessage(Handler.java:92)
02-08 11:30:31.659 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at android.os.Looper.loop(Looper.java:137)
02-08 11:30:31.659 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at android.app.ActivityThread.main(ActivityThread.java:4807)
02-08 11:30:31.659 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at java.lang.reflect.Method.invokeNative(Native Method)
02-08 11:30:31.659 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at java.lang.reflect.Method.invoke(Method.java:511)
02-08 11:30:31.659 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
02-08 11:30:31.669 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:559)
02-08 11:30:31.669 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at dalvik.system.NativeStart.main(Native Method)
02-08 11:30:31.909 1228-1234/? E/ThermalDaemon﹕ CPU[1] offline
02-08 11:30:32.669 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 12K, 22% free 24480K/31111K, paused 12ms+978ms, total 1081ms
02-08 11:30:32.739 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 8730K, 50% free 15749K/31111K, paused 74ms, total 74ms
02-08 11:30:32.779 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 0K, 43% free 17834K/31111K, paused 12ms+3ms, total 33ms
02-08 11:30:33.139 1228-1234/? E/ThermalDaemon﹕ CPU[1] offline
02-08 11:30:38.299 558-586/? D/PowerManagerService﹕ qyq:Set brightness target = 7 currentValue = 255
02-08 11:30:38.299 558-585/? E/lights﹕ debug:set_light_backlight 254
02-08 11:30:38.299 558-586/? D/PowerManagerService﹕ qyq:Set brightness target = 255 currentValue = 255





And the exception snapshot is:
enter image description here

Or if someone has the all countries with their cities 'string-array', then that would be another solution to my problem.

Thank you!

Answer Source

The problem solved because of you guys, I'm thankful to Henry and Haider Saddique.

There were two problems:

1) Rather than

JSONArray jsonArray = new JSONArray(jsonString);

I must use:

JSONObject jsonArray = new JSONObject(jsonString);

Thanks to Henry. But only changing this causes type mismatch exception, so follow 2nd point.

2) There were many "" in my .json So I removed all objects with empty string in my .json file.

Thanks to Haider Saddique.