Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - Error in ContentURI while retrieving the Images

Error in ContentURI while retrieving the Images

All your problems with Audio, Video and Images.

Error in ContentURI while retrieving the Images

Postby Niketa » Mon Sep 22, 2008 6:30 am

Hello,
I am try to retrieve all images from phone in to a list format. so for that i first try to retrieve images in Content Provider.
But i am facing problem with that. my error is,

1. Method toURI() is undefined for the type Uri.
code:- ContentURI uri1 = new
ContentURI(android.provider.MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI.toURI());
2. The method getColumnIndex(String)from the type cursor is Deprecated.
code:- int imageIndex =
cur.getColumnIndex(android.provider.MediaStore.Images.Media.DATA);

My Full Code is,
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public class ImageCursor extends Activity {
  2.  
  3.     /** Called when the activity is first created. */
  4.  
  5.          public void onCreate(Bundle icicle) {
  6.  
  7.          final String TAG2 = "TAG2";
  8.  
  9.          Log.v(TAG2, "Start" );
  10.  
  11.          getDataImage();
  12.  
  13.          super.onCreate(icicle);
  14.  
  15.     }
  16.  
  17.  
  18.  
  19.            public void addImageB(){
  20.  
  21.                    final String tag="aaaa";
  22.  
  23.                    Log.i(tag,"TO ADD");
  24.  
  25.                 ContentValues values = new ContentValues();
  26.  
  27.                 values.put(android.provider.MediaStore.Images.ImageColumns.BUCKET_DISPLAY_NAME, "road_trip_1");
  28.  
  29.                 values.put(android.provider.MediaStore.Images.ImageColumns.DESCRIPTION, "Day 1 trip to Los Angeles");
  30.  
  31.                
  32.  
  33.                 Uri uri =
  34.  
  35.         getContentResolver().insert(android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI,      values);
  36.  
  37.                 OutputStream outStream;
  38.  
  39.                         try {
  40.  
  41.                                 outStream = getContentResolver().openOutputStream(uri);
  42.  
  43.                                 Bitmap sourceBitmap =
  44.  
  45.         BitmapFactory.decodeResource(this.getResources(),
  46.  
  47.         R.drawable.icon);
  48.  
  49.                                 sourceBitmap.compress(Bitmap.CompressFormat.PNG, 50, outStream);
  50.  
  51.                         outStream.close();
  52.  
  53.                         } catch (FileNotFoundException e) {
  54.  
  55.                                 e.printStackTrace();
  56.  
  57.                                 Log.i(tag, e.getMessage());
  58.  
  59.                         } catch (IOException e) {
  60.  
  61.                                 e.printStackTrace();
  62.  
  63.                                 Log.i(tag, e.getMessage());
  64.  
  65.                         }
  66.  
  67.  
  68.  
  69.             }
  70.  
  71.          public void getDataImage(){
  72.  
  73.                 // ############# PROBLEM HERE #############
  74.  
  75.                 ContentURI uri1 = new
  76.  
  77.         ContentURI(android.provider.MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI.toURI());
  78.  
  79.                 // ############# END PROBLEM #############
  80.  
  81.                 Cursor cur = this.managedQuery(uri1, projection, null, null);
  82.  
  83.                 final String tag2="aaaa";
  84.  
  85.                 Log.i(tag2,"NUM");
  86.  
  87.                 if(cur != null)
  88.  
  89.                         getColumnDataImage(cur);
  90.  
  91.             }
  92.  
  93.  
  94.  
  95.             private void getColumnDataImage(Cursor cur){
  96.  
  97.                // if(!cur.first())
  98.  
  99.                  //   return;
  100.  
  101.                 cur.moveToFirst();
  102.  
  103.  
  104.  
  105.                 int imageIndex =
  106.  
  107.         cur.getColumnIndex(android.provider.MediaStore.Images.Media.DATA);
  108.  
  109.                 if(imageIndex==0)
  110.  
  111.                 {
  112.  
  113.                         final String tag2="aaa";
  114.  
  115.                         Log.i(tag2,"No files are there");
  116.  
  117.                 }
  118.  
  119.                 else
  120.  
  121.                 {
  122.  
  123.                         final String tag2="aaaa";
  124.  
  125.                         Log.i(tag2,"files ");
  126.  
  127.                 }
  128.  
  129.         /*      do {
  130.  
  131.                     ContentURI imagePath = null;
  132.  
  133.                                 String u = cur.getString(imageIndex);
  134.  
  135.                                 Log.i("MYAPP>>>>", ""+u);
  136.  
  137.                                 if(u!=null){
  138.  
  139.                                         try {
  140.  
  141.                                                 imagePath = new ContentURI(u);
  142.  
  143.                                         } catch (URISyntaxException e) {
  144.  
  145.                                                 e.printStackTrace();
  146.  
  147.                                                 Log.e("MYAPP>>>>", e.getMessage());
  148.  
  149.                                         }
  150.  
  151.                                         Log.i("MYAPP>>>>", ""+imagePath.toString());
  152.  
  153.                                         if(imagePath != null){
  154.  
  155.                                                 InputStream is = null;
  156.  
  157.                                                 ContentResolver cr = this.getContentResolver();
  158.  
  159.                                                 if(cr != null){
  160.  
  161.                                                          try{
  162.  
  163.                                                              is = cr.openInputStream(imagePath);
  164.  
  165.                                                         } catch (FileNotFoundException e) {
  166.  
  167.                                                                 e.printStackTrace();
  168.  
  169.                                                                 Log.e("MYAPP>>>>", e.getMessage());
  170.  
  171.                                                         }
  172.  
  173.                                                 }
  174.  
  175.                                                 if(is != null){
  176.  
  177.                                                         b = BitmapFactory.decodeStream(is);
  178.  
  179.                                                 }
  180.  
  181.                                         }
  182.  
  183.                                 }
  184.  
  185.                 }while (cur.next());*/
  186.  
  187.                 }
  188.  
  189.            
  190.  
  191.         }
  192.  
  193.  
Parsed in 0.015 seconds, using GeSHi 1.0.8.4

Please Do help as soon as possible..its too urgent.
Niketa
Developer
Developer
 
Posts: 36
Joined: Wed Sep 17, 2008 12:37 pm

Top

Postby fala70 » Mon Dec 08, 2008 5:42 pm

if you found a solution please post it. I 've same problem
thanks
fala70
Freshman
Freshman
 
Posts: 3
Joined: Mon Dec 08, 2008 11:49 am

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: Exabot [Bot] and 5 guests