[android-developers] RE: Mediastore Thumbnails not generated until Gallery app is launched ?

2009-12-19 Thread Nivek
Hello,

As I can't find any news on this subject, I would like to know if the
thumbnails generation has been added to the MediaScanner in a 2.*
release ?

Thanks

Kevin


-- Forwarded message --
From: Marco Nelissen marc...@android.com
Date: 8 oct, 16:13
Subject: Mediastore Thumbnails not generated until Gallery app is
launched ?
To: Android Developers


On Thu, Oct 8, 2009 at 1:21 AM, Kevin Gaudin kevin.gau...@gmail.com
wrote:

 Hello, thanks for this, I have been also browsing the Camera app code
 which hosts the Gallery and considering to hack something in order
 to achieve an additional goal.

 In my view ofthumbnailsmanagement, the thumbnail generation itself
 should be handled by the system. I don't think Android should let
 every application generatethumbnailsin different formats, sizes,
 quality, locations.

 What I am trying to achieve is to provide Camera code with the
 original bitmap and let it generate the thumbnail and store it.

 BUT, I think the real goal for android should better be to extract
thumbnailsmanagement from Camera app and put this task in the
 MediaScanner or the Media ContentProvider.

Agreed. We're working on it.

-- 
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] image problem in Database

2009-12-19 Thread MPS
hai developers,

i had attached my code to store the image in database.after i run
my code ,the emulater have the blank screen.no images display in
emulator.anyone can help me ,what is the wrong in the code.why the
image dispaly in emulator?otherwise  is there any other method have to
get the image from database.help me to solve my problem.

public class imagedatabase extends Activity
{

private final String MY_DATABASE_NAME = WalletZarr;
private final String MY_DATABASE_TABLE = mytable;

public void onCreate(Bundle icicle)
{
super.onCreate(icicle);
SQLiteDatabase myDB = null;
try {
myDB = this.openOrCreateDatabase(MY_DATABASE_NAME ,
MODE_PRIVATE,null);
myDB.execSQL(CREATE TABLE IF NOT EXISTS  + MY_DATABASE_TABLE+(image
BLOB););
Bitmap bmp1=BitmapFactory.decodeResource(getResources(),
R.drawable.icon);
ByteArrayOutputStream out = new ByteArrayOutputStream();
bmp1.compress(Bitmap.CompressFormat.PNG, 100, out);
myDB.execSQL(INSERT INTO + MY_DATABASE_TABLE + (image) +  VALUES
(\+bmp1+\););
Cursor c = myDB.rawQuery(SELECT * +  FROM  +
MY_DATABASE_TABLE,null);
int firstNameColumn=c.getColumnIndex(image);
if (c.moveToFirst())
{
do
{
byte[] blob=c.getBlob(firstNameColumn);
Bitmap bmp=BitmapFactory.decodeByteArray(blob,0,blob.length);
ImageView image=new ImageView(this);
image.setImageBitmap(bmp);
} while (c.moveToNext());
}
}
catch (Exception e)
{
}
finally
{ if (myDB != null)
myDB.close();
}}}

-- 
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] Re: I am a newbie...

2009-12-19 Thread Jae Chang
how do i run sample codes? (most important)
and what do u mean by debug perspective, how do i run that?
and how do i install USB driver, like usb driver patch thing in
Android SDK, ADT?

On Dec 18, 2:06 pm, Frank Weiss fewe...@gmail.com wrote:
 To run on a phone, install the USB driver. For development in Eclipse,  just
 use the Debug perspective - it will automatically create the .apk, download
 to the phone, and run it.

 On Dec 18, 2009 11:24 AM, Jae Chang jaehach...@gmail.com wrote:

 I just followed the direction on google code page to set up java IDE,
 eclipse and android sdk and i tried all the steps to go hello
 world app. now i want to try to run other sample codes provided by
 google android team.
 i downloaded zip file fromhttp://android-developers.blogspot.com/?hl=en
 and i took out a folder out of it, but how do i run it in eclipse then
 execute in android sdk?
 and how do i repackage the file to apk to run it in a phone?

 i want to be able to try samples and how they run so that i can start
 it by using sample codes to write my own code (i have an electrical
 engineeering degree from college and i did c and c++ coding though it
 was very basic, but i can say i can learn what is explained with
 proper steps)

 tell me where i can find the steps to run or just tell me how to do
 it.

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group 
 athttp://groups.google.com/group/android-developers?hl=en

-- 
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] Handling Exception in a MediaFile app

2009-12-19 Thread Maxood
I'm developing a media file app that is meant to play sounds stored in
my raw folder. There are about 32 sounds in all. And this is what i'm
doing on the click of each button:

Button btnGrowUp = (Button) this.findViewById(R.id.GrowUp);
btnGrowUp.setOnClickListener(btnGrowUpListener);


private OnClickListener btnGrowUpListener = new OnClickListener()
{
public void onClick(View v)
{
//Toast.makeText(getBaseContext(), Grow Up audio file is being
played, Toast.LENGTH_SHORT).show();

MediaPlayer mp = MediaPlayer.create(MainScreen.this,
R.raw.growup);

mp.start();
}

};



I get a runtime exception saying app stops unexpectedly with the
follow messages in my logcat window:


12-19 12:33:05.420: WARN/dalvikvm(699): threadid=3: thread exiting
with uncaught exception (group=0x4000fe70)
12-19 12:33:05.441: ERROR/AndroidRuntime(699): Uncaught handler:
thread main exiting due to uncaught exception
12-19 12:33:05.460: ERROR/AndroidRuntime(699):
java.lang.NullPointerException
12-19 12:33:05.460: ERROR/AndroidRuntime(699): at
com.myapps.media.MainScreen$8.onClick(MainScreen.java:244)
12-19 12:33:05.460: ERROR/AndroidRuntime(699): at
android.view.View.performClick(View.java:2179)
12-19 12:33:05.460: ERROR/AndroidRuntime(699): at
android.view.View.onTouchEvent(View.java:3828)
12-19 12:33:05.460: ERROR/AndroidRuntime(699): at
android.widget.TextView.onTouchEvent(TextView.java:6291)
12-19 12:33:05.460: ERROR/AndroidRuntime(699): at
android.view.View.dispatchTouchEvent(View.java:3368)
12-19 12:33:05.460: ERROR/AndroidRuntime(699): at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
12-19 12:33:05.460: ERROR/AndroidRuntime(699): at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
12-19 12:33:05.460: ERROR/AndroidRuntime(699): at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
12-19 12:33:05.460: ERROR/AndroidRuntime(699): at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
12-19 12:33:05.460: ERROR/AndroidRuntime(699): at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
12-19 12:33:05.460: ERROR/AndroidRuntime(699): at
com.android.internal.policy.impl.PhoneWindow
$DecorView.superDispatchTouchEvent(PhoneWindow.java:1707)
12-19 12:33:05.460: ERROR/AndroidRuntime(699): at
com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent
(PhoneWindow.java:1197)
12-19 12:33:05.460: ERROR/AndroidRuntime(699): at
android.app.Activity.dispatchTouchEvent(Activity.java:1993)
12-19 12:33:05.460: ERROR/AndroidRuntime(699): at
com.android.internal.policy.impl.PhoneWindow
$DecorView.dispatchTouchEvent(PhoneWindow.java:1691)
12-19 12:33:05.460: ERROR/AndroidRuntime(699): at
android.view.ViewRoot.handleMessage(ViewRoot.java:1525)
12-19 12:33:05.460: ERROR/AndroidRuntime(699): at
android.os.Handler.dispatchMessage(Handler.java:99)
12-19 12:33:05.460: ERROR/AndroidRuntime(699): at
android.os.Looper.loop(Looper.java:123)
12-19 12:33:05.460: ERROR/AndroidRuntime(699): at
android.app.ActivityThread.main(ActivityThread.java:3948)
12-19 12:33:05.460: ERROR/AndroidRuntime(699): at
java.lang.reflect.Method.invokeNative(Native Method)
12-19 12:33:05.460: ERROR/AndroidRuntime(699): at
java.lang.reflect.Method.invoke(Method.java:521)
12-19 12:33:05.460: ERROR/AndroidRuntime(699): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:782)
12-19 12:33:05.460: ERROR/AndroidRuntime(699): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
12-19 12:33:05.460: ERROR/AndroidRuntime(699): at
dalvik.system.NativeStart.main(Native Method)
12-19 12:33:05.520: INFO/Process(563): Sending signal. PID: 699 SIG: 3
12-19 12:33:05.520: INFO/dalvikvm(699): threadid=7: reacting to signal
3
12-19 12:33:05.601: INFO/dalvikvm(699): Wrote stack trace to '/data/
anr/traces.txt'
12-19 12:33:05.982: INFO/ARMAssembler(563): generated
scanline__0077:03515104__ [ 27 ipp] (41 ins) at
[0x27c718:0x27c7bc] in 982527 ns
12-19 12:33:06.011: INFO/ARMAssembler(563): generated
scanline__0077:03515104_1001_ [ 64 ipp] (84 ins) at
[0x27c7c0:0x27c910] in 1804978 ns

How to resolve this issue? Thank you

Maqsood

-- 
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] Re: using soundPool but sound plays after a delay, sound is lagging

2009-12-19 Thread rukiman
I cannot quatify it but it is very noticeable and feels wrong when
playing my game. for example I play a sound when a piece is selected
however due to the lag the sound feel a bit out of place.
I will try to profile whats going on here. But I thought perhaps
someone may have had experienced this issue and come up with a
solution or workaround. I will try Matts idea of calculating the
volume before hand etc so I have to simply call soundPool.play(). Only
issue is that creates extra work i.e the sound volume might have
changed by the user meanwhile and also I'm very doubtful if it will
improve the lag.

On Dec 19, 6:37 am, Robert Green rbgrn@gmail.com wrote:
 Can you quantify the lag?  How much is it lagging?  Lately I've been
 seeing my footstep sounds, which are individually triggered right and
 left steps, take 2-50ms to trigger for some reason.  I'm not sure if
 it has something to do with the way the OGG is encoded, but I feel
 like it could.  Perhaps the SoundPool author would like to chime in
 and give us some hints?

 On Dec 18, 3:45 am, rukiman ruksh...@optushome.com.au wrote:

  I am using the SoundPool as follows:

  Caching my sounds:
                          // loadsoundeffects
                          soundPool = new SoundPool(2, 
  AudioManager.STREAM_MUSIC, 0);
                          soundPoolMap = new HashMapInteger, Integer();
                          AssetFileDescriptor afd;
                          try {
                                  afd = 
  context.getAssets().openFd(sounds/piecemove.ogg);
                                  soundPoolMap.put(SOUND_PIECEMOVE, 
  soundPool.load(afd, 1));

                                  afd = 
  context.getAssets().openFd(sounds/piecestop.ogg);
                                  soundPoolMap.put(SOUND_PIECESTOP, 
  soundPool.load(afd, 1));

                                  afd = 
  context.getAssets().openFd(sounds/pieceattack.ogg);
                                  soundPoolMap.put(SOUND_PIECEATTACK, 
  soundPool.load(afd, 1));

                                  afd = 
  context.getAssets().openFd(sounds/pieceselect.ogg);
                                  soundPoolMap.put(SOUND_PIECESELECT, 
  soundPool.load(afd, 1));

                                  afd = 
  context.getAssets().openFd(sounds/selection.ogg);
                                  soundPoolMap.put(SOUND_MENUSELECTION, 
  soundPool.load(afd, 1));

                                  afd = 
  context.getAssets().openFd(sounds/pageturn.ogg);
                                  soundPoolMap.put(SOUND_PAGETURN, 
  soundPool.load(afd, 1));
                          } catch (IOException e) {
                                  e.printStackTrace();
                          }

  Function to play sounds:

          public static int playSound(Context context, intsound) {

                  AudioManager mgr = (AudioManager) context
                                  .getSystemService(Context.AUDIO_SERVICE);
                  float streamVolumeCurrent = mgr
                                  .getStreamVolume(AudioManager.STREAM_MUSIC);
                  float streamVolumeMax = mgr
                                  
  .getStreamMaxVolume(AudioManager.STREAM_MUSIC);
                  float volume = streamVolumeCurrent / streamVolumeMax;
                  /* Play thesoundwith the correct volume */
                  return soundPool
                                  .play(soundPoolMap.get(sound), volume, 
  volume, 1, 0, 1f);
          }

  Playing asoundeffect i.e when button is clicked:

        Resources.playSound(context, Resources.SOUND_PIECESELECT);

  However as I said thesoundis lagging. What can I do to improve this?
  All my sounds are OGG file format.

-- 
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] Re: using soundPool but sound plays after a delay, sound is lagging

2009-12-19 Thread rukiman
seems like I was wrong. Profiling shows 60% is spent on getting the
audio service and setting up the volume. Only 40% is spent on the
actual play function. So would seem like I setting up the volume
before hand is the way to go. I'll try that out and see how things go.

On Dec 19, 7:46 pm, rukiman ruksh...@optushome.com.au wrote:
 I cannot quatify it but it is very noticeable and feels wrong when
 playing my game. for example I play a sound when a piece is selected
 however due to the lag the sound feel a bit out of place.
 I will try to profile whats going on here. But I thought perhaps
 someone may have had experienced this issue and come up with a
 solution or workaround. I will try Matts idea of calculating the
 volume before hand etc so I have to simply call soundPool.play(). Only
 issue is that creates extra work i.e the sound volume might have
 changed by the user meanwhile and also I'm very doubtful if it will
 improve the lag.

 On Dec 19, 6:37 am, Robert Green rbgrn@gmail.com wrote:

  Can you quantify the lag?  How much is it lagging?  Lately I've been
  seeing my footstep sounds, which are individually triggered right and
  left steps, take 2-50ms to trigger for some reason.  I'm not sure if
  it has something to do with the way the OGG is encoded, but I feel
  like it could.  Perhaps the SoundPool author would like to chime in
  and give us some hints?

  On Dec 18, 3:45 am, rukiman ruksh...@optushome.com.au wrote:

   I am using the SoundPool as follows:

   Caching my sounds:
                           // loadsoundeffects
                           soundPool = new SoundPool(2, 
   AudioManager.STREAM_MUSIC, 0);
                           soundPoolMap = new HashMapInteger, Integer();
                           AssetFileDescriptor afd;
                           try {
                                   afd = 
   context.getAssets().openFd(sounds/piecemove.ogg);
                                   soundPoolMap.put(SOUND_PIECEMOVE, 
   soundPool.load(afd, 1));

                                   afd = 
   context.getAssets().openFd(sounds/piecestop.ogg);
                                   soundPoolMap.put(SOUND_PIECESTOP, 
   soundPool.load(afd, 1));

                                   afd = 
   context.getAssets().openFd(sounds/pieceattack.ogg);
                                   soundPoolMap.put(SOUND_PIECEATTACK, 
   soundPool.load(afd, 1));

                                   afd = 
   context.getAssets().openFd(sounds/pieceselect.ogg);
                                   soundPoolMap.put(SOUND_PIECESELECT, 
   soundPool.load(afd, 1));

                                   afd = 
   context.getAssets().openFd(sounds/selection.ogg);
                                   soundPoolMap.put(SOUND_MENUSELECTION, 
   soundPool.load(afd, 1));

                                   afd = 
   context.getAssets().openFd(sounds/pageturn.ogg);
                                   soundPoolMap.put(SOUND_PAGETURN, 
   soundPool.load(afd, 1));
                           } catch (IOException e) {
                                   e.printStackTrace();
                           }

   Function to play sounds:

           public static int playSound(Context context, intsound) {

                   AudioManager mgr = (AudioManager) context
                                   .getSystemService(Context.AUDIO_SERVICE);
                   float streamVolumeCurrent = mgr
                                   
   .getStreamVolume(AudioManager.STREAM_MUSIC);
                   float streamVolumeMax = mgr
                                   
   .getStreamMaxVolume(AudioManager.STREAM_MUSIC);
                   float volume = streamVolumeCurrent / streamVolumeMax;
                   /* Play thesoundwith the correct volume */
                   return soundPool
                                   .play(soundPoolMap.get(sound), volume, 
   volume, 1, 0, 1f);
           }

   Playing asoundeffect i.e when button is clicked:

         Resources.playSound(context, Resources.SOUND_PIECESELECT);

   However as I said thesoundis lagging. What can I do to improve this?
   All my sounds are OGG file format.

