Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Missed a } and/or ) on if/else

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I missed a } and/or ) at the end of the code, I tried so many times but I didn't get it, can someone know?

 
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How many "{" and "}" does this code have, respectively? Count the same for "(" and ")". If both numbers are not the same for both kinds of brackets, make sure to balance them evenly.
 
sasa anali
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I fixed only the "}" because there is 4 "{" and 3 "}" .. now they're equal, but with the ")" got me an error .. now there is 11 "(" and 10 ")" at the end it look like this



The problem is, I kept putting the ")" here and there and I still have an error!
 
sasa anali
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It worked but, there is a problem I get a msg on the mobile saying "Unfortunately, A has stopped"

 
Ulf Dittmer
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whenever you get that message, check the logcat which contains the full stack trace of the exception. ("adb logcat" from the console of your desktop computer while the device is connected via USB.)

I bet it's an NPE, because in line 30 you're setting "uri2" to null (or rather, you're setting it to "uri", which you're setting to null in line 29), and in line 31 you're invoking a method on it.

Could also be an NPE in line 25 if "dadclink" is null. But there's no point in guessing, as the stack trace in the logcat will tell you.
 
sasa anali
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It worked!
 
What do you have in that there bucket? It wouldn't be a tiny ad by any chance ...
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic