• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

public void onClick(View v) { // error

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My problem is fully described:
http://stackoverflow.com/questions/6002756/setcontentviewr-layout-main-error



The Problems tab show me 0 errors but 38 warnings, the app crashes when I click on the button.
 
author
Posts: 51
Android Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's difficult to troubleshoot this without seeing the stack trace of the error. I'm also suspicious because if the setContentView() method was the problem, you wouldn't have a button to click because the app would have already crashed before you got that far (I'm referring to your post at stackoverflow.com). One thing I see that is not good is how you check which button is clicked. The usual thing that developers do is something like this:

if( v.getId() == R.id.button_login )

or

switch( v.getId() ) {
case R.id.button_login:

- dave
 
There are 29 Knuts in one Sickle, and 17 Sickles make up a Galleon. 42 tiny ads in a knut:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic