私はAndroidの例であるメモ帳アプリの2番目の演習を行っています。これは、mRowIdを定義するために使用されたLongとlongの違いについての質問です。
演習はここにあります:http://developer.android.com/resources/tutorials/notepad/notepad-ex2.html
そして、以下は私が問題を抱えているコード部分です:
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;
でmRowIdを宣言したときにlong
、mRowIdをnullに設定しようとするとエラーが発生しました。このエラーは、「タイプの不一致」です。しかし、を使用するLong
と、エラーはなくなります。なぜ機能しないlong
のですか?