getContentResolver.query(Images.Media.EXTERNAL_CONTENT_URI ...) returns null on device

by » Mon, 13 Apr 2009 08:24:32 GMT

Sponsored Links
 This code works fine with the emulator, I can get a cursor to all the
images, but after I installed the app into the real device (G1), I ran
the app, this call returns null. If I change from EXTERNAL_CONTENT_URI
to INTERNAL_CONTENT_URI, at least it returns not null cursor and the
count is 0.

Anything I should do to get this to work?

getContentResolver.query(Images.Media.EXTERNAL_CONTENT_URI ...) returns null on device

by » Mon, 13 Apr 2009 11:57:34 GMT

 Yes. But I figured it out. If I mount the device after plugged in
through USB, it won't be able to query. After I disconnect and then
reconnect the phone without mount the drive, i can get this to work.


Sponsored Links

Other Threads

1. can't change chronometer time format

Hi guys,
I'm new to Android dev. and probably this question might be silly but
I haven't find a good answer by googling the web. I want to display a
chronometer and two buttons (Start and Stop) in a LinearLayout view.
Is it possible to specify a format different from "0:00"? I want to
have a format similar to "0:00:00.0" (like format available on
iPhone). Using setFormat does change the format, but I'm suspecting
it's not the right way to proceed: infact you can insert what string
you want (even a name...) and the system will display it, but of
course clicking start or stop won't produce any effect on it.
I've posted the source code.. can you help me? Thanks!!


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="

<Chronometer android:layout_height="wrap_content" android:id="@+id/
chronometer" android:text="Chronometer"
android:layout_width="fill_parent" android:textSize="32sp"
android:gravity="center_horizontal" android:format="0:00:00.000"></
<Button android:text="Start" android:id="@+id/startButton"
<Button android:text="Stop" android:id="@+id/stopButton"


package com.example.helloandroid;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Chronometer;

public class HelloAndroid extends Activity {
        private boolean started = false;

   /** Called when the activity is first created. */
  public void onCreate(Bundle savedInstanceState) {
       final Chronometer chronometer = (Chronometer) this.findViewById

       Log.d("HelloAndroid", "Value of getFormat() is: "+

       final Button startButton = (Button) findViewById
       startButton.setOnClickListener(new View.OnClickListener() {
           public void onClick(View v) {
                           Log.d("Hello Android", "start button clicked");
                           started = true;


       final Button stopButton = (Button) findViewById
       stopButton.setOnClickListener(new View.OnClickListener() {
           public void onClick(View v) {
                           Log.d("Hello Android", "stop button clicked");
                           started = false;


2. SQLite compression ,improvement and apk integration

Hello there,

I am developping an app where the main data source is a SQLite

First problem is the size.
Second problem is the access.
Third integrate to the apk the sqlite database (read-only)

I know that SQLite has a way to compress the size of the database.
Is this feature available with android?
My database is about 40M and I think its to much.

So is there some tweaking to improve size and access for our lovely
portable devices.

I am little tired, it's late out there and have been about 2 weeks
looking for a solution.


3. "official Android Marketis a total joke"

4. Compache dan Swap

5. Migrating Google Accounts from 1.x to 2.0

6. How Handle Android Default Messaging Application According To Our Requirement

7. Get info from mp3 file