-- 
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] Re: using soundPool but sound plays after a delay, sound is lagging

2009-12-19 Thread rukiman
ok i take it back, doesnt seem to make a difference. I think the lag
is in soundPool.play() itself.
Anyone got a workaround?

On Dec 19, 7:57 pm, rukiman ruksh...@optushome.com.au wrote:
 seems like I was wrong. Profiling shows 60% is spent on getting the
 audio service and setting up the volume. Only 40% is spent on the
 actual play function. So would seem like I setting up the volume
 before hand is the way to go. I'll try that out and see how things go.

 On Dec 19, 7:46 pm, rukiman ruksh...@optushome.com.au wrote:

  I cannot quatify it but it is very noticeable and feels wrong when
  playing my game. for example I play a sound when a piece is selected
  however due to the lag the sound feel a bit out of place.
  I will try to profile whats going on here. But I thought perhaps
  someone may have had experienced this issue and come up with a
  solution or workaround. I will try Matts idea of calculating the
  volume before hand etc so I have to simply call soundPool.play(). Only
  issue is that creates extra work i.e the sound volume might have
  changed by the user meanwhile and also I'm very doubtful if it will
  improve the lag.

  On Dec 19, 6:37 am, Robert Green rbgrn@gmail.com wrote:

   Can you quantify the lag?  How much is it lagging?  Lately I've been
   seeing my footstep sounds, which are individually triggered right and
   left steps, take 2-50ms to trigger for some reason.  I'm not sure if
   it has something to do with the way the OGG is encoded, but I feel
   like it could.  Perhaps the SoundPool author would like to chime in
   and give us some hints?

   On Dec 18, 3:45 am, rukiman ruksh...@optushome.com.au wrote:

I am using the SoundPool as follows:

Caching my sounds:
                        // loadsoundeffects
                        soundPool = new SoundPool(2, 
AudioManager.STREAM_MUSIC, 0);
                        soundPoolMap = new HashMapInteger, Integer();
                        AssetFileDescriptor afd;
                        try {
                                afd = 
context.getAssets().openFd(sounds/piecemove.ogg);
                                soundPoolMap.put(SOUND_PIECEMOVE, 
soundPool.load(afd, 1));

                                afd = 
context.getAssets().openFd(sounds/piecestop.ogg);
                                soundPoolMap.put(SOUND_PIECESTOP, 
soundPool.load(afd, 1));

                                afd = 
context.getAssets().openFd(sounds/pieceattack.ogg);
                                soundPoolMap.put(SOUND_PIECEATTACK, 
soundPool.load(afd, 1));

                                afd = 
context.getAssets().openFd(sounds/pieceselect.ogg);
                                soundPoolMap.put(SOUND_PIECESELECT, 
soundPool.load(afd, 1));

                                afd = 
context.getAssets().openFd(sounds/selection.ogg);
                                soundPoolMap.put(SOUND_MENUSELECTION, 
soundPool.load(afd, 1));

                                afd = 
context.getAssets().openFd(sounds/pageturn.ogg);
                                soundPoolMap.put(SOUND_PAGETURN, 
soundPool.load(afd, 1));
                        } catch (IOException e) {
                                e.printStackTrace();
                        }

Function to play sounds:

        public static int playSound(Context context, intsound) {

                AudioManager mgr = (AudioManager) context
                                
.getSystemService(Context.AUDIO_SERVICE);
                float streamVolumeCurrent = mgr
                                
.getStreamVolume(AudioManager.STREAM_MUSIC);
                float streamVolumeMax = mgr
                                
.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
                float volume = streamVolumeCurrent / streamVolumeMax;
                /* Play thesoundwith the correct volume */
                return soundPool
                                .play(soundPoolMap.get(sound), volume, 
volume, 1, 0, 1f);
        }

Playing asoundeffect i.e when button is clicked:

      Resources.playSound(context, Resources.SOUND_PIECESELECT);

However as I said thesoundis lagging. What can I do to improve this?
All my sounds are OGG file format.

-- 
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] Re: using soundPool but sound plays after a delay, sound is lagging

2009-12-19 Thread rukiman
Some feedback. I have noticed the sound is pretty instant and great
when there isn't another sound effect being played, otherwise the
delay is pretty bad. So say if I select a piece then the sound effect
is instant, however if I quickly select another piece as the sound is
being played, there is a very big noticeable delay before the sound
effect is heard.

On Dec 19, 7:57 pm, rukiman ruksh...@optushome.com.au wrote:
 seems like I was wrong. Profiling shows 60% is spent on getting the
 audio service and setting up the volume. Only 40% is spent on the
 actual play function. So would seem like I setting up the volume
 before hand is the way to go. I'll try that out and see how things go.

 On Dec 19, 7:46 pm, rukiman ruksh...@optushome.com.au wrote:

  I cannot quatify it but it is very noticeable and feels wrong when
  playing my game. for example I play a sound when a piece is selected
  however due to the lag the sound feel a bit out of place.
  I will try to profile whats going on here. But I thought perhaps
  someone may have had experienced this issue and come up with a
  solution or workaround. I will try Matts idea of calculating the
  volume before hand etc so I have to simply call soundPool.play(). Only
  issue is that creates extra work i.e the sound volume might have
  changed by the user meanwhile and also I'm very doubtful if it will
  improve the lag.

  On Dec 19, 6:37 am, Robert Green rbgrn@gmail.com wrote:

   Can you quantify the lag?  How much is it lagging?  Lately I've been
   seeing my footstep sounds, which are individually triggered right and
   left steps, take 2-50ms to trigger for some reason.  I'm not sure if
   it has something to do with the way the OGG is encoded, but I feel
   like it could.  Perhaps the SoundPool author would like to chime in
   and give us some hints?

   On Dec 18, 3:45 am, rukiman ruksh...@optushome.com.au wrote:

I am using the SoundPool as follows:

Caching my sounds:
                        // loadsoundeffects
                        soundPool = new SoundPool(2, 
AudioManager.STREAM_MUSIC, 0);
                        soundPoolMap = new HashMapInteger, Integer();
                        AssetFileDescriptor afd;
                        try {
                                afd = 
context.getAssets().openFd(sounds/piecemove.ogg);
                                soundPoolMap.put(SOUND_PIECEMOVE, 
soundPool.load(afd, 1));

                                afd = 
context.getAssets().openFd(sounds/piecestop.ogg);
                                soundPoolMap.put(SOUND_PIECESTOP, 
soundPool.load(afd, 1));

                                afd = 
context.getAssets().openFd(sounds/pieceattack.ogg);
                                soundPoolMap.put(SOUND_PIECEATTACK, 
soundPool.load(afd, 1));

                                afd = 
context.getAssets().openFd(sounds/pieceselect.ogg);
                                soundPoolMap.put(SOUND_PIECESELECT, 
soundPool.load(afd, 1));

                                afd = 
context.getAssets().openFd(sounds/selection.ogg);
                                soundPoolMap.put(SOUND_MENUSELECTION, 
soundPool.load(afd, 1));

                                afd = 
context.getAssets().openFd(sounds/pageturn.ogg);
                                soundPoolMap.put(SOUND_PAGETURN, 
soundPool.load(afd, 1));
                        } catch (IOException e) {
                                e.printStackTrace();
                        }

Function to play sounds:

        public static int playSound(Context context, intsound) {

                AudioManager mgr = (AudioManager) context
                                
.getSystemService(Context.AUDIO_SERVICE);
                float streamVolumeCurrent = mgr
                                
.getStreamVolume(AudioManager.STREAM_MUSIC);
                float streamVolumeMax = mgr
                                
.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
                float volume = streamVolumeCurrent / streamVolumeMax;
                /* Play thesoundwith the correct volume */
                return soundPool
                                .play(soundPoolMap.get(sound), volume, 
volume, 1, 0, 1f);
        }

Playing asoundeffect i.e when button is clicked:

      Resources.playSound(context, Resources.SOUND_PIECESELECT);

However as I said thesoundis lagging. What can I do to improve this?
All my sounds are OGG file format.

-- 
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

[android-developers] Re: JDBC Driver for SQLiteDatabase

2009-12-19 Thread kristianlm

hi Elliott,

what exactly does it mean that the driver is unsupported and that
it shouldn't be used?

are you saying that JDBC should not be used at all? without
loading the jdbc driver with Class.forName() it isn't registered.

that concludes the code snippet in Joerg's post above is
not allowed?

Thanks a bunch,
- Kris


On Dec 15, 12:42 am, enh enh+...@google.com wrote:
 theJDBCdriver is undocumented because it's unsupported. please do
 not use reflection to access undocumented/unsupported API.

  --elliott

 On Dec 14, 5:29 am, kristianlm kristianl...@gmail.com wrote:



  Hi jotobject,
  I don't understant why this wouldn't be part of the public API. if
  Android is shipped with aJDBCdriver, why not let people use it? It's
  certainly useful for many of us!

  Kris

  On Dec 12, 10:42 pm, jotobjects jotobje...@gmail.com wrote:

   On Dec 8, 10:41 pm, Joerg Pleumann joerg.pleum...@gmail.com wrote: 
   Regarding android.jar, I never checked but I could imagine that it
contains only the public API classes and might even have the actual
bytecode erased. Nothing is ever run against it. It is just there to
make Javac or Eclipse happy (somebody please correct me if I'm wrong).
On the device, the driver should be part of /system/framework/
core.jar.

   The SQLite driver is never used by the public API.  You pass the name
   as a String URI jdbc:sqlite: to getConnection().  That is the way
  JDBCalways works. The drivers are not part of the public API so the
   documentation is NOT missing anything regarding drivers.

   As far as I can see the only missing documentation is the URI
   jdbc:sqlite: as in Joerg's example -

               String db = jdbc:sqlite: + getFilesDir() + /test.db;
               Class.forName(SQLite.JDBCDriver);
               Connection conn = DriverManager.getConnection(db);

   The Class.forName() call is only necessary if Android does not
   automatically register the driver with DriverManager (I don't know if
   it does or not).

-- 
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] Re: Typo in android developer resource site. 2

2009-12-19 Thread NoraBora
OK. I posted in http://code.google.com/p/android/issues/detail?id=5536


On Dec 18, 11:29 pm, Mark Murphy mmur...@commonsware.com wrote:
 NoraBorawrote:
  I found another typo in android developer resource site.

 http://developer.android.com/resources/faq/commontasks.html

  Selecting, Highlighting, or Styling Portions of Text

  stringid=@+id/styled_welcome_messageWe are biso/i/b glad
  to see you./string

  should be

  string id=@+id/styled_welcome_messageWe are biso/i/b glad
  to see you./string

 Please post bug reports, including documentation bug reports, 
 tohttp://b.android.com. Thanks!

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://twitter.com/commonsguy

 Android Consulting/App Development:http://commonsware.com/consulting

-- 
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] Re: Using layout-include together with l10n

2009-12-19 Thread rflexor
Thanks! After some more tweaking (and knowing in which direction to
go) it works now!

Ralf

On 17 Dez., 18:09, Romain Guy romain...@android.com wrote:
 Includes are indeed resolved at runtime (when the XML layout file is 
 inflated.)



 On Thu, Dec 17, 2009 at 1:13 AM, rflexor rfle...@googlemail.com wrote:
  Hi,

  I have a complex dialog-layout that has to be customized for small
  screens to decrease its height on such devices. This can easily be
  achieved by decreasing the height of several single Buttons and
  Textfields in the layout, each by a small amount.

  Of course much of the layout still stays the same, so I figured I
  could use the include/-tag. This was the idea:

  /res/layout/dialog_layout.xml                        == includes
  @layout/include_button_layout
  /res/layout/include_button_layout.xml
  /res/layout-small/include_button_layout.xml

  I figured that android would choose which button-layout to include at
  runtime. I couldn't get it to run, so I guess I was wrong. Could
  anyone confirm that this is not how it works?

  And if so, can anyone confirm whether this is the way to do it?

  /res/layout/dialog_layout.xml
     == includes @layout/include_above_buttons
     == includes @layout/include_button_layout_default
     == includes @layout/include_below_buttons

  /res/layout/include_above_buttons.xml
  /res/layout/include_below_buttons.xml
  /res/layout/include_button_layout_default.xml
  /res/layout/include_button_layout_small.xml

  /res/layout-small/dialog_layout.xml
     == includes @layout/include_above_buttons
     == includes @layout/include_button_layout_small
     == includes @layout/include_below_buttons

  Thanks           Ralf

  --
  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

 --
 Romain Guy
 Android framework engineer
 romain...@android.com

 Note: please don't send private questions to me, as I don't have time
 to provide private support.  All such questions should be posted on
 public forums, where I and others can see and answer them

-- 
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] Re: ExpandableListView change background for child items

2009-12-19 Thread NoraBora
See the default android music player.

http://android.git.kernel.org/?p=platform/packages/apps/Music.git;a=blob;f=src/com/android/music/ArtistAlbumBrowserActivity.java

SimpleCursorTreeAdapter constructor has group layout and child layout.

for example,
group layout is here
http://android.git.kernel.org/?p=platform/packages/apps/Music.git;a=blob;f=res/layout-finger/track_list_item_group.xml

child layout is here
http://android.git.kernel.org/?p=platform/packages/apps/Music.git;a=blob;f=res/layout-finger/track_list_item_child.xml

you can set different background, text style or whatever you want.


On Dec 15, 6:34 am, droidin.net bost...@gmail.com wrote:
 I'm using ExpandableListView in my app and one of the complains is
 that when expanded it's hard to visually distinguish where the child
 item ends and next group item begins. So I would like to change
 background of the child list item to the different shade. Brutal
 attempts that I've made so far were based on directly changing
 background color and text of the elements inside the child view item
 but that leads to loss of hovers and highlights. So my question is -
 what is a good strategy to achieve the above? I tried styles and
 selectors but what really bums me out - that if I change one thing
 then I need to add selectors for all combinations of focus/enabled
 etc. when all I'm trying to do it to overwrite a single thing. Is
 there a way to inherit parent style and set just a background for non-
 focused, enabled child item?

-- 
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] Re: Drag and Drop

2009-12-19 Thread Wouter
How can I create a list where I can rearrange list items with dragging
list rows to another row and so on (to change to order)?

Just like on the HTC Hero in the clocks app where you can rearrange
the order of clocks?

Wouter

