[android-developers] What could cause ProgressDialog Spinner to stop spinning?

2010-10-05 Thread Nam Ngo
When you dismiss the progress dialog, next time you show it, it will not
spin, try to create new progress dialog,

BR,
Nam

On Tue, 2010-10-05 at 07:48 -0700, Jin Chiu wrote:
 I've observed instances when the spinner inside my ProgressDialog
 would occassionally freeze- stop spinning. What are some possible
 causes for this? While the ProgressDialog is up, we typically perform
 a lot of a work on the UI thread. Could this be depriving the
 ProgressDialog of drawing cycles?
 

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: Mount sdcard USB Storage through adb.

2010-10-01 Thread Nam Ngo
You can try:

1. Enable USB MASS STORAGE mode (UMS)
adb shell /system/bin/sdutil ums enable

2. Mount it into a folder
sudo mount /dev/sdb ~/SDCARD

3. Disable USB MASS STORAGE
adb shell /system/bin/sdutil ums disable

BR,
Nam

On Fri, 2010-10-01 at 04:14 -0700, FrankG wrote:
 Your subject is strange .. as the sdcard has nothing to do with the
 sdcard.
 
 I assume you would like to know how to mount the sdcard via a command
 from
 a adb prompt .
 
 You can do this  via a system call command.
 
 I haven't the details by hand, but it is one of the system services
 which allow you to do this.
 You need to look into the aidl interface for them and then you can
 call them via system call ..
 
 As a joke try out : service call  phone 2 s16  a phone number of a
 friend
 
 Good luck !
 
   Frank
 
 
 
 On 30 Sep., 20:28, Nathan critter...@crittermap.com wrote:
  I can't seem to find a command that will allow me to mount/unmount the
  sdcard from the adb prompt.
 
  From the documentation, it appears that this can't be done in an
  emulator, so I am trying with a Nexus One.
 
  I would like to simulate the card being mounted or unmounted while my
  Activity is active. I can't do this on the Nexus One through the
  notification menu, because this will pause and then resume and
  activity, during which time storage card broadcast notifications are
  not sent.
 
  I know other devices can and do mount the storage without leaving an
  Activity, in particular because they will automount the storage
  whenever the USB is plugged in (according to users, even if you tell
  it not to). For that reason, this is a case I want to test.
 
  Nathan
 

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] What is a binder thread?

2010-09-29 Thread Nam Ngo
As I know, they take control over Activity interaction also, because we
use IPC to communicate between Activity.
There is also a limitation of data we can transmit over a BinderThread,
usually  1MB.

BR,
Nam

On Wed, 2010-09-29 at 12:42 -0400, Mark Murphy wrote:
 If I understand correctly, for IPC via AIDL, the object that is
 responding to the IPC is invoked on a binder thread. The object
 definitely is not invoked on the main application thread.
 
 They may have additional uses, but that's the one I can think off of
 the top o' my head.
 
 On Wed, Sep 29, 2010 at 12:37 PM, DanH danhi...@ieee.org wrote:
  I tried Google, but the only answer I could find is They were created
  by the system and they don't do any harm.  I'm not worried about them
  per se, but was just curious about what they actually do and why
  they're there.
 
 -- 
 Mark Murphy (a Commons Guy)
 http://commonsware.com | http://github.com/commonsguy
 http://commonsware.com/blog | http://twitter.com/commonsguy
 
 Android 2.2 Programming Books: http://commonsware.com/books
 

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] What is a binder thread?

2010-09-29 Thread Nam Ngo
As I know, they take control over Activity interaction also, because we
use IPC to communicate between Activity.
There is also a limitation of data we can transmit over a BinderThread,
usually  1MB.

BR,
Nam

On Wed, 2010-09-29 at 09:37 -0700, DanH wrote:
 I tried Google, but the only answer I could find is They were created
 by the system and they don't do any harm.  I'm not worried about them
 per se, but was just curious about what they actually do and why
 they're there.
 

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] browse picture gallery

2010-09-28 Thread Nam Ngo
Hi Zeeshan,

In Android, we have a Gallery as native app, you can try to send the
Intent.ACTION_GET_CONTENT to get the picture,

