Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

android java how to clear or close cursor

Cursor cursor = db.rawQuery(...);
try {
  while (cursor.moveToNext()) {
    ...
  }
} finally {
  cursor.close();
}
Comment

android java how to clear or close cursor

public String getRealPathFromURI(Context context, Uri contentUri) {
 Cursor cursor = null;
 try { 
  String[] proj = { MediaStore.Images.Media.DATA };
  cursor = context.getContentResolver().query(contentUri,  proj, null, null, null);
  int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
  cursor.moveToFirst();
  return cursor.getString(column_index);
 } finally {
  if (cursor != null) {
   cursor.close();
  }
 }
}
Comment

PREVIOUS NEXT
Code Example
Java :: how to not allow a user to enter a mark greater than 100 or below 0 in java 
Java :: Java Program to Print Spiral Pattern of Numbers 
Java :: android set socket timeout 
Java :: add words from string to collection java 
Java :: control statements 
Java :: Java Maven Using platform encoding (UTF-8 actually) to read mojo metadata, i.e. build is platform dependent! 
Java :: store files system in tree java 
Java :: intellij evaluate expression 
Java :: java Map to LinkedHashMap with ascending order of keys 
Java :: android studio enum usage 
Java :: combine .proto in android studio project 
Java :: GLG203 
Java :: java boolean zen 
Java :: Converting data in java 
Java :: is java good then c++ is good 
Java :: MojoExecutionException when generate sources cxf-xjc-plugin:3.3.0 java11 
Java :: java.lang.noclassdeffounderror: failed resolution of: lorg/apache/http/protocolversion; 
Java :: iterator Implementation 
Java :: console.log in spring boot 
Java :: pyqt tree view 
Java :: list all android sensors in java 
Java :: Java take() Method 
Java :: reverse integer 
Java :: springboot body 
Java :: set attribute java 
Java :: No Duplicate Key on HashMap 
Java :: Give the output of the following code: int a = 10; int b = 20; String s = Integer.toString(a); String t = Integer.toString(b); System.out.println((s+t)); 
Java :: clear method does not work selenium java 
Java :: how to disable the auto-configuration? 
Java :: java non blocking notifier 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =