0
public class .. {

TextView txt;

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    txt = (TextView)findViewById(R.id.booom);
    doMethod();
}

ClassOne classOne = new ClassOne();
private void doMethod() {
    classOne.refire(this, classTwo);
}

public ClassTwo classTwo = new ClassTwo (){
    public void nomnom(Double ing){
        txt.setText(String.valueOf(ing); //null point error
    }
}

txt.setText(String.valueOf(ing); return null pointer error expection once the program is run, if i used toast in there without using txt.setText, its working fine.

What would be the problem?

Thanks

2
  • BTW, you didn't close the parentheses: txt.setText(String.valueOf(ing)); Commented Jul 4, 2011 at 6:15
  • I will be surprised if you can compile the code as your code contain error. You're missing the last enclosing bracket ')' at the line 'txt.setText(String.valueOf(ing);' Commented Jul 4, 2011 at 6:17

2 Answers 2

1

Probably (TextView)findViewById(R.id.booom); returned null. Make sure that booom is the id of the TextView.

Sign up to request clarification or add additional context in comments.

Comments

0

My guess is that ing is null. String.valueOf throws a NullPointerException is you pass it null.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.