On Dec 18, 11:08 pm, Business Talk roman.businesst...@gmail.com
wrote:
 Thanks Mark

 On Dec 18, 4:37 pm, Mark Murphy mmur...@commonsware.com wrote:

  Business Talk wrote:
   is there any drag and drop support in android? Couldn't find any

  Nothing really built in, though with touch events and such you could
  create something that works for your app.

  --
  Mark Murphy (a Commons 
  Guy)http://commonsware.com|http://twitter.com/commonsguy

  Android Training in US: 11-15 January 2010:http://onlc.com

-- 
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] Select image resource dynamically

2009-12-19 Thread croco
Hi all,

I'm facing a problem,

I've added a folder of 350 images representing country flags in my
project

according the device country given by locale. Let's say fr for France

I would like set an image with fr.png which is in the res/drawable
folder. How to achieve this without maintaining an ugly map in the
code saying fr = R.drawable.fr etc etc .

Thank you for your help.

Croco

-- 
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] Re: Select image resource dynamically

2009-12-19 Thread Sergiu Dogaru
you could try using Reflection, but that might be too complicated for
what you need.
What I would do is to place all of the images in the assets folder,
where you can retrieve them by name.
I think it's something like

Bitmap bmp = BitmapFactory.decodeStream(getResources().getAssets
().openFile(fr.png));



On Dec 19, 3:17 pm, croco zeug...@gmail.com wrote:
 Hi all,

 I'm facing a problem,

 I've added a folder of 350 images representing country flags in my
 project

 according the device country given by locale. Let's say fr for France

 I would like set an image with fr.png which is in the res/drawable
 folder. How to achieve this without maintaining an ugly map in the
 code saying fr = R.drawable.fr etc etc .

 Thank you for your help.

 Croco

-- 
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] AsyncTask + NDK = Neverending process

2009-12-19 Thread Hunter Peress
Hi,  I'm running a pretty weird setup:

AsyncTask1.class - AsyncTask2.class -AsyncTask3 (inner class of
AsyncTask2) -NDK call (this one takes a long time).

Since the NDK takes so long, I want to give users the option to kill
the NDK call so that they can actually use the app. Basically, I keep
references of all the asynctask instances and I do:

aSyncTask1.getAsyncTask2().getAsyncTask3().cancel(true);

The true means mayInterruptIfRunning

but, lo and behold, the NDK process is still running. I don't care how
its done, but I need that NDK process to die when I ask it to. I'm
thinking about kill-9 it through a popen call..

Any ideas on how to kill this thing??

-- 
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] Re: passing paramters using ksoap2 to .net web service, always passes nulls (empty) values

2009-12-19 Thread android09
Hi wedyan,

I had also the same problem but finally i got the solution. I have
some steps for you, just go through it.
1) Remove PropertyInfo from your code and add this like:

SoapObject request = new SoapObject(NAMESPACE,METHOD_NAME_TEMP);
// if you have 2 params in .net than add property this way. Suppose,
sum of two integers instead of PropertyInfo
request.addProperty(num, str1);
request.addProperty(b, str2);

2) Use HttpTransportSE instead of AndroidHttpTransport. and add
androidHttpTransport.setXmlVersionTag(?xml version=\1.0\ encoding=
\UTF-8\?);

3) To Display Result:
SoapPrimitive resultString = (SoapPrimitive)soapEnvelope.getResponse
();
System.out.println(resultString);
txtView.setText(Result is : +resultString);

Now, go through the above steps and also compare your application. I
hope you will find the solution. Let's hope.

Best Luck

-- 
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] AsyncTask + NDK = Neverending process

2009-12-19 Thread Mark Murphy
Hunter Peress wrote:
 Hi,  I'm running a pretty weird setup:
 
 AsyncTask1.class - AsyncTask2.class -AsyncTask3 (inner class of
 AsyncTask2) -NDK call (this one takes a long time).
 
 Since the NDK takes so long, I want to give users the option to kill
 the NDK call so that they can actually use the app. Basically, I keep
 references of all the asynctask instances and I do:
 
 aSyncTask1.getAsyncTask2().getAsyncTask3().cancel(true);
 
 The true means mayInterruptIfRunning
 
 but, lo and behold, the NDK process is still running. I don't care how
 its done, but I need that NDK process to die when I ask it to. I'm
 thinking about kill-9 it through a popen call..
 
 Any ideas on how to kill this thing??

NDK questions are best asked on the NDK Google Group:

http://groups.google.com/group/android-ndk

That being said, AsyncTask#cancel() will only stop a running thread if
the Java thread is interruptible, and it would not shock me if threads
tied up in NDK calls are not interruptible. Relying on Java thread
interruption is a serious code smell IMHO, NDK or not.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android Training in Germany, 18-22 January 2010: http://bignerdranch.com

-- 
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] Re: OpenGL hardware requirements specification

2009-12-19 Thread shaun
Robert,  your right. Accessing the gl extensions at runtime will tell
us what effects we can use. But I Wa thinking that even if all the
extensions I want are available, maybe my program uses them all very
heavily and I want to limit that based on the class (horsepower) of
the gpu. I have not done much OpenGL programming so maybe this is not
really a case that comes up.

On Dec 18, 5:43 pm, Robert Green rbgrn@gmail.com wrote:
 Shaun,

 Most effects are things that you program so to enable/disable them,
 you have to do it in your own code.  Most other primitive features
 like fog, lights and texture filtering are all controllable in GL, so
 you wouldn't need any additional configuration options for your GPU.

 I'm comfortable saying that all we need is a relative class of GPUs
 that basically indicates how much raw power they have.  I'm trying to
 make my new game scale across all phones but I'm having a problem on
 the ones with software renderer.  No matter how far I drop the res of
 my textures or how basic I make things, I can't get over 10 fps on
 it.  That's where I'd like to draw the line and say that my game just
 can't be installed on it.  I know I can never provide a good
 experience on it, and thus the basic class system.

 On Dec 18, 2:15 pm, shaun shashepp...@gmail.com wrote:



  And to be able to access the device's setting for GPU class (or
  whatever it ends up being) programmatically at runtime if we want to
  disable/enable features/effects based upon its value.

  On Dec 18, 3:12 pm, shaun shashepp...@gmail.com wrote:

   I think Robert Green is on the right track.  We need something like
   this now!

   On Dec 18, 2:34 pm, Robert Green rbgrn@gmail.com wrote:

I'd really like to see a GPU Class enumeration starting with the
software renderer.

android:gpuClass=integer

class 0 = software renderer
class 1 = MSM7200 series
class 2 = PowerVR SGX series
class 3 = Some faster, more powerful GPU
etc...

This way, we could specify that a game only works on class-2 and above
hardware.  It would make it MUCH easier for us to build high-quality
games targeted at gamer phones.

This in conjunction with a GL ES version would be perfect, however I
believe there will be some overlap.  My gut says that using the
proposed class system, one would expect class 2 and above GPUs to
support OpenGL ES 2.0.  Perhaps in the future some class 5 GPUs will
support 2.1 or 3.0 or whatever comes down the pipeline.

On Dec 18, 4:05 am, Hexage ga...@hexage.net wrote:

 There is growing list of upcoming devices (HTC Tattoo, HTC Legend,
 MOTO MT710, etc.) without hardware accelerated OpenGL. Basically all
 devices based on a low-end chip (Qualcomm MSM72xx, Marvell PXA310)
 will not feature GPU. However many games rely on a hardware
 accelerated OpenGL for lag-free rendering.

 Currently, we can use:

 uses-feature android:glEsVersion=integer /

 to specify the GLES version needed by the application. I assume that
 this requirement will be satisfied with the Android PixelFlinger (the
 software renderer) which is not what we want. Is there any way to
 specify a hardware accelerated OpenGL as a requirement in the
 manifest?

 Something like this would be great:

 uses-feature android:name=android.hardware.gpu /

 Thanks,
 David- Hide quoted text -

- Show quoted text -- Hide quoted text -

   - Show quoted text -

-- 
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] Render Image in Screen from a web URI

2009-12-19 Thread RamaMohan
Hi all,
I need a answer for my problem.
I have a image path like
http://www.things4myspace.com/wp-content/uploads/3052/a%20note%20to%20say%20hi.gif
i need to render in my screen.I mean i have to set this image path to
image source through java programming.

If any one knows please tell me .

-- 
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] Re: parsing a *string* of XML with SAX.

2009-12-19 Thread redders
I appreciate the reply, but I selected the SAX method because of its
efficiency advantages, so I'd really like to understand why my code
isn't working.

-- 
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: parsing a *string* of XML with SAX.

2009-12-19 Thread Mark Murphy
redders wrote:
 I appreciate the reply, but I selected the SAX method because of its
 efficiency advantages, so I'd really like to understand why my code
 isn't working.

I don't use XMLReader and I have no problems with SAX on Android, such
as this one parsing a XML payload from a REST request:

BufferedReader in=new BufferedReader(new
InputStreamReader(url.openStream()));
SAXParserFactory f=SAXParserFactory.newInstance();
SAXParser p=f.newSAXParser();
SearchParser parser=new SearchParser(null);
p.parse(new InputSource(in), parser);

(where SearchParser is a DefaultHandler subclass)

In your case, this would look like:

SAXParserFactory f=SAXParserFactory.newInstance();
SAXParser p=f.newSAXParser();
StringReader sr = new StringReader(xmlMessage);
InputSource is = new InputSource(sr);
p.parse(is, this);

Try something like that and see if it helps.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

_Android Programming Tutorials_ Version 1.0 In Print!

-- 
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: Select image resource dynamically

2009-12-19 Thread zeugame zeugame
Hello Sergiu,

I keep your hint in mind,

for now i've  generated the mapping class. Maybe not the best way but it is
sync with what i have in folder.

Regards.

Croco

On Sat, Dec 19, 2009 at 2:42 PM, Sergiu Dogaru
creative.art@gmail.comwrote:

 you could try using Reflection, but that might be too complicated for
 what you need.
 What I would do is to place all of the images in the assets folder,
 where you can retrieve them by name.
 I think it's something like

 Bitmap bmp = BitmapFactory.decodeStream(getResources().getAssets
 ().openFile(fr.png));



 On Dec 19, 3:17 pm, croco zeug...@gmail.com wrote:
  Hi all,
 
  I'm facing a problem,
 
  I've added a folder of 350 images representing country flags in my
  project
 
  according the device country given by locale. Let's say fr for France
 
  I would like set an image with fr.png which is in the res/drawable
  folder. How to achieve this without maintaining an ugly map in the
  code saying fr = R.drawable.fr etc etc .
 
  Thank you for your help.
 
  Croco

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
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] Re: Select image resource dynamically

2009-12-19 Thread croco

Hello Sergiu,

I keep your hint in mind,

for now i've  generated the mapping class. Maybe not the best way but
it is sync with what i have in folder.

Regards.

Croco
On Dec 19, 2:42 pm, Sergiu Dogaru creative.art@gmail.com wrote:
 you could try using Reflection, but that might be too complicated for
 what you need.
 What I would do is to place all of the images in the assets folder,
 where you can retrieve them by name.
 I think it's something like

 Bitmap bmp = BitmapFactory.decodeStream(getResources().getAssets
 ().openFile(fr.png));

 On Dec 19, 3:17 pm, croco zeug...@gmail.com wrote:

  Hi all,

  I'm facing a problem,

  I've added a folder of 350 images representing country flags in my
  project

  according the device country given by locale. Let's say fr for France

  I would like set an image with fr.png which is in the res/drawable
  folder. How to achieve this without maintaining an ugly map in the
  code saying fr = R.drawable.fr etc etc .

  Thank you for your help.

  Croco



-- 
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: parsing a *string* of XML with SAX.

2009-12-19 Thread Edward Hinchliffe
Thanks Mark, I've just given that a try. I still don't get any calls to my
startElement method, but there is a new warning which may be a clue:

12-19 17:14:24.241: INFO/NWXML(1852): Trying to parse: *snip*
12-19 17:14:24.241: WARN/ExpatReader(1852): DTD handlers aren't supported.

DTD handlers aren't supported. Know what this means?

2009/12/19 Mark Murphy mmur...@commonsware.com

 redders wrote:
  I appreciate the reply, but I selected the SAX method because of its
  efficiency advantages, so I'd really like to understand why my code
  isn't working.

 I don't use XMLReader and I have no problems with SAX on Android, such
 as this one parsing a XML payload from a REST request:

 BufferedReader in=new BufferedReader(new
 InputStreamReader(url.openStream()));
 SAXParserFactory f=SAXParserFactory.newInstance();
 SAXParser p=f.newSAXParser();
 SearchParser parser=new SearchParser(null);
 p.parse(new InputSource(in), parser);

 (where SearchParser is a DefaultHandler subclass)

 In your case, this would look like:

 SAXParserFactory f=SAXParserFactory.newInstance();
 SAXParser p=f.newSAXParser();
 StringReader sr = new StringReader(xmlMessage);
 InputSource is = new InputSource(sr);
 p.parse(is, this);

 Try something like that and see if it helps.

 --
 Mark Murphy (a Commons Guy)
 http://commonsware.com | http://twitter.com/commonsguy

 _Android Programming Tutorials_ Version 1.0 In Print!

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
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] Re: parsing a *string* of XML with SAX.

2009-12-19 Thread redders
Update:
Using Mark's method, startDocument and endDocument are invoked, but
never the elements...

On Dec 19, 5:19 pm, Edward Hinchliffe redders6...@googlemail.com
wrote:
 Thanks Mark, I've just given that a try. I still don't get any calls to my
 startElement method, but there is a new warning which may be a clue:

 12-19 17:14:24.241: INFO/NWXML(1852): Trying to parse: *snip*
 12-19 17:14:24.241: WARN/ExpatReader(1852): DTD handlers aren't supported.

 DTD handlers aren't supported. Know what this means?

 2009/12/19 Mark Murphy mmur...@commonsware.com



  redders wrote:
   I appreciate the reply, but I selected the SAX method because of its
   efficiency advantages, so I'd really like to understand why my code
   isn't working.

  I don't use XMLReader and I have no problems with SAX on Android, such
  as this one parsing a XML payload from a REST request:

  BufferedReader in=new BufferedReader(new
  InputStreamReader(url.openStream()));
  SAXParserFactory f=SAXParserFactory.newInstance();
  SAXParser p=f.newSAXParser();
  SearchParser parser=new SearchParser(null);
  p.parse(new InputSource(in), parser);

  (where SearchParser is a DefaultHandler subclass)

  In your case, this would look like:

  SAXParserFactory f=SAXParserFactory.newInstance();
  SAXParser p=f.newSAXParser();
  StringReader sr = new StringReader(xmlMessage);
  InputSource is = new InputSource(sr);
  p.parse(is, this);

  Try something like that and see if it helps.

  --
  Mark Murphy (a Commons Guy)
 http://commonsware.com|http://twitter.com/commonsguy

  _Android Programming Tutorials_ Version 1.0 In Print!

  --
  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.comandroid-developers%2Bunsubs 
  cr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
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] Re: AsyncTask + NDK = Neverending process

2009-12-19 Thread Streets Of Boston
Relying on Java thread interruption is a serious code smell IMHO, NDK or 
not
Hi Mark,

Why is this a code-smell? Interrupting long-running threads that 'wait
()' is perfectly fine for controlling these threads, telling them to
do stuff, pause or even stop and exit.


