Question

I am going through the 2nd exercise of the android example the notepad app, I have this a question about the difference between Long and long that was used to define the mRowId.

The exercise is here: http://developer.android.com/resources/tutorials/notepad/notepad-ex2.html

And below is the code piece that I am having problem with:

public class NoteEdit extends Activity {

private Long mRowId; 
private EditText mTitleText;
private EditText mBodyText; 

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);

    setContentView(R.layout.note_edit);
    setTitle(R.string.edit_note);

    mTitleText = (EditText) findViewById(R.id.title);
    mBodyText = (EditText) findViewById(R.id.body);
    Button confirmButton = (Button) findViewById(R.id.confirm);

    mRowId = null;

When I declared mRowId with long, I got an error when I tried to set mRowId to null, the error is "type mismatch". But if I use Long, the error goes away. Why doesn't long work?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top