Please help with Android development

by Nerses Zackoyan » Wed, 14 May 2008 11:55:58 GMT

Sponsored Links
 Dear Android Staff,

I have problem with getting event onChange(boolean selfchange) in
ContentObserver when I set getContentResolver().registerContentObserver(
android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI ,
true,imageObserver );  and add image file in sdcard using ddms or using
FileOutputStream() .
Also the "media" database in sdcard doesn't refresh data if I add image file
in sdcard. It refreshes only if I restart emulator or if I add using

Here is my code:
import android.content.ContentResolver;
import android.content.Intent;
import android.database.ContentObserver;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;

public class PhService extends Service {

        Logger logger=new Logger();
    private Handler handler = new Handler();

    private ImagesObserver imageObserver = null;

    class ImagesObserver extends ContentObserver {
      public ImagesObserver( Handler h ) {
        super( h );

      public void onChange(boolean selfChange) {

    public void show(){
        logger.record("content images", "changed");

    public void onCreate() {
        logger.record("content images", "created");

    protected void onDestroy() {
        // TODO Auto-generated method stub

    protected void onStart(int startId, Bundle arguments) {
        // TODO Auto-generated method stub
        logger.record("content images", "started");

// Set up content observer for our content provider
    private void registerContentObservers() {
     ContentResolver cr = getContentResolver();
      imageObserver = new ImagesObserver( handler );
android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI ,
true,imageObserver );


    private void unregisterContentObservers() {
      ContentResolver cr = getContentResolver();

      if( imageObserver != null ) {        // just paranoia
        cr.unregisterContentObserver( imageObserver );
        imageObserver = null;

    public IBinder onBind(Intent intent) {
        //Toast.makeText(this, R.string.no_items,
        // TODO Auto-generated method stub
        return null;




Other Threads

1. Why My application could play http but not rtsp?

I wrote a application .It could playback the internet video and
audio , if I give it a address begin with "http://".But when I input
the address that is beginning with the "rtsp://",It could not play.

I/ActivityManager( 1074): Process (pid 2152)
has died.
I/ActivityManager( 1074): Low Memory: No more background processes.
D/skia    ( 1122): purging 10K from font cache [1 entries]
I/ActivityManager( 1074): Starting activity: Intent
{ act=android.intent.action.MAIN cat=
[android.intent.category.LAUNCHER] flg=0x10200000 }
I/ActivityManager( 1074): Start proc for activity pid=2163 uid=10020 gids={}
I/WindowManager( 1074): Setting rotation to 1, animFlags=0
I/WindowManager( 1074): Config changed: { scale=1.0 imsi=0/0 loc=en_US
touch=3 keys=1/1/2 nav=1 orien=2}
D/StatusBar( 1074): updateResources
W/IInputConnectionWrapper( 1122): showStatusIcon on inactive
I/ActivityManager( 1074): Displayed activity 989 ms (total 989 ms)
I/ActivityManager( 1074): Starting activity: Intent
{ }
I/ActivityManager( 1074): Displayed activity 137 ms (total 137 ms)
I/ActivityManager( 1074): Starting activity: Intent
{ act=android.intent.action.VIEW dat=rtsp://
typ=video/* }
I/ActivityManager( 1074): Start proc for activity pid=2170 uid=10003 gids={1006, 1015,
2001, 3003}
W/InputManagerService( 1074): Starting input on non-focused client$stub$pr...@4384c6a8
(uid=10020 pid=2163)
W/IInputConnectionWrapper( 2163): showStatusIcon on inactive
V/VideoView( 2170): reset duration to -1 in openVideo
I/ActivityManager( 1074): Displayed activity 2300 ms (total 2300 ms)
I/ActivityManager( 1074): Process (pid 2163) has
I/WindowManager( 1074): WIN DEATH: Window{437bb600 paused=false}
I/WindowManager( 1074): WIN DEATH: Window{4381f0c8 paused=false}
I/ActivityManager( 1074): Low Memory: No more background processes.
W/QCvdec  ( 1029): get_parameter: unknown param 0ff7a347
D/skia    ( 1122): purging 33K from font cache [4 entries]
D/skia    ( 1074): purging 43K from font cache [6 entries]
D/skia    ( 2170): purging 21K from font cache [3 entries]
E/PlayerDriver( 1029): Command PLAYER_PREPARE completed with an error
or info PVMFFailure
W/PlayerDriver( 1029): PVMFInfoErrorHandlingComplete
E/MediaPlayer( 2170): error (1, -1)
E/MediaPlayer( 2170): Error (1,-1)
D/VideoView( 2170): Error: 1,-1
E/MediaPlayer( 2170): stop called in state 0
E/MediaPlayer( 2170): error (-38, 0)


2. Apn Switching to default


when ever Apn Swithed to default, if already one data application is
running with the specified APN, Does it will wait up to that data
application ends? or it will close that Data application also?

How can we set our Specified APN from the application?


3. Problem with Dialog theme when launching from another activity

4. setImageMatrix has no effect?

5. Help on android-port to mini2440

6. Android NDK ( Native code Debugging)

7. How to do we take a Screenshot using ADB Comand Line