On Dec 19, 9:20 am, Mark Murphy mmur...@commonsware.com wrote:
 Hunter Peress wrote:
  Hi,  I'm running a pretty weird setup:

  AsyncTask1.class - AsyncTask2.class -AsyncTask3 (inner class of
  AsyncTask2) -NDK call (this one takes a long time).

  Since the NDK takes so long, I want to give users the option to kill
  the NDK call so that they can actually use the app. Basically, I keep
  references of all the asynctask instances and I do:

  aSyncTask1.getAsyncTask2().getAsyncTask3().cancel(true);

  The true means mayInterruptIfRunning

  but, lo and behold, the NDK process is still running. I don't care how
  its done, but I need that NDK process to die when I ask it to. I'm
  thinking about kill-9 it through a popen call..

  Any ideas on how to kill this thing??

 NDK questions are best asked on the NDK Google Group:

 http://groups.google.com/group/android-ndk

 That being said, AsyncTask#cancel() will only stop a running thread if
 the Java thread is interruptible, and it would not shock me if threads
 tied up in NDK calls are not interruptible. Relying on Java thread
 interruption is a serious code smell IMHO, NDK or not.

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://twitter.com/commonsguy

 Android Training in Germany, 18-22 January 2010:http://bignerdranch.com- Hide 
 quoted text -

 - Show quoted text -

-- 
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: parsing a *string* of XML with SAX.

2009-12-19 Thread Edward Hinchliffe
In fact it seems that startDocment and endDocument are invoked when using my
original code, with no warning about DTD handlers...
so how do i get the other methods to be invoked??

2009/12/19 redders redders6...@googlemail.com

 Update:
 Using Mark's method, startDocument and endDocument are invoked, but
 never the elements...

 On Dec 19, 5:19 pm, Edward Hinchliffe redders6...@googlemail.com
 wrote:
  Thanks Mark, I've just given that a try. I still don't get any calls to
 my
  startElement method, but there is a new warning which may be a clue:
 
  12-19 17:14:24.241: INFO/NWXML(1852): Trying to parse: *snip*
  12-19 17:14:24.241: WARN/ExpatReader(1852): DTD handlers aren't
 supported.
 
  DTD handlers aren't supported. Know what this means?
 
  2009/12/19 Mark Murphy mmur...@commonsware.com
 
 
 
   redders wrote:
I appreciate the reply, but I selected the SAX method because of its
efficiency advantages, so I'd really like to understand why my code
isn't working.
 
   I don't use XMLReader and I have no problems with SAX on Android, such
   as this one parsing a XML payload from a REST request:
 
   BufferedReader in=new BufferedReader(new
   InputStreamReader(url.openStream()));
   SAXParserFactory f=SAXParserFactory.newInstance();
   SAXParser p=f.newSAXParser();
   SearchParser parser=new SearchParser(null);
   p.parse(new InputSource(in), parser);
 
   (where SearchParser is a DefaultHandler subclass)
 
   In your case, this would look like:
 
   SAXParserFactory f=SAXParserFactory.newInstance();
   SAXParser p=f.newSAXParser();
   StringReader sr = new StringReader(xmlMessage);
   InputSource is = new InputSource(sr);
   p.parse(is, this);
 
   Try something like that and see if it helps.
 
   --
   Mark Murphy (a Commons Guy)
  http://commonsware.com|http://twitter.com/commonsguy
 
   _Android Programming Tutorials_ Version 1.0 In Print!
 
   --
   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.comandroid-developers%2bunsubscr...@googlegroups.comandroid-developers%2Bunsubs
 cr...@googlegroups.com
   For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
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] Re: How to use the dpad button to pause and play audio while the device is locked

2009-12-19 Thread skyhigh
On Dec 18, 10:55 pm, Dianne Hackborn hack...@android.com wrote:
 Tell them Android sux and doesn't support this.

Dianne, I have to say I was very surprised to get this reply from
you.  I thought about it for a while, and then decided you must be
having a very rough day.  I hope you have a much better day tomorrow.
Merry Christmas!

-- 
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: How to debug BadTokenException?

2009-12-19 Thread Mariano Kamp
Thanks for your help here.

I reas the bug report, but I am not quite sure what to make of it and what
the solution is.

In my case the user enters username/password and then I show a progress
monitor. When the user backs out or goes to home then I still want to
display the result, at least when an error occurred.

How is this to be accomplished?

Can I somehow find out beforehand if I will run in this error and then use
some other mean, say a toast, to at least notify the user that not all is
good?

On Mon, Nov 23, 2009 at 8:01 AM, Chander Pechetty cspeche...@gmail.comwrote:

 There are currently few issues logged around this bug:
 http://code.google.com/p/android/issues/detail?id=3953

 I don't know your specific case, but was easy to fix in my case, when
 I made sure that the dialogs/views/adapters that were being created
 are with the right context/activity.
 Pressing a back button usually finishes the activity, so if you have
 created for discussion sake created an static ListAdapter and passed
 it (this), an activity instance,

  this static adapter can no longer be used for showing dialogs etc.
 with the previous contexts. This behaviour gets complex depending on
 the launch modes/flags you set when starting an activity, and also
 whether you handle back button events.

 So token
 android.os.binderpr...@431d28f0 is not valid; is your activity
 running?  means your activity instance is no longer in History stack,
 but your are trying to use it somewhere.
 Since there is no knowing when your activity got finished and the
 sequence of steps that caused it, depending on different modes, you
 get sporadic reports.

 -Chander

 On Nov 22, 1:23 pm, Mariano Kamp mariano.k...@gmail.com wrote:
  Hey,
 
I sporadically get bug reports with a BadTokenException.
 
As I don't see my app in the stacktrace I am wondering how to find the
  cause of this? Any idea?
 
  Cheers,
  Mariano
 
  -- Android Version: sdk=3, release=1.5, inc=eng.root.20090719.200906
  -- Memory free: 1.01MB total: 4.01MB max: 16.00MB
  -- Custom ROM: Stock Android
  -- NewsRob Version: 3.2.9/329
  -- Stacktrace:(1178)
  android.view.WindowManager$BadTokenException: Unable to add window --
 token
  android.os.binderpr...@431d28f0 is not valid; is your activity running?
  at android.view.ViewRoot.setView(ViewRoot.java:425)
  at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:178)
  at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
  at android.view.Window$LocalWindowManager.addView(Window.java:392)
  at
 android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2674)
  at
 android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2287)
  at android.app.ActivityThread.access$1800(ActivityThread.java:112)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:123)
  at android.app.ActivityThread.main(ActivityThread.java:3948)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:521)
  at
 
 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
  at dalvik.system.NativeStart.main(Native Method)

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
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: parsing a *string* of XML with SAX.

2009-12-19 Thread Edward Hinchliffe
Sorted, for anyone who was interested, the startElement and endElement
methods need to look like this:

public void endElement(String uri, String localName, String qName)throws
SAXException{
Log.i(###,start element);
}

2009/12/19 Edward Hinchliffe redders6...@googlemail.com

 In fact it seems that startDocment and endDocument are invoked when using
 my original code, with no warning about DTD handlers...
 so how do i get the other methods to be invoked??

 2009/12/19 redders redders6...@googlemail.com

 Update:
 Using Mark's method, startDocument and endDocument are invoked, but
 never the elements...

 On Dec 19, 5:19 pm, Edward Hinchliffe redders6...@googlemail.com
 wrote:
  Thanks Mark, I've just given that a try. I still don't get any calls to
 my
  startElement method, but there is a new warning which may be a clue:
 
  12-19 17:14:24.241: INFO/NWXML(1852): Trying to parse: *snip*
  12-19 17:14:24.241: WARN/ExpatReader(1852): DTD handlers aren't
 supported.
 
  DTD handlers aren't supported. Know what this means?
 
  2009/12/19 Mark Murphy mmur...@commonsware.com
 
 
 
   redders wrote:
I appreciate the reply, but I selected the SAX method because of its
efficiency advantages, so I'd really like to understand why my code
isn't working.
 
   I don't use XMLReader and I have no problems with SAX on Android, such
   as this one parsing a XML payload from a REST request:
 
   BufferedReader in=new BufferedReader(new
   InputStreamReader(url.openStream()));
   SAXParserFactory f=SAXParserFactory.newInstance();
   SAXParser p=f.newSAXParser();
   SearchParser parser=new SearchParser(null);
   p.parse(new InputSource(in), parser);
 
   (where SearchParser is a DefaultHandler subclass)
 
   In your case, this would look like:
 
   SAXParserFactory f=SAXParserFactory.newInstance();
   SAXParser p=f.newSAXParser();
   StringReader sr = new StringReader(xmlMessage);
   InputSource is = new InputSource(sr);
   p.parse(is, this);
 
   Try something like that and see if it helps.
 
   --
   Mark Murphy (a Commons Guy)
  http://commonsware.com|http://twitter.com/commonsguy
 
   _Android Programming Tutorials_ Version 1.0 In Print!
 
   --
   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.comandroid-developers%2bunsubscr...@googlegroups.comandroid-developers%2Bunsubs
 cr...@googlegroups.com
   For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
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: AsyncTask + NDK = Neverending process

2009-12-19 Thread Mark Murphy
Streets Of Boston wrote:
 Why is this a code-smell? Interrupting long-running threads that 'wait
 ()' is perfectly fine for controlling these threads, telling them to
 do stuff, pause or even stop and exit.

All of the following is IMHO.

In most cases, if you have to use wait()/cancel(), you're working at too
low of a level. There are reasons why countless engineers (e.g., Doug
Lea) have spent innumerable hours putting together java.util.concurrent
and kin -- getting threading right is *hard*. I would rather see
engineers use higher-order, highly-tested frameworks unless they are
actually trying to write such a higher-order framework.

I'm also not a fan of cancel()-ing threads you didn't create, though
that's what AsyncTask tries to allow, so apparently the core Android
team disagrees with me on that point.

Again, this is just my opinion.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android App Developer 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


[android-developers] Re: Select image resource dynamically

2009-12-19 Thread Diego Torres Milano
You can also use something like:

int rid = getResources().getIdentifier(fr, drawable, getPackageName
());

not the most efficient way but definitely something you can use.

On Dec 19, 6:16 pm, croco zeug...@gmail.com wrote:
 Hello Sergiu,

 I keep your hint in mind,

 for now i've  generated the mapping class. Maybe not the best way but
 it is sync with what i have in folder.

 Regards.

 Croco
 On Dec 19, 2:42 pm, Sergiu Dogaru creative.art@gmail.com wrote:



  you could try using Reflection, but that might be too complicated for
  what you need.
  What I would do is to place all of the images in the assets folder,
  where you can retrieve them by name.
  I think it's something like

  Bitmap bmp = BitmapFactory.decodeStream(getResources().getAssets
  ().openFile(fr.png));

  On Dec 19, 3:17 pm, croco zeug...@gmail.com wrote:

   Hi all,

   I'm facing a problem,

   I've added a folder of 350 images representing country flags in my
   project

   according the device country given by locale. Let's say fr for France

   I would like set an image with fr.png which is in the res/drawable
   folder. How to achieve this without maintaining an ugly map in the
   code saying fr = R.drawable.fr etc etc .

   Thank you for your help.

   Croco

-- 
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] Re: Text To Speech Android 1.6 with minsdk 3

2009-12-19 Thread Hayden
Thanks, glad you posted this!  I used your WrapTTS class exactly as
you have it, but nfortunately, running it on the 1.5 emulator still
crashes (works great on 1.6 though).

Just doing what you did above, declaring the 2 global variables and
doing the checkAvailable() check, but the app force closes as soon as
the activity starts.  Below are the errors I am getting in LogCat
pertaining to this.  Any ideas?

LogCat:

12-19 13:33:24.507: INFO/dalvikvm(953): Failed resolving Lme/myApp/
WrapTTS; interface 42 'Landroid/speech/tts/TextToSpeech
$OnInitListener;'
12-19 13:33:24.587: WARN/dalvikvm(953): Link of class 'Lme/myApp/
WrapTTS;' failed
12-19 13:33:24.597: ERROR/dalvikvm(953): Could not find method
me.myApp.WrapTTS.checkAvailable, referenced from method
me.myApp.DisplayStory.clinit
12-19 13:33:24.647: WARN/dalvikvm(953): VFY: unable to resolve static
method 562: Lme/myApp/WrapTTS;.checkAvailable ()V
12-19 13:33:24.647: WARN/dalvikvm(953): VFY:  rejecting opcode 0x71 at
0x0020


On Nov 18, 4:48 pm, Eric Carman ewcarma...@gmail.com wrote:
 Hello,

 I was playing with addingTexttoSpeechto one of my applications and
 have been working with it using the Android1.6SDK. I was hoping to
 release the code such that it could be used on the earlier1.5OS
 since there are still quite a few of these around - and this is an
 upgrade. I realize that the TTS won't work on the1.5(at least not as
 I have it here), but I didn't want the app disappearing from the
 market for those devices.

 At any rate, after struggling for a while with this - a lot of trial
 and error - I came up with what now seems like a simple wrapper to
 allow for the backward compatibility. This was mostly taken from the
 Android blog entry

 http://android-developers.blogspot.com/2009/04/backward-compatibility...

 so I'm not exactly breaking new ground. Also, I'm not using all of the
 TTS features, hence the short list of wrapped methods, expand at
 your leisure. I'm attaching it here for anyone to use and anyone to
 comment on if I have done something really stupid. I'll comment back
 if my testing uncovers anything untoward.

 Wrapper Class:

 package com.mydomain.myapp;

 import java.util.HashMap;
 import java.util.Locale;

 import android.content.Context;
 import android.speech.tts.TextToSpeech;

 public class WrapTTS {

         private TextToSpeech mTTS;

         /* class initialization fails when this throws an exception */
         static {
                 try {
                         Class.forName(android.speech.tts.TextToSpeech);
                 } catch (Exception ex) {
                         throw new RuntimeException(ex);
                 }
         }

         /* calling here forces class initialization */
         public static void checkAvailable() {}

         private OnInitListener onInitListener = null;
         public interface OnInitListener {
                 public abstract void onInit(int status);
         }

         public WrapTTS(Context context, WrapTTS.OnInitListener listener) {
                 onInitListener = listener;
                 mTTS = new TextToSpeech(context,
                                 new TextToSpeech.OnInitListener() {

                                         @Override
                                         public void onInit(int status) {
                                                 onInitListener.onInit(status);
                                         }

                                 });

         }

         public int setSpeechRate(float speechRate) {
                 return mTTS.setSpeechRate(speechRate);
         }

         public void shutdown() {
                 mTTS.shutdown();
         }

         public int speak(Stringtext, int queueMode, HashMapString, String
 params) {
                 return mTTS.speak(text, queueMode, params);
         }

         public int setLanguage(Locale loc) {
                 return mTTS.setLanguage(loc);
         }

         public int isLanguageAvailable(Locale loc) {
                 return mTTS.isLanguageAvailable(loc);
         }

 }

 The following is used at the top of my main application.

         private WrapTTS mTts = null;
         private static boolean mTTSClassAvailable = false;

         /* establish whether the TextToSpeech class is available to us */

         static {
                 try {
                         WrapTTS.checkAvailable();
                         mTTSClassAvailable = true;
                 } catch (Throwable t) {
                         mTTSClassAvailable = false;
                 }
         }

 Use the mTTSClassAvailable to know whether to bother to even try to
 set up the engine.

 Hopefully it helps someone.

 Best Regards,
 Eric

-- 
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 

[android-developers] Re: How to use the dpad button to pause and play audio while the device is locked

