How to query specific hidden folder for images in android - android

I need to query a specific hidden folder created by my application and need to fetch all the images saved in that hidden folder. I am able to query that very same folder if its not hidden but when I make the folder hidden, the cursor counts returns me 0 even though images are well kept inside the folder.
public static List<MediaData> getHiddenFolderData(Context context) {
Cursor imagecursor = null;
List<MediaData> gallerydata = new ArrayList<MediaData>();
try {
final String orderBy = Images.Media._ID + " DESC";
imagecursor = context.getContentResolver()
.query(Images.Media.EXTERNAL_CONTENT_URI,
projectionImage,
Images.Media.BUCKET_DISPLAY_NAME + "='"
+ ".HiddenFolder" + "'", null,
orderBy);
System.out.println("1026 check log 1");
if (imagecursor != null) {
System.out.println("1026 check log 2");
imagecursor.moveToFirst();
int count = imagecursor.getCount();
System.out.println("1026 check log 3 count"+" "+count);
for (int i = 0; i < count; i++) {
MediaData galData = new MediaData();
galData.setKey_id(i);
galData.setId(imagecursor.getString(0));
galData.setName(imagecursor.getString(1));
galData.setPath(imagecursor.getString(2));
galData.setDate(imagecursor.getString(3));
gallerydata.add(galData);
imagecursor.moveToNext();
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (imagecursor != null) {
imagecursor.close();
}
}
return gallerydata;
}
Another approach
private void getHiddenFolderData() {
String path = Environment.getExternalStorageDirectory().toString() + "/Pictures/.HiddenFolder";
System.out.println("here is path" + " " + "Path: " + path);
File directory = new File(path);
File[] files = directory.listFiles();
System.out.println("here is size" + " " + files.length);
for (int i = 0; i < files.length; i++) {
System.out.println("here get file prop"+" "+files[i].getName()+" "+files[i].getPath());
}
}

Related

get count of certain extension files from Android device

I am trying to count certain extension files (pdf, txt, docx, pptx, xlsx) which are stored in Android device using getcontentresolver query and reading file by file.
However, I'm getting different results from both ways. count results are the following:
By Content Resolver Query:
pdf 289
txt 133
docs 29
pptx 21
xlsx 9
By reading file by file
pdf 289
txt 134
docs 151
pptx 77
xlsx 27
Here is Code
By Content Resolver Query:
public static long getFilesCount() {
long myCounter = 0;
String selectionMimeType = MediaStore.Files.FileColumns.MIME_TYPE + "=?" + " OR " + MediaStore.Files.FileColumns.MIME_TYPE + "=?" + " OR " + MediaStore.Files.FileColumns.MIME_TYPE + "=?" + " OR " + MediaStore.Files.FileColumns.MIME_TYPE + "=?" + " OR " + MediaStore.Files.FileColumns.MIME_TYPE + "=?";
String pdfMimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension("pdf");
String txtMimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension("txt");
String docMimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension("docx");
String pptxMimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension("pptx");
String xlsxMimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension("xlsx");
String[] selectionArgs = new String[]{pdfMimeType, txtMimeType, docMimeType, pptxMimeType, xlsxMimeType};
Cursor mCursor = App
.getInstance()
.getApplicationContext()
.getContentResolver()
.query(MediaStore.Files.getContentUri("external")
, null, selectionMimeType, selectionArgs, null);
if (mCursor != null && mCursor.moveToFirst()) {
int aCount = 0;
do {
int id = mCursor.getInt(mCursor.getColumnIndex(MediaStore.Files.FileColumns._ID));
String path = mCursor.getString(mCursor.getColumnIndex(MediaStore.Files.FileColumns.DATA));
String type = mCursor.getString(mCursor.getColumnIndex(MediaStore.Files.FileColumns.MIME_TYPE));
if (path == null || type == null)
continue;
File file = new File(path);
if (file.exists()) {
if (!file.isDirectory()) {
myCounter++;
}
}
} while (mCursor.moveToNext());
}
if (mCursor != null && !mCursor.isClosed()) {
mCursor.close();
}
return myCounter;
}
`
By reading file by file
`
public static long filesCount() {
long counter = _loadFiles(predefineExtension(), new File(getFilesPath())));
return counter;
}
public static String getFilesPath() {
return Environment.getExternalStorageDirectory().getPath();
}
public static ArrayList<String> predefineExtension() {
ArrayList<String> list = new ArrayList<>();
list.add("pdf");
list.add("txt");
list.add("docx");
list.add("pptx");
list.add("xlsx");
return list;
}
private static long _loadFiles(ArrayList<String> selectedExtension, File directory) {
long counter = 0;
File[] files = directory.listFiles();
if (files != null) {
for (int i = 0; i < files.length; i++) {
if (files[i] != null) {
if (files[i].isDirectory()) {
counter += _loadFiles(selectedExtension, files[i]);
} else {
File file = files[i];
if (file.exists()) {
for (int j = 0; j < selectedExtension.size(); j++) {
String ext = selectedExtension.get(j);
if (file.getPath().endsWith("." + ext)) {
counter++;
break;
} // file match
} // selected file extension loop
} // file exist
} // file is not directory
} // file is not null
} // loop
} // files array is not null
return counter;
}
So, my question is why these both approaches have different results? Any help is appreciated! Thank you!
my question is why these both approaches have different results?
They are unlikely to be identical.
Not every file on external storage necessarily gets indexed by the MediaStore. This is particularly true of files that were recently put on external storage and files in dot-prefixed directories (e.g., .stuff/).
MediaStore has access to content on removable storage that you may not have access to.
Note that your filesystem-based approach will not work on Android Q (by default) or Android R+ (for all apps). I am not certain about your MediaStore approach.

How to get data from MediaStore.File and MediaStore.File.FileColumn

I am trying to get all the file name having audio files in it I have used Mediastore to get the mediastore audio,album,playlist and audio DATA also but how I can get the file or folder titles which contains the audio file .Here is the code that I have tried but it is not correct as I am not able to set the External_Content_uri.
This is the code I have tried.
private void External() {
try {
String[] proj = {MediaStore.Files.FileColumns.TITLE,
MediaStore.Files.FileColumns._ID,
MediaStore.Files.FileColumns.PARENT,
MediaStore.Files.FileColumns.DATA
};// Can include more data for more details and check it.
String selection =MediaStore.Files.FileColumns.MEDIA_TYPE+"=?";
String[] selectionArgs = {"MediaStore.Files.FileColumns.MEDIA_TYPE_AUDIO"};
String sortOrder = MediaStore.Audio.Media.TITLE + " ASC";
Cursor audioCursor = getContentResolver().query(MediaStore.Files.getContentUri("\"external\""), proj, selection, selectionArgs, sortOrder);
if (audioCursor != null) {
if (audioCursor.moveToFirst()) {
do {
int filetitle = audioCursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.TITLE);
int file_id = audioCursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns._ID);
int fileparent = audioCursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.PARENT);
int filedata = audioCursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.DATA);
Mediafileinfo info = new Mediafileinfo();
info.setData(new File(new File(audioCursor.getString(filedata)).getParent()).getName());
info.setTitle(audioCursor.getString(filetitle));
info.set_id(audioCursor.getString(file_id));
info.setParent(audioCursor.getString(fileparent));
// info.setData(audioCursor.getString(filedata));
audioList.add(info);
} while (audioCursor.moveToNext());
}
}
assert audioCursor != null;
audioCursor.close();
} catch (Exception e) {
e.printStackTrace();
}
}
I tried this and this example but I am not able to get the solution.
Writing a fresh answer, since all you want is the folder names of the audio files.
So the best thing to use here is MediaStore.Audio.Media instead of using MediaStore.File. Get the folder names using the below on the audio file path.
new File(new File(audioCursor.getString(filedata)).getParent()).getName()
private void External() {
try {
Uri externalUri= MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
projection=new String[]{MediaStore.Audio.Media._ID,
MediaStore.Audio.Media.TITLE,
MediaStore.Audio.Media.DATA,;
String selection =null;
String[] selectionArgs = null;
String sortOrder = MediaStore.Audio.Media.TITLE + " ASC";
Cursor audioCursor = getContentResolver().query(externalUri, proj, selection, selectionArgs, sortOrder);
if (audioCursor != null) {
if (audioCursor.moveToFirst()) {
do {
int filetitle = audioCursor.getColumnIndexOrThrow(MediaStore.Audio.Media.TITLE);
int file_id = audioCursor.getColumnIndexOrThrow(MediaStore.Audio.Media._ID);
int filePath = audioCursor.getColumnIndexOrThrow(MediaStore.Audio.Media.DATA);
Mediafileinfo info = new Mediafileinfo();
info.setData(new File(new File(audioCursor.getString(filedata)).getParent()).getName());
info.setTitle(audioCursor.getString(filetitle));
info.set_id(audioCursor.getString(file_id));
audioList.add(info);
} while (audioCursor.moveToNext());
}
}
assert audioCursor != null;
audioCursor.close();
} catch (Exception e) {
e.printStackTrace();
}
}
Hi query media file like audio,images and video using Android Media Store and Android Content Resolver, check this tutorial
http://www.androiddevelopersolutions.com/2015/12/android-media-store-tutorial-list-all.html
For Listing All images:
private void parseAllImages() {
try {
String[] projection = {MediaStore.Images.Media.DATA};
cursor = getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
projection, // Which columns to return
null, // Return all rows
null,
null);
int size = cursor.getCount();
/******* If size is 0, there are no images on the SD Card. *****/
if (size == 0) {
} else {
int thumbID = 0;
while (cursor.moveToNext()) {
int file_ColumnIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
/**************** Captured image details ************/
/***** Used to show image on view in LoadImagesFromSDCard class ******/
String path = cursor.getString(file_ColumnIndex);
String fileName = path.substring(path.lastIndexOf("/") + 1, path.length());
MediaFileInfo mediaFileInfo = new MediaFileInfo();
mediaFileInfo.setFilePath(path);
mediaFileInfo.setFileName(fileName);
mediaFileInfo.setFileType(type);
mediaList.add(mediaFileInfo);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
For Listing all Video(.mp4)
private void parseAllVideo() {
try {
String name = null;
String[] thumbColumns = {MediaStore.Video.Thumbnails.DATA,
MediaStore.Video.Thumbnails.VIDEO_ID};
int video_column_index;
String[] proj = {MediaStore.Video.Media._ID,
MediaStore.Video.Media.DATA,
MediaStore.Video.Media.DISPLAY_NAME,
MediaStore.Video.Media.SIZE};
Cursor videocursor = getContentResolver().query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
proj, null, null, null);
int count = videocursor.getCount();
Log.d("No of video", "" + count);
for (int i = 0; i < count; i++) {
MediaFileInfo mediaFileInfo = new MediaFileInfo();
video_column_index = videocursor
.getColumnIndexOrThrow(MediaStore.Video.Media.DISPLAY_NAME);
videocursor.moveToPosition(i);
name = videocursor.getString(video_column_index);
mediaFileInfo.setFileName(name);
int column_index = videocursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
videocursor.moveToPosition(i);
String filepath = videocursor.getString(column_index);
mediaFileInfo.setFilePath(filepath);
mediaFileInfo.setFileType(type);
mediaList.add(mediaFileInfo);
// id += " Size(KB):" +
// videocursor.getString(video_column_index);
}
videocursor.close();
} catch (Exception e) {
e.printStackTrace();
}
}
For Listing All Audio
private void parseAllAudio() {
try {
String TAG = "Audio";
Cursor cur = getContentResolver().query(
MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, null, null, null,
null);
if (cur == null) {
// Query failed...
Log.e(TAG, "Failed to retrieve music: cursor is null :-(");
}
else if (!cur.moveToFirst()) {
// Nothing to query. There is no music on the device. How boring.
Log.e(TAG, "Failed to move cursor to first row (no query results).");
}else {
Log.i(TAG, "Listing...");
// retrieve the indices of the columns where the ID, title, etc. of the song are
// add each song to mItems
do {
int artistColumn = cur.getColumnIndex(MediaStore.Audio.Media.ARTIST);
int titleColumn = cur.getColumnIndex(MediaStore.Audio.Media.TITLE);
int albumColumn = cur.getColumnIndex(MediaStore.Audio.Media.ALBUM);
int durationColumn = cur.getColumnIndex(MediaStore.Audio.Media.DURATION);
int idColumn = cur.getColumnIndex(MediaStore.Audio.Media._ID);
int filePathIndex = cur.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
Log.i(TAG, "Title column index: " + String.valueOf(titleColumn));
Log.i(TAG, "ID column index: " + String.valueOf(titleColumn));
Log.i("Final ", "ID: " + cur.getString(idColumn) + " Title: " + cur.getString(titleColumn) + "Path: " + cur.getString(filePathIndex));
MediaFileInfo audio = new MediaFileInfo();
audio.setFileName(cur.getString(titleColumn));
audio.setFilePath(cur.getString(filePathIndex));
audio.setFileType(type);
mediaList.add(audio);
} while (cur.moveToNext());
}
} catch (Exception e) {
e.printStackTrace();
}
}

How to load the thumbnails for the pictures stored in particular folder (or with IDs)?

I have an activity with a GridView where I want to show thumbnails for images taken with standard camera activity and stored in a particular folder. This activity implements LoaderManager.LoaderCallbacks interface and here's its onCreateLoader() method's code
...
...
private static final String APP_PICTURES_DIRECTORY_NAME = "Pictures to process";
private String[] mProjection = {
MediaStore.Images.Thumbnails._ID,
MediaStore.Images.Thumbnails.DATA,
MediaStore.Images.Thumbnails.IMAGE_ID
};
private SimpleCursorAdapter mCursorAdapter;
...
...
...
#Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
String[] imagesProjection = {"_id", "_data"};
Cursor imagesCursor;
imagesCursor = getContentResolver().query(
MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
imagesProjection,
MediaStore.Images.Media.DATA + " LIKE '%" + APP_PICTURES_DIRECTORY_NAME + "%'",
null,
null
);
String[] imageIds = new String[imagesCursor.getCount()];
int i = 0;
while (imagesCursor.moveToNext()) {
imageIds[i++] = imagesCursor.getString(imagesCursor.getColumnIndex(MediaStore.Images.Media._ID));
}
String[] selectionArgs = {TextUtils.join(",", imageIds)};
return new CursorLoader(
JourneyAlbumActivity.this,
MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI,
mProjection,
MediaStore.Images.Thumbnails.KIND + " = " + MediaStore.Images.Thumbnails.MINI_KIND +
" AND " + MediaStore.Images.Thumbnails.IMAGE_ID + " IN (?)",
selectionArgs,
MediaStore.Images.Thumbnails.IMAGE_ID + " DESC"
);
}
But the result is empty in the result. If I remove this clause
... + " AND " + MediaStore.Images.Thumbnails.IMAGE_ID + " IN (?)"
Everything's ok but in the result I have a grid of thumbnails of all the images taken with camera while I need only those from my specific directory. How do I select thumbnails for images from a particular folder or with particular IDs?
Actually, to make it work you have to insert your parameter directely inside the clause :
return new CursorLoader(
JourneyAlbumActivity.this,
MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI,
mProjection,
MediaStore.Images.Thumbnails.KIND + " = " + MediaStore.Images.Thumbnails.MINI_KIND +
" AND " + MediaStore.Images.Thumbnails.IMAGE_ID + " IN ("+TextUtils.join(",", ids)+")",
selectionArgs,
MediaStore.Images.Thumbnails.IMAGE_ID + " DESC"
);
Best regards,
Maybe you can try something like this:
System.out.println("getFilePaths()");
File fileDir = new File(Environment.getExternalStorageDirectory().getAbsolutePath()+ File.separator +"folder_name"+ File.separator + AppConstant.PHOTO_ALBUM);
if(!fileDir.exists()){
System.out.println("fileDir does not exist");
try{
fileDir.mkdir();
} catch (Exception e) {
e.printStackTrace();
}
}
else
System.out.println("fileDir DOES exist");
File directory = fileDir;
// check for directory
if (directory.isDirectory()) {
// getting list of file paths
File[] listFiles = directory.listFiles();
// Check for count
if (listFiles.length > 0) {
// loop through all files
for (int i = 0; i < listFiles.length; i++) {
// get file path
String filePath = listFiles[i].getAbsolutePath();
// check for supported file extension
if (IsSupportedFile(filePath)) {
// Add image path to array list
filePaths.add(filePath);
}
}
} else {
// image directory is empty
Toast.makeText(
_context,
AppConstant.PHOTO_ALBUM
+ " is empty. Please load some images in it !",
Toast.LENGTH_LONG).show();
}
} else {
AlertDialog.Builder alert = new AlertDialog.Builder(_context);
alert.setTitle("Error!");
alert.setMessage(AppConstant.PHOTO_ALBUM
+ " directory path is not valid! Please set the image directory name AppConstant.java class");
alert.setPositiveButton("OK", null);
alert.show();
}

List of Mp3 files from a specific folder - Android

How i get list of all Mp3 files from a specific folder?
My folder is
FILE_PATH = Environment.getExternalStorageDirectory().getPath() + "/my folder/"
This following code show all mp3 from all Folder .. i want sow mp3 from my folder only
Cursor createCursor(String filter) {
ArrayList<String> args = new ArrayList<String>();
String selection;
if (mShowAll) {
selection = "(_DATA LIKE ?)";
args.add("%");
} else {
selection = "(";
for (String extension : CheapSoundFile.getSupportedExtensions()) {
args.add("%." + extension);
if (selection.length() > 1) {
selection += " OR ";
}
selection += "(_DATA LIKE ?)";
selection = selection + "AND (IS_MUSIC=1)";
}
selection += ")";
selection = "(" + selection + ") AND (_DATA NOT LIKE ?)";
args.add("%espeak-data/scratch%");
}
if (filter != null && filter.length() > 0) {
filter = "%" + filter + "%";
selection =
"(" + selection + " AND " +
"((TITLE LIKE ?) OR (ARTIST LIKE ?) OR (ALBUM LIKE ?)))";
args.add(filter);
args.add(filter);
args.add(filter);
}
Use the below code to get the list of mp3 files from the desired folder :-
private ArrayList<String> listmp3 = new ArrayList<String>();
String[] extensions = { "mp3" };
private void loadmp3(String YourFolderPath) {
File file = new File(YourFolderPath);
if (file.isDirectory()) {
File[] files = file.listFiles();
if (files != null && files.length > 0) {
for (File f : files) {
if (f.isDirectory()) {
loadmp3(f.getAbsolutePath());
} else {
for (int i = 0; i < extensions.length; i++) {
if (f.getAbsolutePath().endsWith(extensions[i])) {
listmp3.add(f.getAbsolutePath());
}
}
}
}
}
}
}
This one is Working fine
Cursor createCursor(String filter) {
ArrayList<String> args = new ArrayList<String>();
String path = Environment.getExternalStorageDirectory().getPath();
String selection = MediaStore.Audio.Media.IS_MUSIC + " !=" + 0
+ " AND " + MediaStore.Audio.Media.DATA + " LIKE '" + path
+ "/Fast Mp3 Downloader/%'";
if (filter != null && filter.length() > 0) {
filter = "%" + filter + "%";
selection =
"(" + selection + " AND " +
"((TITLE LIKE ?) OR (ARTIST LIKE ?) OR (ALBUM LIKE ?)))";
args.add(filter);
args.add(filter);
args.add(filter);
}
String[] argsArray = args.toArray(new String[args.size()]);
getExternalAudioCursor(selection, argsArray);
getInternalAudioCursor(selection, argsArray);
Cursor c = new MergeCursor(new Cursor[] {
getExternalAudioCursor(selection, argsArray),
getInternalAudioCursor(selection, argsArray)});
startManagingCursor(c);
return c;
}

Garabage value in list

i'm populating a list view to view my record, i've the following code...
super.onCreate(savedInstanceState);
setContentView(R.layout.total);
ArrayList<Object> results = new ArrayList<Object>();
// -- SQLiteOpenHelper dbHelper = new DatabaseHelper(this, SAMPLE_DB_NAME, null, 1);
SQLiteDatabase myDB = this.openOrCreateDatabase(SAMPLE_DB_NAME, SQLiteDatabase.OPEN_READONLY, null);
try {
/* Create the Database (no Errors if it already exists) */
myDB.execSQL("PRAGMA foreign_keys = ON;");
// -- openOrCreateDatabase(name, mode, factory)
// myDB = dbHelper.getReadableDatabase();
Cursor c = myDB.query(DatabaseHelper.SAMPLE_TABLE_NAME, null, null, null, null, null, null);
Cursor d = myDB.query(DatabaseHelper.SAMPLE_TABLE_NAMES, null, null, null, null, null, null);
/* Check if our result was valid. */
if (c != null && d != null) {
c.moveToFirst(); // it's very important to do this action otherwise your Cursor object did not get work
d.moveToFirst();
char cust_name = (char) c.getColumnIndex("cust_name");
char pro_name = (char) d.getColumnIndex("pro_name");
int pro_price = (int) d.getColumnIndex("pro_price");
/* Check if at least one Result was returned. */
if (c.isFirst() && d.isFirst()) {
int i = 0;
/* Loop through all Results */
do {
i++;
String cust_nameColumnIndex = c.getString(cust_name);
String pro_nameColumnIndex = c.getString(pro_name);
int pro_priceColumnIndex = c.getInt(pro_price);
/* Add current Entry to results. */
results.add("" + i + ": " + cust_name + " (" + pro_name + ": " + pro_price + ")");
} while (c.moveToNext()&& d.moveToNext());
}
}
} catch (SQLiteException e) {
} finally {
if (myDB != null)
myDB.close();
}
// -- android.R.layout.simple_list_item_1 is object which belong to ListActivity itself
// -- you only need to add list object in your main layout file
this.setListAdapter(new ArrayAdapter<Object>(this, android.R.layout.simple_list_item_1, results));
}
total.xml
<ListView
android:id="#id/android:list"
android:layout_width="fill_parent"
android:layout_height="380dp"
android:cacheColorHint="#00000000" >
</ListView>
the data is successfully inserted to sqlite (confirmed from adb shell)...it gives me garbage value...can any one please figure out the issue....Thanks in advance
That is not garbage values references(memory) addresses, use below code it will work.
do {
i++;
String cust_nameColumnIndex = c.getString(cust_name);
String pro_nameColumnIndex = c.getString(pro_name);
int pro_priceColumnIndex = c.getInt(pro_price);
/* Add current Entry to results. */
results.add("" + i + ": " + cust_nameColumnIndex + " (" + pro_nameColumnIndex + ": " + pro_priceColumnIndex + ")");
} while (c.moveToNext()&& d.moveToNext());
this.setListAdapter(new ArrayAdapter<Object>(this, android.R.layout.simple_list_item_1, (String[]) results.toArray(new String[0])));
Try changing the way you read your cursors. Something like that might be better:
//Get the indexes
int cust_name = cursor.getColumnIndex("cust_name");
int pro_name = cursor.getColumnIndex("pro_name");
int pro_price = cursor.getColumnIndex("pro_price");
try {
if(cursor.moveToFirst()){
while (!cursor.isAfterLast()) {
//Get the data
String cust_nameColumnIndex = cursor.getString(cust_name);
String pro_nameColumnIndex = cursor.getString(pro_name);
int pro_priceColumnIndex = cursor.getInt(pro_price);
//Move to next cursor item
cursor.moveToNext();
}
}
else {
Log.i(TAG, "Empty cursor");
//Do whatever
}
} catch (Exception e) {
Log.i(TAG, "Exception while reading cursor: " + e.getMessage());
//Do whatever
}
finally {
cursor.close();
}

Categories

Resources