hava a look at the following code you will find that

We assign the mNotesCursor field to a local variable at the start of the method. This is done as an optimization of the Android code. Accessing a local variable is much more efficient than accessing a field in the Dalvik VM, so by doing this we make only one access to the field, and five accesses to the local variable, making the routine much more efficient. It is recommended that you use this optimization when possible

@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);

Cursor c = mNotesCursor;//We assign the mNotesCursor field to a local variable
c.moveToPosition(position);
Intent i = new Intent(this,NoteEdit.class);
i.putExtra(NotesDbAdapter.KEY_ROWID, id);
i.putExtra(NotesDbAdapter.KEY_TITLE,
c.getString(c.getColumnIndex(NotesDbAdapter.KEY_TITLE)));
i.putExtra(NotesDbAdapter.KEY_BODY,
c.getString(c.getColumnIndex(NotesDbAdapter.KEY_BODY)));
startActivityForResult(i, ACTIVITY_EDIT);

}

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. Android(安卓)面试题1
  2. Android中的GraphicBuffer同步机制-Fence
  3. Google 官方推出应用开发架构指南
  4. Andoid Studio-android开发03-点击按钮Bu
  5. Android(安卓)JNI 动态注册方法(JNI_OnLoa
  6. android 动态修改 TextView的width属性
  7. Android设计模式系列(7)--SDK源码之命令
  8. android之论setContentView(R.layout.act
  9. android使用logwrapper进行log重定向
  10. Android(安卓)Zip解压缩类处理中文名乱码