2009-12-19 Thread Lance Nanek
There's some good information on why adding support for enhancing/
customizing/replacing the lock screen is so difficult on Android here:
http://groups.google.com/group/android-developers/msg/0dd8513a434e4764

On Dec 19, 12:36 pm, skyhigh skyhigh1...@gmail.com wrote:
 On Dec 18, 10:55 pm, Dianne Hackborn hack...@android.com wrote:

  Tell them Android sux and doesn't support this.

 Dianne, I have to say I was very surprised to get this reply from
 you.  I thought about it for a while, and then decided you must be
 having a very rough day.  I hope you have a much better day tomorrow.
 Merry Christmas!

-- 
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: How to use the dpad button to pause and play audio while the device is locked

2009-12-19 Thread Dianne Hackborn
On Sat, Dec 19, 2009 at 9:36 AM, skyhigh skyhigh1...@gmail.com wrote:

 On Dec 18, 10:55 pm, Dianne Hackborn hack...@android.com wrote:
  Tell them Android sux and doesn't support this.
 Dianne, I have to say I was very surprised to get this reply from
 you.  I thought about it for a while, and then decided you must be
 having a very rough day.  I hope you have a much better day tomorrow.
 Merry Christmas!


Thanks.  Actually I am having a fine day, but there is just really not
anything more I can help you with on this -- Android doesn't support this.

-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
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] Lifecycle states

2009-12-19 Thread stanlick
I have slept with the lifecycle diagram under my pillow for the past
several nights in hopes of resolving the dang thing.  Is it just me,
or are there too many states in the cycle?  Are some mutually
exclusive?  I am writing an application that utilizes
SharedPreferences for its persistence.  I had the following methods in
my activity and was getting very weird behavior when reloading the
saved preferences!  When I was saving the preferences from both
lifecycle methods, some key/value pairs  *WERE NOT* even in the Map
(as per debug break point).  Once I commented out the save in
onSaveInstanceState, mysteriously things started working fine.  It
appears there are thread safety issues concerning these two lifecycle
methods in particular.

@Override
protected void onPause() {
super.onPause();
savePreferences();
}

@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
//savePreferences();
}

Peace,
Scott

-- 
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: parsing a *string* of XML with SAX.

2009-12-19 Thread Edward Hinchliffe
ok, answered my own question again..

me failing to use eclipse properly:
import java.util.jar.Attributes; was at the top, rather than the SAX
attributes object.
hence my startelement method had the wrong arguments.

-- 
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] Re: OpenGL: How to test for VBO support?

2009-12-19 Thread Robert Green
You are totally right - VBOs are part of 1.1.

G1 glGetString(GL10.GL_VERSION) = OpenGL ES 1.0-CM
Droid glGetString(GL10.GL_VERSION) = OpenGL ES 1.1-CM

So clearly I'm going to have to take this into consideration when
evaluating if the system supports the feature.  My next question is -
how do I get the gles version number?  This string is fine but doesn't
it give us a number somewhere instead that we can use?  I'd rather do
that than parse the number out of the string.

I tried glGetIntegerv(GL10.GL_VERSION)  but it returned 0.

On Dec 19, 12:19 am, Lance Nanek lna...@gmail.com wrote:
 Could it have something to do with how vertex buffer objects are now
 mandatory in OpenGL ES 1.1?

 On Dec 18, 8:24 pm, Robert Green rbgrn@gmail.com wrote:

  I'm working with the Droid right now and what's funny about it is that
  it's the only device I have that doesn't report a VBO extension but
  the VBOs work perfectly on it so it clearly supports them.   Hmm...

  Normally I check the extensions for one that ends in
  vertex_buffer_object but that's not going to work here.  Is there a
  better way of knowing?

-- 
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] AsyncTask + NDK = Neverending process

2009-12-19 Thread Dianne Hackborn
On Sat, Dec 19, 2009 at 5:51 AM, Hunter Peress hunt...@gmail.com wrote:

 aSyncTask1.getAsyncTask2().getAsyncTask3().cancel(true);

 The true means mayInterruptIfRunning

 but, lo and behold, the NDK process is still running. I don't care how
 its done, but I need that NDK process to die when I ask it to. I'm
 thinking about kill-9 it through a popen call..


(1) There is no NDK process.  It is just a Java/POSIX/Linux thread, in
your OWN process, which has called down into your native code.  If you don't
supply a way for that native code to find out it should terminate early and
cleanly exit, it isn't going to do so.  This is your responsibility.

(2) Killing a -thread- is utterly, completely broken.  What if that thread
happened to be down in the memory allocator with its lock held when you did
this?  Oops, you just hosed your entire process.

(3) mayInterruptIfRunning == calling interrupt() on the thread.  This is a
Java concept.  If your native thread is not doing anything to check for this
Java state, and back out of its operation when found, then it will not do
anything.  (Actually that largely holds true for Java as well.)

(4) There is really nothing special about Android in this stuff.  It is
important to understand standard Java threading, and/or POSIX threads and
use best practices for those.  For example, AsyncTask sits on top of
FutureTask (from the standard Java library) for its core implementation.

-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
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: Alarm Wake Lock and Services

2009-12-19 Thread Dianne Hackborn
Yeah the repercussions of neglecting wake locks is largely luck -- for
example it is not uncommon for the device to be synchronizing in the
background, or receiving data, or doing something else that holds its own
wake lock, allowing you to run,  Also when plugged in to USB a wake lock is
held so the CPU will never go to sleep during that time.

On Fri, Dec 18, 2009 at 11:09 PM, Alberto afonsec...@gmail.com wrote:

 Thanks, that clears things up. I guess I was somehow lucky that this
 worked for me, maybe the device wasn't going back to sleep quickly
 enough in my case. I'll implement the broadcast receiver and wakelock
 to ensure this always works.


 On Dec 18, 4:25 pm, Dianne Hackborn hack...@android.com wrote:
  A wake lock is not currently held for services; you will need to wrap it
  with a broadcast receiver.  (Actually it is held, but because services
 are
  async the power manager is immediately told that the pending intent has
 been
  sent, and releases its wake lock.)

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
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] Multicast

2009-12-19 Thread Business Talk
I am getting ' attempted to join non-multicast group' when joining a
group;

_MulticastSocket.joinGroup(getBroadcastAddress());

where

public final InetAddress getBroadcastAddress() throws IOException,
Exception
{
WifiManager wifi = (WifiManager) _Context.getSystemService
(Context.WIFI_SERVICE);

DhcpInfo dhcp = wifi.getDhcpInfo();

if (dhcp == null)
{
throw new Exception();
}

int broadcast = (dhcp.ipAddress  dhcp.netmask) | ~dhcp.netmask;

byte[] quads = new byte[4];

for (int k = 0; k  4; k++)
{
quads[k] = (byte) ((broadcast  k * 8)  0xFF);
}

return InetAddress.getByAddress(quads);
}

-- 
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] Lifecycle states

2009-12-19 Thread Mark Murphy
stanlick wrote:
 When I was saving the preferences from both
 lifecycle methods, some key/value pairs  *WERE NOT* even in the Map
 (as per debug break point).

What Map?

 It
 appears there are thread safety issues concerning these two lifecycle
 methods in particular.

They are both called on the main application thread. It seems difficult
to have thread safety issues with only one thread involved.

   @Override
   protected void onPause() {
   super.onPause();
   savePreferences();
   }
 
   @Override
   protected void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   //savePreferences();
   }

onSaveInstanceState() can be thought of as bookmarking the current
state of the application, in case we need to come back to it (e.g.,
we're still on the activity stack but are being destroyed to reclaim
memory). I'd use it for things that are in memory, that should be in
memory if the activity is restarted, but otherwise are not needed on a
persistent basis.

For example, suppose you rolled your own word processor application,
bypassing EditText in the activity (e.g., so you could edit rich
documents). onPause() would be a fine place to store the current
document in a temp file, awaiting a possible Save operation from the
user -- if the app crashes, you could offer to recover the saved temp
file, for example. onSaveInstanceState() might hold the cursor position,
so that when you are recreated, you could reset the caret to a likely spot.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android Consulting/App Development: http://commonsware.com/consulting

-- 
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] Re: Same servicein multiple APKs, only want best one to launch

2009-12-19 Thread Watcher
Hi, I have read your post already which is why I was playing around
with the packagemanager. I suppose that is the workable solution you
are mentionning ?
If that is so then my question to Diane remains : how do I launch a
service explicitly, not using a string action, when its class is in
another APK ?

On 18 déc, 17:15, whitemice markbr...@zedray.co.uk wrote:
 I already had this discussion and was able to put together a workable
 solution. I bloged it here:http://tinyurl.com/9hwdva

 Regards
 Mark

-- 
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] how to create int[] array containing blading colors

2009-12-19 Thread skink
hi,

i need to create int array containing two blading colors - e.g. for
green and red:

arr[0] == 0xff00ff00 // green
arr[1] == 0xff11ee00
arr[2] == 0xff22dd00
arr[3] == 0xff33cc00
arr[arr.length - 1] == 0x // red

i couldn't find any API for creating such an array, so i used
workaround:

created GradientDrawable, set its bounds to setBounds(0, 0, 100, 1)
then created Bitmap 100 x 1, drew GradientDrawable on this Bitmap and
finally gotPixels() from Bitmap

is there any more simple way?

thanks,
pskink

-- 
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] Re: streaming issue with mediaplayer on android 2.0

2009-12-19 Thread cvance383
any ideas?

On Dec 18, 7:16 pm, cvance383 cvance...@yahoo.com wrote:
 I have an app that streams mp3's from a server, works fine on 1.5 and
 lower. But on the droid, for certain songs the mediaplayer buffers to
 like over 50% but onPrepared() is never called. These same songs work
 fine on 1.5 or on a 2.0 emulator but for some reason they just hang on
 the actual droid phone. No mediaplayer errors are thrown but if i call
 stop or reset it while it is hanging like this, it throws this,

 12-18 19:14:05.230: ERROR/MediaPlayer(15718): stop called in state 4
 12-18 19:14:05.230: ERROR/MediaPlayer(15718): error (-38, 0)
 12-18 19:14:05.238: ERROR/PlayerDriver(987): Command (6) was cancelled

 it is only for certain files (yes they are all mp3s) and only on the
 droid. Anyone have any ideas why these songs would hang? I already
 checked the http headers and they are correct. Thanks for any help, it
 will be greatly appreciated.

-- 
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] Rogers HTC Magic

2009-12-19 Thread jyaworsk
Will google be offering a work around to rogers no update policy? it
would be great to get 1.6 or even 2... And i would prefer to avoid
rooting my phone.

-- 
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] Re: How to use the dpad button to pause and play audio while the device is locked

2009-12-19 Thread Chris
I think it could be possible to create a lock-screen replacement that
can control your media player, but don't ask me how to do that.

-- 
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] Google Maps: Package file was not signed correctly

2009-12-19 Thread Kent Loobey
I have an Android Dev Phone 1 Firmware version 1.6 and for the last month or 
so it has been trying to update Google Maps but it keeps getting Installation 
error Package file was not signed correctly.

I have done a search on the Internet and a number of people have successfully 
completed this update and a number of others have received this same error 
message.  But I have not been able to find a solution to the not signed 
correctly problem.

Does anyone here know how to get Google Maps to update correctly?

-- 
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] RTP sending issues of OpenCore Multimedia Framework

2009-12-19 Thread sandeep sharma
Hi everyone.

How we overcome the RTP sending issues of OpenCore Multimedia
Framework in Android? Please help me.

Thanks in advance.

Regards
Sandeep

-- 
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] help me decide ?

2009-12-19 Thread rompelstilchen666
Hi,

I wrote a GWT app that used gears as a locald datastore (was running
on a pda, retreiving all db from server)
how can I do this with an android phone ?
I have read it was possible to write my own content provider
http://www.techjini.com/blog/2009/01/10/android-tip-1-contentprovider-accessing-local-file-system-from-webview-showing-image-in-webview-using-content/

- is this an official way ? I read that android did not like webview
to access local data (in my case it is definetly needed)
- is there a way to access regular db fields, id, int, varchar,
blobs 
- do i have to write a plugin for web view ?
- android does not and will never adress that kind of need and I
should just give it up, find another solution ?

thx a lot for your time
and precious help

have a gr8 day

-- 
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] Droid AVD (2.0, WVGA854) resolution hell

2009-12-19 Thread greg1x
Hi!

I'm developing a 2D game I started on Android 1.0/1.1. It scales
itself to the actual surface size, so I had nothing to change because
of the newer higher-resolution devices.I have a G1, but I'd like to
test it on a Droid too, so I've created an AVD with Android 2.0,
WVGA854. I did not check the Scale display to real size option, so I
expected that I'll get the real WVGA dimensions on surfaceChanged.
It doesn't happen like this. My application receives strange width/
height values on surfaceChanged.
Width is 569. (height is also very low)
Shouldn't it be around 854?
So, my application draws/scales itself to a smaller screen and then
the emulator seems to stretch the lower resolution surface to 854
pixels. (not even 854, in Photoshop I measured ~866 instead)
It means that I get an awfully-looking low resolution app on a big
screen.

How can I avoid this, so my application gets the real screen size on
surfaceChanged?

Thank you!

-- 
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] help me decide ?

2009-12-19 Thread pfl
Hi,

I wrote a GWT app that used gears as a locald datastore (was running
on a pda, retreiving all db from server)
how can I do this with an android phone ?
I have read it was possible to write my own content provider
http://www.techjini.com/blog/2009/01/10/android-tip-1-contentprovider-accessing-local-file-system-from-webview-showing-image-in-webview-using-content/

- is this an official way ? I read that android did not like webview
to access local data (in my case it is definetly needed)
- is there a way to access regular db fields, id, int, varchar,
blobs 
- do i have to write a plugin for web view ?
- android does not and will never adress that kind of need and I
should just give it up, find another solution ?

thx a lot for your time
and precious help

have a gr8 day

-- 
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] Re: BitmapFactory: decoder-decode returned false

2009-12-19 Thread Mike M
I posted a response to the above link from Stefan

 I found at 
http://groups.google.com/group/android-developers/browse_thread/thread/171b8bf35dbbed96/c3ec5f45436ceec8?lnk=raot.
(thanks Nilesh).  You need to add BufferedHttpEntity bufHttpEntity =
new BufferedHttpEntity(entity); 


Here was my previous code:



conn = (HttpURLConnection) bitmapUrl.openConnection();
conn.connect();
is = conn.getInputStream();
//bis = new BufferedInputStream(is);
//bm = BitmapFactory.decodeStream(bis);
bm = BitmapFactory.decodeStream(is);



And her is the code that works:


HttpGet httpRequest = null;

try {
httpRequest = new HttpGet(bitmapUrl.toURI());
} catch (URISyntaxException e) {
e.printStackTrace();
}

HttpClient httpclient = new DefaultHttpClient();
HttpResponse response = (HttpResponse) httpclient.execute
(httpRequest);

HttpEntity entity = response.getEntity();
BufferedHttpEntity bufHttpEntity = new BufferedHttpEntity
(entity);
InputStream instream = bufHttpEntity.getContent();
bm = BitmapFactory.decodeStream(instream);



I have a page that download around 40 images, and you can refresh to
see the most recent photos.  I would have almost half fail with the
decoder-decode returned false error.  With the above code, I have
had no problems.

Thanks




