Android应用程序组件Content Provider在应用程序之间共享数据的原理分析(6)
16lz
2021-01-23
Step 24.SQLiteCursor.getCount
这个函数定义在frameworks/base/core/java/android/database/sqlite/SQLiteCursor.java文件中:- publicclassSQLiteCursorextendsAbstractWindowedCursor{
- ......
- @Override
- publicintgetCount(){
- if(mCount==NO_COUNT){
- fillWindow(0);
- }
- returnmCount;
- }
- ......
- }
这个函数定义在frameworks/base/core/java/android/database/sqlite/SQLiteCursor.java文件中:
- publicclassSQLiteCursorextendsAbstractWindowedCursor{
- ......
- privatevoidfillWindow(intstartPos){
- ......
- mCount=mQuery.fillWindow(mWindow,mInitialRead,0);
- ......
- }
- ......
- }
- publicclassSQLiteQueryextendsSQLiteProgram{
- ......
- /*package*/intfillWindow(CursorWindowwindow,
- intmaxRead,intlastPos){
- ......
- try{
- ......
- try{
- ......
- //ifthestartposisnotequalto0,thenmostlikelywindowis
- //toosmallforthedataset,loadingbyanotherthread
- //isnotsafeinthissituation.thenativecodewillignoremaxRead
- intnumRows=native_fill_window(window,window.getStartPosition(),mOffsetIndex,
- maxRead,lastPos);
- ......
- returnnumRows;
- }catch(IllegalStateExceptione){
- ......
- }catch(SQLiteDatabaseCorruptExceptione){
- ......
- }finally{
- ......
- }
- }finally{
- ......
- }
- }
- ......
- }
更多相关文章
- 使android应用程序不出现在应用管理中
- android中清空一个表。类似truncate table 表名 这样的功能 andr
- Android8.1添加MTP数据同步操作
- android - SAX解析XML数据
- Android笔记四 虚拟机Dalvik、Android各种java包功能、Android相