This is the sample code:

Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.setDataType(image/*);
startActivityForResult(i)

and in onActivityResult, we will get an intent with the uri in the data
of the intent.

BR,
Nam

On Tue, 2010-09-28 at 17:51 +0200, zeeshan mirza wrote:
 Hi Friends,
 I am developing an android application in which i have to browse
 picture gallery or picture folder by clicking on a browse button and
 then have to select a picture. I dont know how to do that. I have done
 that in .Net but have no idea how to do in android. Is there anyone
 who can help me? Thanks in advance :)
 
 BR,
 Zeeshan
 

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Ending a Thread Safely

2010-09-28 Thread Nam Ngo
Hi Stuart,

Can you determine whether the life cycle of the thread is bound to
which? The SurfaceView or the Activity,
I think the common control should have a callback to let you know that
its life cycle is come to an end (onDestroyed or onSurfaceDestroyed),
you can try to join the Thread at that time, and make sure you have a
well control Thread( extends Thread and define some variable to control
the run()), stop it and join it will help you let the Thread end safely,
as it will have no call back to the object bind the thread when the
object is destroyed.

I cannot provide a sample code, but the concept should be:

SafeThread extends Thread {

boolean stop = false

run() {
while (!stop)
...
}

stop(){
stop = true;
}

}

and 

onDestroyed() {
safeThread.stop();
safeThread.join();
}

BR,
Nam

On Tue, 2010-09-28 at 09:33 -0700, Stuart wrote:

 I've found lots of great tutorial on starting a thread, however what's
 the best way to close a thread that's using a SurfaceView in a game
 loop and set a new view? Could you provide some sample code?
 

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] browse picture gallery

2010-09-28 Thread Nam Ngo
Hi Zeeshan,

In Android, we have a Gallery as native app, you can try to send the
Intent.ACTION_GET_CONTENT to get the picture,

This is the sample code:

Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.setDataType(image/*);
startActivityForResult(i)

and in onActivityResult, we will get an intent with the uri in the data
of the intent.

BR,
Nam

On Tue, 2010-09-28 at 17:51 +0200, zeeshan mirza wrote:

 Hi Friends,
 I am developing an android application in which i have to browse
 picture gallery or picture folder by clicking on a browse button and
 then have to select a picture. I dont know how to do that. I have done
 that in .Net but have no idea how to do in android. Is there anyone
 who can help me? Thanks in advance :)
 
 BR,
 Zeeshan
 

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Ending a Thread Safely

2010-09-28 Thread Nam Ngo
Hi Stuart,

Can you determine whether the life cycle of the thread is bound to
which? The SurfaceView or the Activity,
I think the common control should have a callback to let you know that
its life cycle is come to an end (onDestroyed or onSurfaceDestroyed),
you can try to join the Thread at that time, and make sure you have a
well control Thread( extends Thread and define some variable to control
the run()), stop it and join it will help you let the Thread end safely,
as it will have no call back to the object bind the thread when the
object is destroyed.

I cannot provide a sample code, but the concept should be:

SafeThread extends Thread {

boolean stop = false

run() {
while (!stop)
...
}

stop(){
stop = true;
}

}

and 

onDestroyed() {
safeThread.stop();
safeThread.join();
}

BR,
Nam

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] what function should i use to control memory in java

2010-09-28 Thread Nam Ngo


You can try using ndk if you are familiar with C++.

BR,
Nam

On Tue, 2010-09-28 at 19:12 -0700, n2v2rda2 wrote:
 im newbie in java and android
 
 in c, c++  , there are many memory-contorl-function like -
 memset,memcpy,sprintf
 i want to use those function in java
 
 what and how should i use ?
 please warm answer
 

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: While Loop Stall the rest of the program

2010-09-27 Thread Nam Ngo
Hello ArcDroid,

From my experience, the design concept should be as follow:

We will have 2 threads:

Main Thread will provide a call back for Image Thread to set image to
ImageView.
Image Thread will download/ load the bitmap, then use the call back to
set Bitmap to ImageView.

The call back can be either a method/ function in Main Thread that's
wrapped by runOnUiThread or implemented by Handler of Main Thread.

You can also try to update the ImageView in runOnUiThread, but that's
not a good design, however, it will work.

BR,
Nam

On Sun, 2010-09-26 at 01:29 -0700, ArcDroid wrote:

 I originally tried a separate thread, but couldn't update the
 ImageView from my new thread.
 
 On Sep 26, 1:23 am, ArcDroid jacobrjohn...@gmail.com wrote:
  the first picture never loads with the while loop.  Once the loop is
  removed the first picture loads just fine.  right now it doesn't load
  the first pic, but will show the second after 5 seconds.
  Thanks
 
  //start with picture 1
  main.setImageResource(R.drawable.pic1);
 
  //after 5 seconds load another picture
  int pause = 5;
   while ( System.currentTimeMillis() = startTime + (pause * 1001)){
  if (System.currentTimeMillis() = startTime + (pause * 
  1001)) {
  main.setImageResource(R.drawable.pic2);
 
  }}
 
  On Sep 26, 1:18 am, Kumar Bibek coomar@gmail.com wrote:
 
 
 
   Ummm, you should mention more details, as to what and how you are
   doing things. Else, no one can answer your query.
 
   -Kumar Bibekhttp://techdroid.kbeanie.com
 
   On Sep 26, 12:45 pm, ArcDroid jacobrjohn...@gmail.com wrote:
 
Hello,
I am trying to load a picture, then run a while loop.  The problem is
that the program runs the while loop and doesn't load the pictures
until the loop has finished.  Any help is appreciated.
Thanks
Jake
 

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en