On Nov 24, 4:17 am, Stefan Klumpp stefan.klu...@gmail.com wrote:
 I've done more testing and tried out different stuff. I've posted a
 detailed description 
 here:http://stackoverflow.com/questions/1630258/android-bitmapfactory-deco...

 However, still no perfect solution at this point.

 On Nov 24, 11:02 am, Stefan Klumpp stefan.klu...@gmail.com wrote:



  Still no solution for that, but it seems that other developers have
  similar problems. The strange thing is that exactly the same image
  usually doesn't work, but sometimes it actually does. No idea why
  though.

  On Oct 27, 12:28 pm, Stefan Klumpp stefan.klu...@gmail.com wrote:

   For my current application I collect images from different event
   providers in Spain.

   However, when downloading images from salir.com I get the following
   logcat output:
   13970       Gallery_Activity  I  Fetching image 2/8 
   URL:http://media.salir.com/_images_/verticales/a/0/1/0/2540-los_inmortale...
   13970     ServiceHttpRequest  I  Image [http://media.salir.com/
   _images_/verticales/a/0/1/0/2540-los_inmortales_la_trattoria-
   marc_aureli_27_29_no.jpg] fetched in [146ms]
   13970                   skia  D  --- decoder-decode returned
   false

   Searching for that error message didn't provide much useful results.

   Anyone an idea what the problem could be?

   Gracias!

-- 
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] ViewFlipper.showNext() not working in timer

2009-12-19 Thread Andy Triboletti
I have some webimageviews inside a viewflipper, and I am setting a
timer so that I can play a slideshow of the images.  The problem is
the timer function is getting called but the view is not actually
advancing.  If I call the viewFlipper.showNext outside of the timer,
the image advances, but not inside the timer.  I can't use
viewFlipper.startFlipping because each time it flips I want to
download a new image in the background.

Here's my some of the code:

  public void playSlideshow() {
Timer updateProgressTimer = null;
updateProgressTimer = new Timer();
int delay = 5000; // delay for 5 sec.

int period = 5000; // repeat every sec.

updateProgressTimer.scheduleAtFixedRate(new TimerTask() {

public void run() {
System.out.println(done);
moveRight(viewFlipper);
}

}, delay, period);

}
}

public void moveRight(ViewFlipper vf) {
Log.v(moving right, Integer.toString(imageCounter));
Log.v(moving right child, Integer.toString(vf.getDisplayedChild
()));

vf.setInAnimation(slideLeftIn);
vf.setOutAnimation(slideLeftOut);
vf.showNext();
}

-- 
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] About android draw string

2009-12-19 Thread talinhu
How can the string bar 90 degrees clockwise rotation appear?

-- 
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] Re: Internal clock off by 15 seconds

2009-12-19 Thread Gene
FWIW, the internal time scale used by GPS is now exactly 15 seconds
ahead of UTC.


-- 
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] To free sipdroid from pabxes.org

2009-12-19 Thread Ricardo Martins
Is anyone working on to free sipdroid app from pabxes.org? It's a 
problem for people trying to use this app on locally installed pabxes. 
It adds a quite high amount of delay.

Sipdroid: http://sipdroid.org/

Is there anyone interested in a bounty for that? We could release this 
on sipdroid community.

Regards, Ricardo.

-- 
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] drivers for linux but can I install on my Droid

2009-12-19 Thread proteinDJ
Hi,

I have access to a nifty new external device and drivers are available
for linux but the dependency on hardware is not clearly described.

i.e.  on the driver download page
Requires Linux Kernal 2.6+.

As I understand Droid I would have to have a rooted phone in order to
install - am I right - anyone?
But even if I had rooted my Droid, should I expect the Droid chip/
hardware to be compatible with the drivers that are distributed by
this external device vendor?

Thanks! (before I start rooting around)

ProteinDJ

Trying out a new spin on optimized chemistry.

-- 
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] Re: DEV Phone 2 or Nexus One

2009-12-19 Thread CodeReign
Yeah, I've got an HTC magic.  Though not the dev two. It wasn't
released until 4 months after the HTC Magic.  I'm going to wait until
Google releases the Nexus One as a dev phone.  It has an ARM
processor or some-such powerful toy in it.  And thus I think you'll be
better off waiting at-least for the non-developer version.  I want the
Developer Version just for root but if you want to download market
apps that cost money don't buy any Dev phone.

On Dec 18, 9:57 am, kchoi kinam.of.kc...@gmail.com wrote:
 I am thinking about getting a DEV Phone 2, but there's new about
 Google's Nexus One phone that seems to have higher spec.  Is there any
 advantage of getting DEV Phone 2 ?  Any news about DEV Phone 3 (if
 any) ?

-- 
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] Alert Dialog font issue for Network location provider

2009-12-19 Thread dvp
We see the bigger font for Agree and disagree buttons for the Alert
dialog when the network provider is selected in the  location settings
menu. Any pointers or suggestions which part of the framework code
need to take a look. This dialog is controlled by Networklocation.apk
which is not open source.

-- 
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] Alert Dialog font issue for Network location provider

2009-12-19 Thread Prasad Duggineni
We see the bigger font for Alert dialog agree and disagree buttons when the
network provider is selected from the location settings menu. Any
suggestions or pointers to resolve this issue. Dialog is controlled by
Network location.apk which is not open source.

Attached the screen shot as well.

-- 
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=enattachment: device.png

Re: [android-developers] ViewFlipper.showNext() not working in timer

2009-12-19 Thread Patrick Plaatje
Hi,

Be aware that the timer uses a new thread, so you need a handle to
communicate with the UI thread.

Regards,

Patrick

--
verzonden vanaf mijn Android.

Op 19 dec 2009 10:52 PM schreef Andy Triboletti andy.tribole...@gmail.com
:

I have some webimageviews inside a viewflipper, and I am setting a
timer so that I can play a slideshow of the images.  The problem is
the timer function is getting called but the view is not actually
advancing.  If I call the viewFlipper.showNext outside of the timer,
the image advances, but not inside the timer.  I can't use
viewFlipper.startFlipping because each time it flips I want to
download a new image in the background.

Here's my some of the code:

 public void playSlideshow() {
   Timer updateProgressTimer = null;
   updateProgressTimer = new Timer();
   int delay = 5000; // delay for 5 sec.

   int period = 5000; // repeat every sec.

   updateProgressTimer.scheduleAtFixedRate(new TimerTask() {

   public void run() {
   System.out.println(done);
   moveRight(viewFlipper);
   }

   }, delay, period);

   }
}

   public void moveRight(ViewFlipper vf) {
   Log.v(moving right, Integer.toString(imageCounter));
   Log.v(moving right child, Integer.toString(vf.getDisplayedChild
()));

   vf.setInAnimation(slideLeftIn);
   vf.setOutAnimation(slideLeftOut);
   vf.showNext();
}

--
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.comandroid-developers%2bunsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

-- 
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] Re: OpenGL: How to test for VBO support?

2009-12-19 Thread Robert Green
Just found the official docs - I guess that is the string you have to
parse, according to this - 
http://www.khronos.org/opengles/sdk/1.1/docs/man/glGetString.xml

Is anyone keeping a running count of how many questions I ask and self-
answer in this group?  I should look for 5 minutes before asking next
time.

On Dec 19, 1:00 pm, Robert Green rbgrn@gmail.com wrote:
 You are totally right - VBOs are part of 1.1.

 G1 glGetString(GL10.GL_VERSION) = OpenGL ES 1.0-CM
 Droid glGetString(GL10.GL_VERSION) = OpenGL ES 1.1-CM

 So clearly I'm going to have to take this into consideration when
 evaluating if the system supports the feature.  My next question is -
 how do I get the gles version number?  This string is fine but doesn't
 it give us a number somewhere instead that we can use?  I'd rather do
 that than parse the number out of the string.

 I tried glGetIntegerv(GL10.GL_VERSION)  but it returned 0.

 On Dec 19, 12:19 am, Lance Nanek lna...@gmail.com wrote:

  Could it have something to do with how vertex buffer objects are now
  mandatory in OpenGL ES 1.1?

  On Dec 18, 8:24 pm, Robert Green rbgrn@gmail.com wrote:

   I'm working with the Droid right now and what's funny about it is that
   it's the only device I have that doesn't report a VBO extension but
   the VBOs work perfectly on it so it clearly supports them.   Hmm...

   Normally I check the extensions for one that ends in
   vertex_buffer_object but that's not going to work here.  Is there a
   better way of knowing?

-- 
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] Droid - won't rotate image captured from camera? (Camera.Parameters)

2009-12-19 Thread Mark Wyszomierski
Hi,

I'm using this camera code to ask the camera to rotate the captured
image data:

  Camera.Parameters params = camera.getParameters();
  params.set(rotation, 0);
  camera.setParameters(params);

this seems to work on all phones, except the Droid. Has anyone else
seen this? The image data is always landscape, however, the native
camera app produces portrait images ok. I wonder if the Droid will
only respect the new Camera.Parameters.setRotation() method, but this
seems to only be available in sdk level 5?

Thanks

-- 
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] Re: Droid - won't rotate image captured from camera? (Camera.Parameters)

2009-12-19 Thread Mark Wyszomierski
I have a typo in my code listing above, it really reads:

  params.set(rotation, 90);

(90 degrees, not zero),

Thanks

On Dec 19, 5:57 pm, Mark Wyszomierski mar...@gmail.com wrote:
 Hi,

 I'm using this camera code to ask the camera to rotate the captured
 image data:

   Camera.Parameters params = camera.getParameters();
   params.set(rotation, 0);
   camera.setParameters(params);

 this seems to work on all phones, except the Droid. Has anyone else
 seen this? The image data is always landscape, however, the native
 camera app produces portrait images ok. I wonder if the Droid will
 only respect the new Camera.Parameters.setRotation() method, but this
 seems to only be available in sdk level 5?

 Thanks

-- 
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] Re: Lifecycle states

2009-12-19 Thread stanlick
SharedPreferences.Editor editor = settings.edit(); returns
android.app.ApplicationContext$SharedPreferencesImpl
$editori...@447d10e8 which resolves to a backing HashMap.  When I was
saving preferences from both lifecycle methods, it was missing the
last key that was put.

On Dec 19, 1:05 pm, Mark Murphy mmur...@commonsware.com wrote:
 stanlick wrote:
  When I was saving the preferences from both
  lifecycle methods, some key/value pairs  *WERE NOT* even in the Map
  (as per debug break point).

 What Map?

  It
  appears there are thread safety issues concerning these two lifecycle
  methods in particular.

 They are both called on the main application thread. It seems difficult
 to have thread safety issues with only one thread involved.

    �...@override
     protected void onPause() {
             super.onPause();
             savePreferences();
     }

    �...@override
     protected void onSaveInstanceState(Bundle outState) {
             super.onSaveInstanceState(outState);
             //savePreferences();
     }

 onSaveInstanceState() can be thought of as bookmarking the current
 state of the application, in case we need to come back to it (e.g.,
 we're still on the activity stack but are being destroyed to reclaim
 memory). I'd use it for things that are in memory, that should be in
 memory if the activity is restarted, but otherwise are not needed on a
 persistent basis.

 For example, suppose you rolled your own word processor application,
 bypassing EditText in the activity (e.g., so you could edit rich
 documents). onPause() would be a fine place to store the current
 document in a temp file, awaiting a possible Save operation from the
 user -- if the app crashes, you could offer to recover the saved temp
 file, for example. onSaveInstanceState() might hold the cursor position,
 so that when you are recreated, you could reset the caret to a likely spot.

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://twitter.com/commonsguy

 Android Consulting/App Development:http://commonsware.com/consulting

-- 
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] Re: Automatic market updates

2009-12-19 Thread stanlick
Thanks bro --

I realize it's not much code (or hard to write) but it is silly that a
year later, the Android Market still isn't up to speed.  What happened
to not repeating yourself in code?

Peace,
Scott

On Dec 18, 12:32 pm, TreKing treking...@gmail.com wrote:
  So how do I get my users up to the current published version when my app
  was deployed without the check-this-web-file-version-by-hand-code and I
  don't even know who my users are?

 Is it absolutely crucial that your users have the most recent update the
 second it's put out? If not, don't worry about this. Put your update out and
 let the users discover it on their own, either if the Market actually works
 and notifies them or if they go check for updates manually.

 Otherwise you'll have to suck it up and write some version checking code.
 This can't be that hard. Check a file on a web server, do a compare with the
 current version, notify the user with an alert that a new version is
 available and start the Market with your app when the user clicks the
 notification.

 Why even bother with the manifest?

 Because without a higher version number the Market won't know there's an
 update available. And you won't even be allowed to publish via the Market
 unless the version code is higher than what's already there.

 -
 TreKing - Chicago transit tracking app for Android-powered 
 deviceshttp://sites.google.com/site/rezmobileapps/treking

 On Fri, Dec 18, 2009 at 9:16 AM, stanlick stanl...@gmail.com wrote:
  Wow!  So the messages on this forum from over a year ago are still
  applicable today?  It is incomprehensible to expect every app
  developer to write this code and that to notify users about updates?
  So how do I get my users up to the current published version when my
  app was deployed without the check-this-web-file-version-by-hand-code
  and I don't even know who my users are?  Why even bother with the
  manifest?  Very sad.

  Peace,
  Scott

  On Dec 18, 8:58 am, TreKing treking...@gmail.com wrote:
   I wouldn't rely on those Market update notifications. Personally, I never
   get them when they should kick in. Instead I usually check My Downloads
   manually and, AFTER I've checked, the notification will kick in. And, not
   only is it ridiculously late, it usually tells me the wrong number of
   updates are available (usually twice as many as there actually are).

   If you need your users to know when new updates are available, best bet
  is
   to add this as a feature in your app.

  -
   TreKing - Chicago transit tracking app for Android-powered deviceshttp://
  sites.google.com/site/rezmobileapps/treking

   On Fri, Dec 18, 2009 at 8:07 AM, stanlick stanl...@gmail.com wrote:
Thanks Vytautas  --

I was careful to update both android:versionCode and
android:versionName before I uploaded my new apk.  However, none of my
beta testers have received an update notification and it has been over
a week now.  I have read myriad comments about users not receiving
update notifications and many more about custom code developers are
having to place n their apps as a workaround.  Are you saying these
are problems of the past and don't exist any longer?

Peace,
Scott

--
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.comandroid-developers%2bunsubscr...@googlegroups.com
  android-developers%2bunsubscr...@googlegroups.comandroid-developers%252bunsubscr...@googlegroups.com

For more options, visit this group at
   http://groups.google.com/group/android-developers?hl=en

  --
  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.comandroid-developers%2bunsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en



-- 
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] Re: Phonestatelistener dies after a while .... can it be kept alive?

2009-12-19 Thread henca
 TelephonyManager tm = (TelephonyManager)getSystemService
 (TELEPHONY_SERVICE);
                 tm.listen(mPhoneListener, PhoneStateListener.LISTEN_NONE);

 This seems to work for a while but then fails to fire after - say an
 hour.

This sounds very much like a problem I have and wrote about at
http://www.anddev.org/crash_recovery_makes_my_widget_useless-t9163.html

 I have tried relaunching the listening in a timertask every 60 seconds
 but this does not seem to work.

Yep :-), I have also tried to use a timertask and that get lost as
well as the PhoneStateListener together with some other global
variables.

 Is there a way of keeping a listener alive for a long period of time.

I wish I knew. The timertask idea might work if the timertask is
replaced with an AlarmManager. However, I still don't like the idea to
do periodic checks to see if something has become broken. Those
periodic checks will consume battery if done often but if done seldom
there is instead a bigger risk of not having a working
PhoneStateListener when the phone state changes.

 I can only assume  the system is garbage collecting it.

