mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-03 18:56:44 -04:00
+ fix strange crashs with "open file"
This commit is contained in:
parent
921e23dcd5
commit
0a985f534a
@ -27,6 +27,7 @@ LoaderManager.LoaderCallbacks<Cursor> {
|
||||
private static final int LOADER_ID = 0x02;
|
||||
private SimpleCursorAdapter mCursorAdapter;
|
||||
private ListView zimFileList;
|
||||
private View tmpZimFileList;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
@ -72,8 +73,11 @@ LoaderManager.LoaderCallbacks<Cursor> {
|
||||
// Sets the adapter for the ListView
|
||||
setContentView(R.layout.zimfilelist);
|
||||
|
||||
|
||||
zimFileList = (ListView) findViewById(R.id.zimfilelist);
|
||||
// For a reason I ingore, it seems that time to time
|
||||
// tmpZimFileList is not castable in ListView. Kelson
|
||||
tmpZimFileList = findViewById(R.id.zimfilelist);
|
||||
if (tmpZimFileList instanceof ListView) {
|
||||
zimFileList = (ListView) tmpZimFileList;
|
||||
getLoaderManager().initLoader(LOADER_ID, null, this);
|
||||
zimFileList.setAdapter(mCursorAdapter);
|
||||
zimFileList.setOnItemClickListener(new OnItemClickListener() {
|
||||
@ -82,6 +86,8 @@ LoaderManager.LoaderCallbacks<Cursor> {
|
||||
onListItemClick((ListView) arg0, arg0, arg2, arg3);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//TODO close cursor when done
|
||||
//allNonMediaFiles.close();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user