According to my studies of the logs it seems as if the
PhoneStateListener disappears because the application crashes and then
is recovered in a less useful state.

regards Henrik

-- 
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: Droid - won't rotate image captured from camera? (Camera.Parameters)

2009-12-19 Thread Mark Murphy
Mark Wyszomierski wrote:
 I got all the parameters from a Droid for the camera - looks like
 rotation is not one of them... how do you get the camera to rotate the
 output?:
 
 picture-size-
 values=1280x960,1600x1200,2048x1536,2592x1936,2592x1456;mot-postview-
 mode=on;zoom=0;antibanding=auto;zoom-
 supported=true;whitebalance=auto;jpeg-thumbnail-height=240;scene-
 mode=auto;jpeg-quality=95;smooth-zoom-supported=true;preview-format-
 values=yuv422i-yuyv,yuv420sp;focus-mode=auto;preview-
 format=yuv420sp;mot-test-command=;mot-zoom-step=0.5;preview-
 size=560x320;picture-format-values=jpeg,jfif,exif;mot-areas-to-
 focus=0;mot-postview-modes=off,on;flash-mode-
 values=off,on,auto;preview-frame-rate-values=5,10,15,20,24,25,30;mot-
 max-areas-to-focus=1;preview-frame-rate=30;flash-mode=off;effect-
 values=none,mono,sepia,negative,solarize,red-tint,blue-tint,green-
 tint;focus-mode-values=off,auto,infinity,macro;picture-
 size=2048x1536;max-zoom=6;effect=none;jpeg-thumbnail-
 width=320;whitebalance-values=auto,daylight,fluorescent,cloudy-
 daylight,incandescent,warm-fluorescent;scene-mode-
 values=auto,action,portrait,landscape,night,night-
 portrait,theatre,beach,snow,sunset,steadyphoto;picture-
 format=jpeg;jpeg-thumbnail-size-
 values=160x90,160x120,176x144,320x180,320x240;mot-zoom-
 speed=99;preview-size-
 values=176x144,320x240,352x288,640x480,720x480,720x576,848x480;antibanding-
 values=auto,50hz,60hz

If your problem is unique to the DROID, you may get more assistance by
posting at the MOTODEV boards:

http://developer.motorola.com

Forgive me if you've already tried that...

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

_Android Programming Tutorials_ Version 1.0 In Print!

-- 
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] Re: Droid - won't rotate image captured from camera? (Camera.Parameters)

2009-12-19 Thread Mark Wyszomierski
Thanks, just posted there too. I hope there's a way to get around this
innovation in camera.parameters..

In the worst case, I guess I could check what platform the user is
running on, and use the native camera intent?

Thanks


On Dec 19, 8:55 pm, Mark Murphy mmur...@commonsware.com wrote:
 Mark Wyszomierski wrote:
  I got all the parameters from a Droid for the camera - looks like
  rotation is not one of them... how do you get the camera to rotate the
  output?:

  picture-size-
  values=1280x960,1600x1200,2048x1536,2592x1936,2592x1456;mot-postview-
  mode=on;zoom=0;antibanding=auto;zoom-
  supported=true;whitebalance=auto;jpeg-thumbnail-height=240;scene-
  mode=auto;jpeg-quality=95;smooth-zoom-supported=true;preview-format-
  values=yuv422i-yuyv,yuv420sp;focus-mode=auto;preview-
  format=yuv420sp;mot-test-command=;mot-zoom-step=0.5;preview-
  size=560x320;picture-format-values=jpeg,jfif,exif;mot-areas-to-
  focus=0;mot-postview-modes=off,on;flash-mode-
  values=off,on,auto;preview-frame-rate-values=5,10,15,20,24,25,30;mot-
  max-areas-to-focus=1;preview-frame-rate=30;flash-mode=off;effect-
  values=none,mono,sepia,negative,solarize,red-tint,blue-tint,green-
  tint;focus-mode-values=off,auto,infinity,macro;picture-
  size=2048x1536;max-zoom=6;effect=none;jpeg-thumbnail-
  width=320;whitebalance-values=auto,daylight,fluorescent,cloudy-
  daylight,incandescent,warm-fluorescent;scene-mode-
  values=auto,action,portrait,landscape,night,night-
  portrait,theatre,beach,snow,sunset,steadyphoto;picture-
  format=jpeg;jpeg-thumbnail-size-
  values=160x90,160x120,176x144,320x180,320x240;mot-zoom-
  speed=99;preview-size-
  values=176x144,320x240,352x288,640x480,720x480,720x576,848x480;antibanding-
  values=auto,50hz,60hz

 If your problem is unique to the DROID, you may get more assistance by
 posting at the MOTODEV boards:

 http://developer.motorola.com

 Forgive me if you've already tried that...

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://twitter.com/commonsguy

 _Android Programming Tutorials_ Version 1.0 In Print!

-- 
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] POST attempts fail every other try?

2009-12-19 Thread Mark Wyszomierski
Hi,

Has anyone else experienced an odd behavior with HttpUrlConnection,
using https, a POST request, and image data? I'm in a situation where
the first time I POST my data, everything goes through to the web
server fine. Next time I post, this call:

HttpURLConnection conn = (HttpURLConnection) new URL
(strUrl).openConnection();

returns immediately, with 'conn' initialized and usable, however no
output is actually written - and the response from the web server is
empty. The result code is -1.

The next time I run the post, everything works fine again. Repeats in
that cycle forever:

 1) post works fine
 2) no good, doesn't actually open connection, and just returns an
empty string.
 3) post works fine
 4) no good, doesn't actually open connection, and just returns an
empty string.
 .. etc ..

this is all from within the same thread, same app - I just made a
dummy activity that has a single button and posts the data to the web
server when clicked.

This is posting to a large 3rd party site. I tried self-signing my own
cert, and pointed to my own test php script on my own server. Same
behavior. Every other post fails like this, no error message /
exception, nothing.

I also ran a proxy (Charles proxy) with the emulator. I can see that
on the failed attempts, no connection is made at all. So it seems like
something is going on inside the android system - a network connection
isn't even attempted. This is a really bizarre problem.

Thanks

-- 
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] Re: AsyncTask + NDK = Neverending process

2009-12-19 Thread Hunter Peress
Thanks Dianne for the very informative response, it really helped me
understand the process vs. threading model of the AsyncTask. And I
took your advice, I implemented a simple kill method in the C code,
and I'm killin' away ! Woot!

On Dec 19, 11:00 am, Dianne Hackborn hack...@android.com wrote:
 On Sat, Dec 19, 2009 at 5:51 AM, Hunter Peress hunt...@gmail.com wrote:
  aSyncTask1.getAsyncTask2().getAsyncTask3().cancel(true);

  The true means mayInterruptIfRunning

  but, lo and behold, the NDK process is still running. I don't care how
  its done, but I need that NDK process to die when I ask it to. I'm
  thinking about kill-9 it through a popen call..

 (1) There is no NDK process.  It is just a Java/POSIX/Linux thread, in
 your OWN process, which has called down into your native code.  If you don't
 supply a way for that native code to find out it should terminate early and
 cleanly exit, it isn't going to do so.  This is your responsibility.

 (2) Killing a -thread- is utterly, completely broken.  What if that thread
 happened to be down in the memory allocator with its lock held when you did
 this?  Oops, you just hosed your entire process.

 (3) mayInterruptIfRunning == calling interrupt() on the thread.  This is a
 Java concept.  If your native thread is not doing anything to check for this
 Java state, and back out of its operation when found, then it will not do
 anything.  (Actually that largely holds true for Java as well.)

 (4) There is really nothing special about Android in this stuff.  It is
 important to understand standard Java threading, and/or POSIX threads and
 use best practices for those.  For example, AsyncTask sits on top of
 FutureTask (from the standard Java library) for its core implementation.

 --
 Dianne Hackborn
 Android framework engineer
 hack...@android.com

 Note: please don't send private questions to me, as I don't have time to
 provide private support, and so won't reply to such e-mails.  All such
 questions should be posted on public forums, where I and others can see and
 answer them.

-- 
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] Re: Unable to start an activity, load the home screen, or show a notification during calls on Droid

2009-12-19 Thread Matt
bump? anyone?

On Dec 18, 1:19 pm, Matt hansen.matt...@gmail.com wrote:
 Hi All,

 Has anyone been successful showing a notification, starting an
 activity, or loading the home screen *during* a call on the Droid?

 All three of these actions can be done with the emulator running 2.0,
 but will not run from the Droid.  I don't receive any type of
 notification that these actions fail on the Droid.  Although, every
 action works when a call is *not* active.  Missed calls during a call
 *do* show up in the notification bar, so I am hoping there is a way.

 I understand that the notification bar can not be accessed by users
 during calls, but it would be nice if a notification could at least be
 delivered.

 I also understand the security and usability concerns of displaying a
 window or action during phone calls.  Although, there are a lot of
 users who would like actionable functionality based on calls.

 Thanks for any input,

 Matt

-- 
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] Re: this is just too much

2009-12-19 Thread Matt
There is usually a cyber-crime division in each state.  However, they
are severely under-staffed.  For example, Utah only has 3 officers for
cyber-crime, and two of them spend all of their time on child
pornography cases.

However, I would still report it.

Regards,

Matt

On Dec 18, 5:27 pm, Warren warrenba...@gmail.com wrote:
 Have you contacted law enforcement? You might have a hard time getting
 their attention for something small but it is their job to
 investigate and prosecute these things. When someone downloads
 something they don't have the rights to, that is wrong, but it gets
 much more serious when someone is profiting from their copyright
 infringement.

 On Dec 18, 5:01 pm, David Overcash funnylookin...@gmail.com wrote:



  Send him a CD for fun.  Then tell Paypal he's selling illegally pirated
  goods, they'll probably freeze his account.  At the least you can stop him
  for a while.

  On Fri, Dec 18, 2009 at 12:28 PM, Andrei gml...@gmail.com wrote:
   Somebody on Craigslist selling our apps half price

  http://knoxville.craigslist.org/mob/1515792578.html

   --
   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.comandroid-developers%2Bunsubs
cr...@googlegroups.com
   For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en

-- 
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] Re: Droid AVD (2.0, WVGA854) resolution hell

2009-12-19 Thread Lance Nanek
Your application is being run in compatibility mode. You can read
about that and how to avoid it here:
http://developer.android.com/intl/zh-CN/guide/practices/screens_support.html

On Dec 19, 8:57 am, greg1x gre...@yahoo.com wrote:
 Hi!

 I'm developing a 2D game I started on Android 1.0/1.1. It scales
 itself to the actual surface size, so I had nothing to change because
 of the newer higher-resolution devices.I have a G1, but I'd like to
 test it on a Droid too, so I've created an AVD with Android 2.0,
 WVGA854. I did not check the Scale display to real size option, so I
 expected that I'll get the real WVGA dimensions on surfaceChanged.
 It doesn't happen like this. My application receives strange width/
 height values on surfaceChanged.
 Width is 569. (height is also very low)
 Shouldn't it be around 854?
 So, my application draws/scales itself to a smaller screen and then
 the emulator seems to stretch the lower resolution surface to 854
 pixels. (not even 854, in Photoshop I measured ~866 instead)
 It means that I get an awfully-looking low resolution app on a big
 screen.

 How can I avoid this, so my application gets the real screen size on
 surfaceChanged?

 Thank you!

-- 
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] ($25 reward) GPS not triggering onLocationChanged

2009-12-19 Thread dapaintballer331
If somebody can get this to work for me, using an emulator on the 1.5
sdk, I will send them $25 via paypal if you need it. I am using the
android 1.5 emulator.

Problem: I see the satilite icon on the top of the phone, but when I
send the device multiple coordinates, is never runs the
onLocationChange method.

Assumptions: Ignore the WakefulIntentService. Its just a
modification of the service class, by Mark Murphy, that keeps the
service running.

Question: Why isn't the emulator / my phone triggering
onLocationChange, but displaying an icon signifying GPS is active when
onHandleIntent is called? (And until stopUpdates is called). And, what
can I do to fix this?



Code (FmiLocationManager.java):
=code=
package org.myProj;

import android.content.Context;
import android.content.Intent;
import android.location.LocationManager;
import android.location.Location;
import android.location.LocationListener;
import android.os.Bundle;
import android.os.IBinder;
import android.util.Log;
import android.location.Criteria;

public class FmiLocationManager extends WakefulIntentService
implements LocationListener
{
private LocationManager locationMan;
private LocationListener locationLis;


public FmiLocationManager()
{
super(FmiLocationManager);
}

@Override
protected void onHandleIntent(Intent intent) {
super.onHandleIntent(intent);

locationMan = (LocationManager) getSystemService
(Context.LOCATION_SERVICE);

locationMan.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0,
0, this);
String provider = gps; //(Available on the emulator, I tested 
it)
locationMan.requestLocationUpdates(
provider,
13000,
3,
this);
}

}



public void onStop()
{
stopUpdates();
}

public void stopUpdates()
{
if(locationLis != null)
locationMan.removeUpdates(locationLis);
}


@Override
public IBinder onBind(Intent intent) {
return null;
}


public void onLocationChanged(Location loc) {
Log.e(fmi,fmi new location received);
//NEVER gets sent.

   }

 public void onProviderDisabled(String provider) {
 }

public void onProviderEnabled(String provider) {
}

public void onStatusChanged(String provider, int status,
 Bundle extras) {
 }
}
==end code



Manifest:
I won't post the entire thing, but here is the important information:
android:versionName=1.0
android:versionCode=1
 uses-permission
android:name=android.permission.ACCESS_FINE_LOCATION/uses-
permission
uses-permission
android:name=android.permission.ACCESS_MOCK_LOCATION/uses-
permission
uses-permission
android:name=android.permission.RECEIVE_BOOT_COMPLETED/uses-
permission
uses-permission android:name=android.permission.WAKE_LOCK/uses-
permission
service android:name=.FmiLocationManager /




-- 
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: I am a newbie...

2009-12-19 Thread Frank Weiss
Info about the USB driver is on the developer.android.com web site here:
http://developer.android.com/sdk/win-usb.html

It takes just a little effort to learn the Eclipse IDE, but it's well worth
it, IMO. To open the Debug perspective, choose Window + Other + Debug. Then
choose Run + Debug Configurations. Select Android Application and click
the New launch configuration button. Further info on Eclipse debug
perspective is OT for this mail list, get help from Eclipse support. Once
you have it going, you can launch your Android app in an AVD or on a device,
see what exceptions are thrown, set breakpoints, inspect your code
variables, view the logcat output, etc. This can also be done from the
command line Andorid SDK tools such as adb, etc., but many people find the
Eclipse UI more productive and easier to use.

On Sat, Dec 19, 2009 at 12:31 AM, Jae Chang jaehach...@gmail.com wrote:

 how do i run sample codes? (most important)
 and what do u mean by debug perspective, how do i run that?
 and how do i install USB driver, like usb driver patch thing in
 Android SDK, ADT?

 On Dec 18, 2:06 pm, Frank Weiss fewe...@gmail.com wrote:
  To run on a phone, install the USB driver. For development in Eclipse,
  just
  use the Debug perspective - it will automatically create the .apk,
 download
  to the phone, and run it.
 
  On Dec 18, 2009 11:24 AM, Jae Chang jaehach...@gmail.com wrote:
 
  I just followed the direction on google code page to set up java IDE,
  eclipse and android sdk and i tried all the steps to go hello
  world app. now i want to try to run other sample codes provided by
  google android team.
  i downloaded zip file fromhttp://android-developers.blogspot.com/?hl=en
  and i took out a folder out of it, but how do i run it in eclipse then
  execute in android sdk?
  and how do i repackage the file to apk to run it in a phone?
 
  i want to be able to try samples and how they run so that i can start
  it by using sample codes to write my own code (i have an electrical
  engineeering degree from college and i did c and c++ coding though it
  was very basic, but i can say i can learn what is explained with
  proper steps)
 
  tell me where i can find the steps to run or just tell me how to do
  it.
 
  --
  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.comandroid-developers%2bunsubscr...@googlegroups.com
 android-developers%2bunsubscr...@googlegroups.comandroid-developers%252bunsubscr...@googlegroups.com
 
  For more options, visit this group athttp://
 groups.google.com/group/android-developers?hl=en

 --
  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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
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: OpenGL: How to test for VBO support?

2009-12-19 Thread Dan Sherman
I am, 6 :)

- Dan

On Sat, Dec 19, 2009 at 5:34 PM, Robert Green rbgrn@gmail.com wrote:

 Just found the official docs - I guess that is the string you have to
 parse, according to this -
 http://www.khronos.org/opengles/sdk/1.1/docs/man/glGetString.xml

 Is anyone keeping a running count of how many questions I ask and self-
 answer in this group?  I should look for 5 minutes before asking next
 time.

 On Dec 19, 1:00 pm, Robert Green rbgrn@gmail.com wrote:
  You are totally right - VBOs are part of 1.1.
 
  G1 glGetString(GL10.GL_VERSION) = OpenGL ES 1.0-CM
  Droid glGetString(GL10.GL_VERSION) = OpenGL ES 1.1-CM
 
  So clearly I'm going to have to take this into consideration when
  evaluating if the system supports the feature.  My next question is -
  how do I get the gles version number?  This string is fine but doesn't
  it give us a number somewhere instead that we can use?  I'd rather do
  that than parse the number out of the string.
 
  I tried glGetIntegerv(GL10.GL_VERSION)  but it returned 0.
 
  On Dec 19, 12:19 am, Lance Nanek lna...@gmail.com wrote:
 
   Could it have something to do with how vertex buffer objects are now
   mandatory in OpenGL ES 1.1?
 
   On Dec 18, 8:24 pm, Robert Green rbgrn@gmail.com wrote:
 
I'm working with the Droid right now and what's funny about it is
 that
it's the only device I have that doesn't report a VBO extension but
the VBOs work perfectly on it so it clearly supports them.   Hmm...
 
Normally I check the extensions for one that ends in
vertex_buffer_object but that's not going to work here.  Is there a
better way of knowing?

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
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] Re: ($25 reward) GPS not triggering onLocationChanged

2009-12-19 Thread Lance Nanek
I don't need the reward, but you might want to try manually setting
the time zone as per this issue:
http://code.google.com/p/android/issues/detail?id=2545

On Dec 19, 10:46 pm, dapaintballer331 dapaintballer...@gmail.com
wrote:
 If somebody can get this to work for me, using an emulator on the 1.5
 sdk, I will send them $25 via paypal if you need it. I am using the
 android 1.5 emulator.

 Problem: I see the satilite icon on the top of the phone, but when I
 send the device multiple coordinates, is never runs the
 onLocationChange method.

 Assumptions: Ignore the WakefulIntentService. Its just a
 modification of the service class, by Mark Murphy, that keeps the
 service running.

 Question: Why isn't the emulator / my phone triggering
 onLocationChange, but displaying an icon signifying GPS is active when
 onHandleIntent is called? (And until stopUpdates is called). And, what
 can I do to fix this?

 Code (FmiLocationManager.java):
 =code=
 package org.myProj;

 import android.content.Context;
 import android.content.Intent;
 import android.location.LocationManager;
 import android.location.Location;
 import android.location.LocationListener;
 import android.os.Bundle;
 import android.os.IBinder;
 import android.util.Log;
 import android.location.Criteria;

 public class FmiLocationManager extends WakefulIntentService
 implements LocationListener
 {
         private LocationManager locationMan;
         private LocationListener locationLis;

         public FmiLocationManager()
         {
                 super(FmiLocationManager);
         }

         @Override
         protected void onHandleIntent(Intent intent) {
                 super.onHandleIntent(intent);

                 locationMan = (LocationManager) getSystemService
 (Context.LOCATION_SERVICE);
                 
 locationMan.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0,
 0, this);
                 String provider = gps; //(Available on the emulator, I 
 tested it)
                 locationMan.requestLocationUpdates(
                             provider,
                             13000,
                             3,
                             this);
                 }

         }

         public void onStop()
         {
                 stopUpdates();
         }

         public void stopUpdates()
         {
                 if(locationLis != null)
                         locationMan.removeUpdates(locationLis);
         }

         @Override
         public IBinder onBind(Intent intent) {
                 return null;
         }

         public void onLocationChanged(Location loc) {
         Log.e(fmi,fmi new location received);
         //NEVER gets sent.

            }

          public void onProviderDisabled(String provider) {
          }

         public void onProviderEnabled(String provider) {
             }

     public void onStatusChanged(String provider, int status,
              Bundle extras) {
          }}

 ==end code

 Manifest:
 I won't post the entire thing, but here is the important information:
 android:versionName=1.0
 android:versionCode=1
  uses-permission
 android:name=android.permission.ACCESS_FINE_LOCATION/uses-
 permission
         uses-permission
 android:name=android.permission.ACCESS_MOCK_LOCATION/uses-
 permission
         uses-permission
 android:name=android.permission.RECEIVE_BOOT_COMPLETED/uses-
 permission
         uses-permission android:name=android.permission.WAKE_LOCK/uses-
 permission
 service android:name=.FmiLocationManager /

 

-- 
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] Re: POST attempts fail every other try?

2009-12-19 Thread Mark Wyszomierski
Hi Jeffrey,

Thanks for confirming this. When you switched to the HttpClient
equivalents, did you have to import all the additional external jars -
I guess that's actually if you want to do a multi-part post, like
here:

  
http://groups.google.com/group/android-developers/browse_thread/thread/e4230ed22c196772/222e1d3af8eca7b1?#222e1d3af8eca7b1

I'd prefer not to start importing all these additional jars, ugh. Just
wondering if that's what you ended up doing,

Thanks

On Dec 19, 10:03 pm, Jeffrey Blattman jeffrey.blatt...@gmail.com
wrote:
 Yes. I came to the conclusion that the sdk was re-using the ssl connection
 internally but at some point the connection was released, but the sdk kept
 trying to use it.

 I never found a solution and ended up using the httpclient equivalents.

 Sorry I don't know enough about http or ssl to give a better answer.

 On Dec 19, 2009 6:16 PM, Mark Wyszomierski mar...@gmail.com wrote:

 Hi,

 Has anyone else experienced an odd behavior with HttpUrlConnection,
 using https, a POST request, and image data? I'm in a situation where
 the first time I POST my data, everything goes through to the web
 server fine. Next time I post, this call:

    HttpURLConnection conn = (HttpURLConnection) new URL
 (strUrl).openConnection();

 returns immediately, with 'conn' initialized and usable, however no
 output is actually written - and the response from the web server is
 empty. The result code is -1.

 The next time I run the post, everything works fine again. Repeats in
 that cycle forever:

  1) post works fine
  2) no good, doesn't actually open connection, and just returns an
 empty string.
  3) post works fine
  4) no good, doesn't actually open connection, and just returns an
 empty string.
  .. etc ..

 this is all from within the same thread, same app - I just made a
 dummy activity that has a single button and posts the data to the web
 server when clicked.

 This is posting to a large 3rd party site. I tried self-signing my own
 cert, and pointed to my own test php script on my own server. Same
 behavior. Every other post fails like this, no error message /
 exception, nothing.

 I also ran a proxy (Charles proxy) with the emulator. I can see that
 on the failed attempts, no connection is made at all. So it seems like
 something is going on inside the android system - a network connection
 isn't even attempted. This is a really bizarre problem.

 Thanks

 --
 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.comandroid-developers%2Bunsubs 
 cr...@googlegroups.com
 For more options, visit this group 
 athttp://groups.google.com/group/android-developers?hl=en

-- 
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] Re: AudioTrack stop/release

2009-12-19 Thread Business Talk
Thanks Niko, tried everything, including flushing, nothing works.

On Dec 16, 3:38 pm, niko20 nikolatesl...@yahoo.com wrote:
 Hi,

 try calling flush() just before stop, release. Otherwise I don't know
 - it's why the size of buffer you choose is important, big enough to
 not gap out, but small enough to be responsive.

 -niko

 On Dec 15, 11:33 pm, Business Talk roman.businesst...@gmail.com
 wrote:



  It doesn't seems as if the the stop and release immediately terminates
  the audio played by the MODE_STREAM track. It looks like it finishes
  playing the rest of the buffer and then stops. Any thoughts?- Hide quoted 
  text -

 - Show quoted text -

-- 
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] Re: Droid - won't rotate image captured from camera? (Camera.Parameters)

2009-12-19 Thread Mark Wyszomierski
It looks like what I might have to do is switch my project to the 2.0
sdk (it's currently at 4). If I see that the OS level my app is
running on is less than 2.0, then I make this call:

  Camera.Parameters params = camera.getParameters();
  params.set(rotation, 0);
  camera.setParameters(params);

if it's 2.0 or above, I use this call (added in the 2.0 api):

  Camera.parameters.setRotation(int rotation);

is this probably the best way to go? I don't know if I could go the
other direction (stay at sdk level 4, and if I see the user is running
5, try to somehow invoke the 2.0 api which should be present),

Thanks


On Dec 19, 9:09 pm, Mark Wyszomierski mar...@gmail.com wrote:
 Thanks, just posted there too. I hope there's a way to get around this
 innovation in camera.parameters..

 In the worst case, I guess I could check what platform the user is
 running on, and use the native camera intent?

 Thanks

 On Dec 19, 8:55 pm, Mark Murphy mmur...@commonsware.com wrote:



  Mark Wyszomierski wrote:
   I got all the parameters from a Droid for the camera - looks like
   rotation is not one of them... how do you get the camera to rotate the
   output?:

   picture-size-
   values=1280x960,1600x1200,2048x1536,2592x1936,2592x1456;mot-postview-
   mode=on;zoom=0;antibanding=auto;zoom-
   supported=true;whitebalance=auto;jpeg-thumbnail-height=240;scene-
   mode=auto;jpeg-quality=95;smooth-zoom-supported=true;preview-format-
   values=yuv422i-yuyv,yuv420sp;focus-mode=auto;preview-
   format=yuv420sp;mot-test-command=;mot-zoom-step=0.5;preview-
   size=560x320;picture-format-values=jpeg,jfif,exif;mot-areas-to-
   focus=0;mot-postview-modes=off,on;flash-mode-
   values=off,on,auto;preview-frame-rate-values=5,10,15,20,24,25,30;mot-
   max-areas-to-focus=1;preview-frame-rate=30;flash-mode=off;effect-
   values=none,mono,sepia,negative,solarize,red-tint,blue-tint,green-
   tint;focus-mode-values=off,auto,infinity,macro;picture-
   size=2048x1536;max-zoom=6;effect=none;jpeg-thumbnail-
   width=320;whitebalance-values=auto,daylight,fluorescent,cloudy-
   daylight,incandescent,warm-fluorescent;scene-mode-
   values=auto,action,portrait,landscape,night,night-
   portrait,theatre,beach,snow,sunset,steadyphoto;picture-
   format=jpeg;jpeg-thumbnail-size-
   values=160x90,160x120,176x144,320x180,320x240;mot-zoom-
   speed=99;preview-size-
   values=176x144,320x240,352x288,640x480,720x480,720x576,848x480;antibanding-
   values=auto,50hz,60hz

  If your problem is unique to the DROID, you may get more assistance by
  posting at the MOTODEV boards:

 http://developer.motorola.com

  Forgive me if you've already tried that...

  --
  Mark Murphy (a Commons 
  Guy)http://commonsware.com|http://twitter.com/commonsguy

  _Android Programming Tutorials_ Version 1.0 In Print!

-- 
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] Re: OutofMemoryError: bitmap size exceeds VM budget.....

2009-12-19 Thread Abhi
hi guys,

sorry got involved in something else and just didn't look back
here,

this is what was happening:

i hav an action_pick where the user picks an image and the resulting
URI is used to display the image as is full-size on the imageview.
This action wud cause an outofmemory error and also when I change
orientation.

after reading through a couple of other posts, I used BitmapFactory
and scaled the original image before displayin it on imageview. The
code is shown below. It is self-explanatory. While the scaling is
done, I wanted to still use the original image file for later part of
my app, which is what I did.


try {
InputStream is = getContentResolver().openInputStream(
  selectedImageURI);

BitmapFactory.Options opts = new
BitmapFactory.Options();
Bitmap bitmap;

opts.inJustDecodeBounds = true;
bitmap = BitmapFactory.decodeStream(is, null, opts);

System.out.println(ht + opts.outHeight);
System.out.println(wt + opts.outWidth);
System.out.println(mime + opts.outMimeType);

BitmapFactory.Options ops2 = new BitmapFactory.Options
();

WindowManager win = getWindowManager();

Display disp = win.getDefaultDisplay();

int width = disp.getWidth();

float w = opts.outWidth;

int scale = Math.round(w / width);

ops2.inSampleSize = scale;

is = getContentResolver().openInputStream
(selectedImageURI);

bitmap = BitmapFactory.decodeStream(is, null, ops2);


ImageView imageview1 = (ImageView) findViewById
(R.id.imageview);
imageview1.setImageBitmap(bitmap);

   } catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
   }


Hope this helps.

Thanks,

Abhishek

On Dec 18, 12:35 pm, Sergiu Dogaru creative.art@gmail.com wrote:
 how ?

 On Dec 18, 6:11 pm,Abhiabhishek.r.sha...@gmail.com wrote:



  Resolved!!!

  On Dec 18, 9:25 am,Abhiabhishek.r.sha...@gmail.com wrote:

   Anyone?

   On Dec 18, 12:11 am,Abhiabhishek.r.sha...@gmail.com wrote:

Hi,

I am doing the following in my app, which at times results in the
above error.

Action 1: Button on Main activity calls all pictures using ACTION_PICK
(results in a thumbnail view of all pictures on my phone). User picked
image (URI) is then passed over to next activity where the image is
displayed (ImageView) full screen. When I hit back, I go back to the
main activity. If I try to open all pictures and pick a picture again,
I get a FORCE CLOSE and the logCat data says OutofMemoryError: bitmap
size exceeds VM budget.

Action 2: I get the same error and FORCE CLOSE when I try to rotate
the full-sized picture by changing phone orientation back and forth.

What am I supposed to do to save memory? I can't change the use case
of my app... the user has to follow the above steps. How can I free up
memory without having to change anything in my app.

Thanks,

   Abhi- Hide quoted text -

   - Show quoted text -- Hide quoted text -

 - Show quoted text -

-- 
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] Re: Why are onCreate() onStart() etc. called when handset orientation is changed?

2009-12-19 Thread steff
Thanks everyone, this helped me a lot in understanding the concept
behind activities. great work, guys.

-- 
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