[android-developers] Re: Abort SMS broadcast

2008-09-03 Thread squeakypants

I'm working on a Twitter app that works though SMS. Twitter has a
normal API, but I don't plan on getting an internet plan (and I doubt
I'm the only one), and I'd still like to receive them on my phone.
However, having to look at Tweets as normal text messages wouldn't be
as comfortable as in a dedicated app.

I'm having the same problem as the person who started this thread:
While my app receives the tweets fine, it doesn't "intercept" them
from the Messaging app. I understand why you don't want apps to have
this ability, but isn't that why you list an app's permissions before
installation (as shown in the marketplace screens)? I do plan on
notifying the user just like the Messaging app, and receiving it in
two apps would be more annoying than helpful.

Do you have any suggestions on what I can do? It's noteworthy that it
will only "intercept" Twitter messages (from number 40404), and anyone
who uses Twitter via SMS (on any phone) knows how many texts they get
from it.

Thanks,
squeakypants

On Aug 28, 4:37 pm, "Justin (Google Employee)" <[EMAIL PROTECTED]>
wrote:
> As I said, you *can't* do this. Consider how dangerous this would be.
> Users are generally charged per SMS or per SMS over a certain limit,
> even "unlimited" plans usually have some limit where they charge you
> more or terminate your service. What you want to do could end up cost
> some users great amounts of money and so the user must be notified of
> every SMS sent or received.
>
> Cheers,
> Justin
> Android Team @ Google
>
> On Aug 25, 10:34 am, android_dev <[EMAIL PROTECTED]> wrote:
>
> > Hi Justin,   How to direct anSMSto an application without passing
> > theSMSto other apps and theSMSinbox?
>
> > On Aug 20, 11:24 am, "Justin (Google Employee)" <[EMAIL PROTECTED]>
> > wrote:

--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Search Invoke sample

2008-09-03 Thread android_dev

Thanks. Will try this.

On Sep 3, 4:23 pm, "Andrew Stadler" <[EMAIL PROTECTED]> wrote:
> That's a bug in the Sample.
>
> On the emulator, you can use F5 to bring up Search (in the sample's
> "automatic" mode).  For comparison, if you select "Disabled", F5 no
> longer works - simulating an activity where you do not want to support
> any search capabilities.
>
> For comparison, you can see this in the browser, too - you can can use
> menu-search or you can use F5, and both will bring up a search box.
>
> If you'd like to file a bug, you can help make sure that the sample gets 
> fixed.
>
> (Note, "emulator -help-keys" provides a complete list of special keys
> in the emulator)
>
> Thanks,
> Andy
>
>
>
> On Wed, Sep 3, 2008 at 4:06 PM, android_dev <[EMAIL PROTECTED]> wrote:
>
> > Question on the API demo - Search Invoke
>
> > I launched this sample and have selected "Automatic" in the spinner. I
> > also see a menu option "Automatic". When this menu option is selected,
> > it pops an alert that says "To invoke search try menu+S"
>
> > However, menu+S doesn't bring the search dialog.  Any issues?- 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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Search Invoke sample

2008-09-03 Thread Andrew Stadler

That's a bug in the Sample.

On the emulator, you can use F5 to bring up Search (in the sample's
"automatic" mode).  For comparison, if you select "Disabled", F5 no
longer works - simulating an activity where you do not want to support
any search capabilities.

For comparison, you can see this in the browser, too - you can can use
menu-search or you can use F5, and both will bring up a search box.

If you'd like to file a bug, you can help make sure that the sample gets fixed.

(Note, "emulator -help-keys" provides a complete list of special keys
in the emulator)

Thanks,
Andy

On Wed, Sep 3, 2008 at 4:06 PM, android_dev <[EMAIL PROTECTED]> wrote:
>
> Question on the API demo - Search Invoke
>
> I launched this sample and have selected "Automatic" in the spinner. I
> also see a menu option "Automatic". When this menu option is selected,
> it pops an alert that says "To invoke search try menu+S"
>
> However, menu+S doesn't bring the search dialog.  Any issues?
> >
>

--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Search Invoke sample

2008-09-03 Thread android_dev

Question on the API demo - Search Invoke

I launched this sample and have selected "Automatic" in the spinner. I
also see a menu option "Automatic". When this menu option is selected,
it pops an alert that says "To invoke search try menu+S"

However, menu+S doesn't bring the search dialog.  Any issues?
--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Orientation changes simulation

2008-09-03 Thread hackbod

It sounds like you will generally be in good shape, but again I will
say -- you should always always run your app on at least one piece of
real hardware before releasing it.  This app will be running in a
completely different environment (interpreted dalvik code), and the
general user experience on real hardware just can not be emulated.
Things like the screen density, interaction with the touch screen,
etc.  Personally I don't think running a previous J2ME version on some
other hardware counts as running the current Android version on the
corresponding hardware.

On Sep 3, 3:07 pm, blindfold <[EMAIL PROTECTED]> wrote:
> Good points, hackbod. My app is mostly a port from an existing J2ME
> app that runs on many physical Nokia phones, so I guess I have a fair
> idea of the performance that I may expect because my CPU intensive
> parts are actually identical on J2ME and Android. If I may believe the
> rumors that the first Android phone will have a 500+ MHz processor, I
> would be surprised if Android did worse than what I get with J2ME,
> although there are still some Android-specific performance concerns.
> One is stemming from the inability to play byte arrays in Android
> (J2ME can do that), for which the current workaround is to write these
> arrays to file (slow flash on physical phones?) and play these file
> chunks with MediaPlayer. Another Android performance concern is that
> one can currently not use the byte arrays coming from PreviewCallback
> because of image format incompatibilities, while using PictureCallback
> is probably less efficient for small images. Both concerns I feel are
> more related to Android versus J2ME than to the physical phones, and
> may be addressed through issues 398 and 739. Of course you are right
> that I can only tell how badly these two factors limit performance
> after trying a physical Android phone - or waiting for feedback from
> Android phone users.
>
> Thanks
>
> On Sep 3, 9:20 pm, hackbod <[EMAIL PROTECTED]> wrote:
>
> > Testing across multiple devices may be needed, though our goal is
> > certainly to have much more consistency across devices than J2ME does.
>
> > Testing on at least -one- device, however, should be a basic
> > expectation.  If you are running on the emulator, you have no idea how
> > your app will behave on actual hardware.
>
> > I don't think we are expecting developers to have their apps up on the
> > marketplace the first day devices are shipped.  At least, if I was a
> > developer, I certainly wouldn't want to do that, because I would have
> > no idea how my app would actually behave on real hardware.  Since
> > Android is about a third party developer ecosystem as much as it is
> > about a phone platform, we are in the somewhat tricky situation where
> > initial hardware is available at the same time for both users and
> > developers, which does imply that developers won't have their
> > applications available to users the first day devices are on sale.
>
> > On Sep 3, 11:13 am, blindfold <[EMAIL PROTECTED]> wrote:
>
> > > > Nobody should publish their app without first running it on actual
> > > > hardware.
>
> > > I don't know what your assumptions on resource constraints are, but
> > > while developing for J2ME, I've had to deal with a wide variety of
> > > firmware issues making that no single phone is representative either
> > > any more than an emulator, and the cost of testing on the myriad of
> > > Symbian based phones is for most developers prohibitive. I do not
> > > see how Android will be much different in this respect.
>
> > > The emulator had better be fairly representative, although of course
> > > I'd love to play with the first physical Android phone if I can find
> > > one. :-)
>
> > > Regards
>
> > > On Sep 3, 6:27 pm, hackbod <[EMAIL PROTECTED]> wrote:
>
> > > > On Aug 31, 3:58 am, blindfold <[EMAIL PROTECTED]> wrote:
>
> > > > > That's right. My own app includes a talking compass, but I cannot
> > > > > really test it and I may first have to wait for user reports with
> > > > > the T-Mobile G1.
>
> > > > Nobody should publish their app without first running it on actual
> > > > hardware.  Once phones become available, anyone who is developing
> > > > should have a phone to test and run their app on.  You can't expect
> > > > the emulator to provide 100% fidelity with real hardware, and it
> > > > certainly won't give enough fidelity to be able to judge the real
> > > > experience on hardware.  If you only ever run in the emulator, you
> > > > will ultimately end up with a poor application.
--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more

[android-developers] Re: Android Music Player

2008-09-03 Thread Ran Trifon
Very nice idea :)


On Wed, Sep 3, 2008 at 11:03 PM, Leszek Broniarczyk <[EMAIL PROTECTED]>wrote:

> Hi
> I would like to introduce project Pocket Android Player in 4 page comics
>
> --
> Regards
> Leszek Broniarczyk
>
> >
>


-- 
Ran Trifon

--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Easter eggs

2008-09-03 Thread David Given
Mark Murphy wrote:
[...]
> Aw, c'mon! "At the moment, the island matching the listed value is, um, 
> lost" wasn't a big enough clue?

Personally, *I* just want to know who the karaoke singer in the
MediaPlayer 'Play Audio From Resources' demo sound is.

-- 
┌─── dg@cowlark.com ─ http://www.cowlark.com ─
│
│ "All power corrupts, but we need electricity." --- Diana Wynne Jones,
│ _Archer's Goon_



signature.asc
Description: OpenPGP digital signature


[android-developers] Hide Emulator Keyboard

2008-09-03 Thread Felix Geller

Hi all,

   is it possible to hide the emulator's keyboard?

cheers,
felix

--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Orientation changes simulation

2008-09-03 Thread hackbod

Btw, looking back, you are talking about making a talking compass that
uses information from the sensor hardware...  this is the exact kind
of thing you need to run on real hardware to see how it actually
works.

On Sep 3, 3:40 pm, hackbod <[EMAIL PROTECTED]> wrote:
> It sounds like you will generally be in good shape, but again I will
> say -- you should always always run your app on at least one piece of
> real hardware before releasing it.  This app will be running in a
> completely different environment (interpreted dalvik code), and the
> general user experience on real hardware just can not be emulated.
> Things like the screen density, interaction with the touch screen,
> etc.  Personally I don't think running a previous J2ME version on some
> other hardware counts as running the current Android version on the
> corresponding hardware.
>
> On Sep 3, 3:07 pm, blindfold <[EMAIL PROTECTED]> wrote:
>
> > Good points, hackbod. My app is mostly a port from an existing J2ME
> > app that runs on many physical Nokia phones, so I guess I have a fair
> > idea of the performance that I may expect because my CPU intensive
> > parts are actually identical on J2ME and Android. If I may believe the
> > rumors that the first Android phone will have a 500+ MHz processor, I
> > would be surprised if Android did worse than what I get with J2ME,
> > although there are still some Android-specific performance concerns.
> > One is stemming from the inability to play byte arrays in Android
> > (J2ME can do that), for which the current workaround is to write these
> > arrays to file (slow flash on physical phones?) and play these file
> > chunks with MediaPlayer. Another Android performance concern is that
> > one can currently not use the byte arrays coming from PreviewCallback
> > because of image format incompatibilities, while using PictureCallback
> > is probably less efficient for small images. Both concerns I feel are
> > more related to Android versus J2ME than to the physical phones, and
> > may be addressed through issues 398 and 739. Of course you are right
> > that I can only tell how badly these two factors limit performance
> > after trying a physical Android phone - or waiting for feedback from
> > Android phone users.
>
> > Thanks
>
> > On Sep 3, 9:20 pm, hackbod <[EMAIL PROTECTED]> wrote:
>
> > > Testing across multiple devices may be needed, though our goal is
> > > certainly to have much more consistency across devices than J2ME does.
>
> > > Testing on at least -one- device, however, should be a basic
> > > expectation.  If you are running on the emulator, you have no idea how
> > > your app will behave on actual hardware.
>
> > > I don't think we are expecting developers to have their apps up on the
> > > marketplace the first day devices are shipped.  At least, if I was a
> > > developer, I certainly wouldn't want to do that, because I would have
> > > no idea how my app would actually behave on real hardware.  Since
> > > Android is about a third party developer ecosystem as much as it is
> > > about a phone platform, we are in the somewhat tricky situation where
> > > initial hardware is available at the same time for both users and
> > > developers, which does imply that developers won't have their
> > > applications available to users the first day devices are on sale.
>
> > > On Sep 3, 11:13 am, blindfold <[EMAIL PROTECTED]> wrote:
>
> > > > > Nobody should publish their app without first running it on actual
> > > > > hardware.
>
> > > > I don't know what your assumptions on resource constraints are, but
> > > > while developing for J2ME, I've had to deal with a wide variety of
> > > > firmware issues making that no single phone is representative either
> > > > any more than an emulator, and the cost of testing on the myriad of
> > > > Symbian based phones is for most developers prohibitive. I do not
> > > > see how Android will be much different in this respect.
>
> > > > The emulator had better be fairly representative, although of course
> > > > I'd love to play with the first physical Android phone if I can find
> > > > one. :-)
>
> > > > Regards
>
> > > > On Sep 3, 6:27 pm, hackbod <[EMAIL PROTECTED]> wrote:
>
> > > > > On Aug 31, 3:58 am, blindfold <[EMAIL PROTECTED]> wrote:
>
> > > > > > That's right. My own app includes a talking compass, but I cannot
> > > > > > really test it and I may first have to wait for user reports with
> > > > > > the T-Mobile G1.
>
> > > > > Nobody should publish their app without first running it on actual
> > > > > hardware.  Once phones become available, anyone who is developing
> > > > > should have a phone to test and run their app on.  You can't expect
> > > > > the emulator to provide 100% fidelity with real hardware, and it
> > > > > certainly won't give enough fidelity to be able to judge the real
> > > > > experience on hardware.  If you only ever run in the emulator, you
> > > > > will ultimately end up with a poor application.
--~--~-~--~

[android-developers] Re: Orientation changes simulation

2008-09-03 Thread blindfold

Good points, hackbod. My app is mostly a port from an existing J2ME
app that runs on many physical Nokia phones, so I guess I have a fair
idea of the performance that I may expect because my CPU intensive
parts are actually identical on J2ME and Android. If I may believe the
rumors that the first Android phone will have a 500+ MHz processor, I
would be surprised if Android did worse than what I get with J2ME,
although there are still some Android-specific performance concerns.
One is stemming from the inability to play byte arrays in Android
(J2ME can do that), for which the current workaround is to write these
arrays to file (slow flash on physical phones?) and play these file
chunks with MediaPlayer. Another Android performance concern is that
one can currently not use the byte arrays coming from PreviewCallback
because of image format incompatibilities, while using PictureCallback
is probably less efficient for small images. Both concerns I feel are
more related to Android versus J2ME than to the physical phones, and
may be addressed through issues 398 and 739. Of course you are right
that I can only tell how badly these two factors limit performance
after trying a physical Android phone - or waiting for feedback from
Android phone users.

Thanks

On Sep 3, 9:20 pm, hackbod <[EMAIL PROTECTED]> wrote:
> Testing across multiple devices may be needed, though our goal is
> certainly to have much more consistency across devices than J2ME does.
>
> Testing on at least -one- device, however, should be a basic
> expectation.  If you are running on the emulator, you have no idea how
> your app will behave on actual hardware.
>
> I don't think we are expecting developers to have their apps up on the
> marketplace the first day devices are shipped.  At least, if I was a
> developer, I certainly wouldn't want to do that, because I would have
> no idea how my app would actually behave on real hardware.  Since
> Android is about a third party developer ecosystem as much as it is
> about a phone platform, we are in the somewhat tricky situation where
> initial hardware is available at the same time for both users and
> developers, which does imply that developers won't have their
> applications available to users the first day devices are on sale.
>
> On Sep 3, 11:13 am, blindfold <[EMAIL PROTECTED]> wrote:
>
> > > Nobody should publish their app without first running it on actual
> > > hardware.
>
> > I don't know what your assumptions on resource constraints are, but
> > while developing for J2ME, I've had to deal with a wide variety of
> > firmware issues making that no single phone is representative either
> > any more than an emulator, and the cost of testing on the myriad of
> > Symbian based phones is for most developers prohibitive. I do not
> > see how Android will be much different in this respect.
>
> > The emulator had better be fairly representative, although of course
> > I'd love to play with the first physical Android phone if I can find
> > one. :-)
>
> > Regards
>
> > On Sep 3, 6:27 pm, hackbod <[EMAIL PROTECTED]> wrote:
>
> > > On Aug 31, 3:58 am, blindfold <[EMAIL PROTECTED]> wrote:
>
> > > > That's right. My own app includes a talking compass, but I cannot
> > > > really test it and I may first have to wait for user reports with
> > > > the T-Mobile G1.
>
> > > Nobody should publish their app without first running it on actual
> > > hardware.  Once phones become available, anyone who is developing
> > > should have a phone to test and run their app on.  You can't expect
> > > the emulator to provide 100% fidelity with real hardware, and it
> > > certainly won't give enough fidelity to be able to judge the real
> > > experience on hardware.  If you only ever run in the emulator, you
> > > will ultimately end up with a poor application.
>
>
--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: ListView and custom rows containing EditText

2008-09-03 Thread Romain Guy


When you want to know how a screen is built, you can just run the 
hierarchyviewer tool from the sdk. It will show you all the views and their 
properties.

On Sep 3, 2008 2:42 PM, "istv" <[EMAIL PROTECTED]> wrote:


Oookay.. Realizing "New contact" is not a ListView resolves all my
problems here (yes, Mark, that's were I was wrong). I'm gonna try out
ScrollView tomorrow, but that should not be so hard.
Thank you!

> My gosh! A fan!

Yeah, I appreciate your fancy ListViews.. :-)

Cheers,
 István
--~--~-~--~~~---~--~~ You received this 
message because you are subs...


--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: ListView and custom rows containing EditText

2008-09-03 Thread istv

Oookay.. Realizing "New contact" is not a ListView resolves all my
problems here (yes, Mark, that's were I was wrong). I'm gonna try out
ScrollView tomorrow, but that should not be so hard.
Thank you!

> My gosh! A fan!

Yeah, I appreciate your fancy ListViews.. :-)

Cheers,
 István
--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Hide Emulator Keyboard

2008-09-03 Thread sacoskun

Hello Felix,

You can easily change the default skin of the emulator to a skin which
does not have a keyboard at all.

This link will help you for this;
http://sacoskun.blogspot.com/2008/09/android-emulator-skin-without-keyboard.html

Regards,
sacoskun

On Sep 3, 10:05 am, Felix Geller <[EMAIL PROTECTED]> wrote:
> Hi all,
>
>    is it possible to hide the emulator's keyboard?
>
> cheers,
> felix
--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: getScale replacement for BaseAdapter in 0.9 beta?

2008-09-03 Thread Chris Cicc

Any suggestions anyone?

On Sep 2, 10:22 pm, Chris Cicc <[EMAIL PROTECTED]> wrote:
> Hey,
> I appreciate the prompt reply. Unfortunately I'm having trouble making
> complete sense of your instructions. I admit I'm new to Java and
> Android (though I'm very experienced in C#.NET so I'm picking it up
> pretty quickly).
>
> Right now I have the following code in an activity:
>
> Gallery gal = new Gallery(ctx);
>                         gal.setLayoutParams(new 
> LayoutParams(LayoutParams.FILL_PARENT,
> LayoutParams.WRAP_CONTENT));
>                         gal.setAdapter(new HomeGalImgAdapter(ctx));
>                         gal.setHorizontalFadingEdgeEnabled(true);
>                         gal.setSpacing(0);
>                         gal.setClickable(true);
>                         gal.setFocusable(true);
> //                      gal.setUnselectedAlpha(0.5f);
>                         topPanel.addView(gal);
>
> Along with this image adapter class:
>
> public class HomeGalImgAdapter extends BaseAdapter {
>         private Context myContext;
>
>         private int[] myImageIds = {
>                         R.drawable.test128_add_to_folder,
>                         R.drawable.test128_calendar,
>                         R.drawable.test128_chart_pie,
>                         R.drawable.test128_clock,
>                         R.drawable.test128_comments
>         };
>         public HomeGalImgAdapter(Context c) { this.myContext = c; }
>         public int getCount() { return this.myImageIds.length; }
>         public Object getItem(int position) { return position; }
>         public long getItemId(int position) { return position; }
>
>         public View getView(int position, View convertView, ViewGroup parent)
> {
>                 ImageView i = new ImageView(this.myContext);
>
>                 i.setImageResource(this.myImageIds[position]);
>                 /* Image should be scaled as width/height are set. */
>                 i.setScaleType(ImageView.ScaleType.FIT_XY);
>                 /* Set the Width/Height of the ImageView. */
>                 i.setLayoutParams(new Gallery.LayoutParams(96, 96));
>                 return i;
>         }
>         }
>
> This works perfectly, and the gallery displays with a bunch of other
> content. How do I implement your suggestion to have the not-in-focus
> images be scaled smaller?
>
> Also, I am trying to figure out how to set a TextView to act as a
> caption whenever the picture changes focus, but at the moment as soon
> as I start scrolling through the gallery and the first image loses
> focus I am unable to get another image to take focus. Still trying to
> figure that one out...
>
> Thanks for your help!
>
> On Sep 2, 5:10 pm, "Romain Guy" <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > Just override the method getChildStaticTransformation() in ViewGroup
> > and for the given child, set the transformation to a smaller scale.
> > Then in your constructors, make sure you set the flag
> > FLAG_SUPPORT_STATIC_TRANSFORMATIONS in mGroupFlags:
>
> > mGroupFlags |= FLAG_SUPPORT_STATIC_TRANSFORMATIONS;
>
> > On Tue, Sep 2, 2008 at 12:47 PM, Chris Cicc <[EMAIL PROTECTED]> wrote:
>
> > > Hi Romain Guy,
> > > How would I go about doing this? I'd really like to enable two pieces
> > > of functionality that were removed in the 0.9 Beta, a smaller scale
> > > for the not-in-focus images, and the ability to automatically loop
> > > (and rotate through) the gallery. Alpha on the edges would be nice,
> > > but I can live without that...
>
> > > Any chance we could get a code sample on what you suggest?
>
> > > Thanks,
> > > Chris
>
> > > On Aug 29, 7:42 pm, "Romain Guy" <[EMAIL PROTECTED]> wrote:
> > >> Note that you can build your own replacement by creating a subclass of
> > >> a ViewGroup and enabling support for children static transformations.
>
> > >> On Fri, Aug 29, 2008 at 3:50 PM, Megha Joshi <[EMAIL PROTECTED]> wrote:
> > >> > The getScale() API was removed from BaseAdapter, because now theGallery
> > >> > widget does not support scaling the focussed item in relation to the 
> > >> > other
> > >> > items.
> > >> > No replacement was added. It is recommended that you don't alter the
> > >> > standard behavior of theGallerywidget.
> > >> > Is there any particular reason you want to do this?
>
> > >> > 2008/8/29 blim <[EMAIL PROTECTED]>
>
> > >> >> What should we use to replace getScale from BaseAdapter, which has
> > >> >> been deHey,
>
> I appreciate the prompt reply. Unfortunately I'm having trouble making
> complete sense of your instructions. I admit I'm new to Java and
> Android (though I'm very experienced in C#.NET so I'm picking it up
> pretty quickly).
>
> Right now I have the following code in an activity:
>
> Gallery gal = new Gallery(ctx);
>                         gal.setLayoutParams(new 
> LayoutParams(LayoutParams.FILL_PARENT,
> LayoutParams.WRAP_CONTENT));
>                         gal.setAdapter(new HomeGalImgAdapter(ctx));
>                         gal.s

[android-developers] Re: Replacement for MapView's OnLongPressListener

2008-09-03 Thread Megha Joshi
2008/9/3 Megha Joshi <[EMAIL PROTECTED]>

>
>
> 2008/9/1 plusminus <[EMAIL PROTECTED]>
>
>>
>> What is the common replacement for MapView's OnLongPressListener
>> (since its gone in 0.9) ?
>
>
> Since MapView's setOnLongPressListener() method is now removed...if you
> need the same functionality...you could try
> handling the OnTouchEvent() and passing it on to a GestureDetector to
> handle it yourself..
>

Further, you can use getProjection() to get the lat/lng from the pixel
co-ordinates of the touchEvent..


>
>> OnLongClick does not provide the Coordinates :(
>>
>> PS: This is my third try to post o_O.
>> >>
>>
>

--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Web search

2008-09-03 Thread Megha Joshi
2008/9/3 android_dev <[EMAIL PROTECTED]>

>
> How to get web search results in an application (without launching the
> browser)?
>
> Can the getFromLocationName(...) be used for getting web search
> results given a search term?
>

It can be used for location search.

>
> example: getFromLocationName("pizza San Jose, CA", 5)
>
> Will this return the pizza places around San Jose, CA?


Business search is not a part of the current API, so you can only search
places or addresses..
For details see the API docs below:
http://code.google.com/android/reference/android/location/Geocoder.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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Bug in Bitmap.compress when used on JPEGs?

2008-09-03 Thread Bertl

I have another problem refered to Bitmaps, I save png pictures of
CameraPReview, but when I show them a little smaller were reset, I
have proved with Log.i(...) and Iit exists and with a normal value my
Bitmap but when I write pic.width() pich.height() I get always null.

Why?
--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Port JSON client to SDK 0.9

2008-09-03 Thread Francisco

FOrgot to mention this is a .NET Webservice running on my local
environment.



On Sep 2, 4:31 pm, Francisco <[EMAIL PROTECTED]> wrote:
> Hi everybody!
>
> I finally was able to call the web service i wanted from my
> application, i have a problem now.
>
> The String i get from the response method is removing my xml tags. I
> get Strings like the following:
>
> 
> http://tempuri.org/";> NAME="authors">
>
> Instead of:
>
>   
>   http://tempuri.org/";>
>
> Does anyboydy knows hows to aviod this or why is this happening? if i
> call the web service from ksoap this doesnt happens but my ksoap
> project doest work since the new SDK.
>
> Any help that you could give me will be appreciated.
>
> Thanks
>
> Francisco Ortega
>
> On Sep 2, 12:20 pm, Francisco <[EMAIL PROTECTED]> wrote:
>
>
>
> > Thanks a Lot Mark!
>
> > I Finally was able to make it work! i had a while without working with
> > the new SDKs so i didnt know that permission was added. Thank you!.
> > By the way. I am getting a new error now.
>
> >  > xmlns:soap="http://www.w3.org/2003/05/soap-envelope"; 
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
> > xmlns:xsd="http://www.w3.org/2001/
> > XMLSchema">soap:Receiver > soap:Value> > xml:lang="en">System.Web.Services.Protocols.SoapException: Server was
> > unable to process request. ---> System.Xml.XmlException: Root
> > element is missing.
> >    at System.Xml.XmlTextReaderImpl.Throw(Exception e)
> >    at System.Xml.XmlTextReaderImpl.ThrowWithoutLineInfo(String res)
> >    at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
> >    at System.Xml.XmlTextReaderImpl.Read()
> >    at System.Xml.XmlTextReader.Read()
> >    at
> > System.Web.Services.Protocols.SoapServerProtocol.SoapEnvelopeReader.Read()
> >    at System.Xml.XmlReader.MoveToContent()
> >    at
> > System.Web.Services.Protocols.SoapServerProtocol.SoapEnvelopeReader.MoveToC­­ontent()
> >    at
> > System.Web.Services.Protocols.SoapServerProtocolHelper.GetRequestElement()
> >    at
> > System.Web.Services.Protocols.Soap12ServerProtocolHelper.RouteRequest()
> >    at
> > System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMes­­sage
> > message)
> >    at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
> >    at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type
> > type, HttpContext context, HttpRequest request, HttpResponse response,
> > Boolean& abortProcessing)
> >    --- End of inner exception stack trace --- > soap:Reason>
>
> > Do you have any idea why this could be happening? My web service
> > returns the following:
> >    
> >  > ="varchar"/> > NAME="au_fname" DBTYPE ="varchar"/> > ="varchar"/>
> > ="varchar"/> > DBTYPE ="varchar"/>
> > 
> > 172-32-1176WhiteJohnson408 496-7223 > C>10932 Bigge Rd.Menlo ParkCA94025True > C>213-46-8915GreenMarjorie415
> > 986-7020309 63rd St. #411OaklandCA94618 > C>True
> > 
>
> > On Sep 2, 10:59 am, Mark Murphy <[EMAIL PROTECTED]> wrote:
>
> > > Francisco wrote:
> > > > I have just double checked and i always get a SocketException with an
> > > > "Unknown error" Detailed messase.
>
> > > > Do you have any idea what could it be?
>
> > > Do you have the INTERNET permission in your AndroidManifest.xml? I think
> > > that, er, manifests as this error.
>
> > > 
>
> > > --
> > > Mark Murphy (a Commons Guy)http://commonsware.com
> > > Warescription: All titles, revisions, & ebook formats, just $35/year- 
> > > 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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] How to use the mic for audio-input in android

2008-09-03 Thread HTP

Hi!

I'm trying to make an app that records audio from the microphone. In
the new the SDK i think the emulator supports audio capturing. But I
don't understand how to get the emulator to use my computers
microphone.

The emulator pages says that I have to start the emulator this way:
emulator -audio-in 
But I can't find any information about how to define  so it
will use my computer's mic.
Or use a -wav file as audio input.
Does anybody know?
Thanks in advance!

//HTP

--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: How to use the mic for audio-input in android

2008-09-03 Thread Megha Joshi
If you connect mic to your PC, the emulator should be able to detect it
without any additional launch flags.

2008/9/3 HTP <[EMAIL PROTECTED]>

>
> Hi!
>
> I'm trying to make an app that records audio from the microphone. In
> the new the SDK i think the emulator supports audio capturing. But I
> don't understand how to get the emulator to use my computers
> microphone.
>
> The emulator pages says that I have to start the emulator this way:
> emulator -audio-in 
> But I can't find any information about how to define  so it
> will use my computer's mic.
> Or use a -wav file as audio input.
> Does anybody know?
> Thanks in advance!
>
> //HTP
>
> >
>

--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: ListView and custom rows containing EditText

2008-09-03 Thread Mark Murphy

istv wrote:
 > So, are there any solutions around that I did not see yet? I had a
 > look at Mark Murphy's blog, and also some of the tutorials on
 > anddev.org..

My gosh! A fan!

;-)

>  I had problems today concerning ListView/ListAdapter... I'd like to
> get an activity that is very similar to the "New contact" one in v0.9.
> Basically a ListView, that is expandable by custom rows containing
> EditText, RateBars, etc..

I'm a bit confused. When I open the Contacts activity, and choose New 
Contact from the options menu, I get an activity that probably isn't a 
ListView. That's probably just a LinearLayout popped in a ScrollView to 
handle the extra length.

Are you referring to something else?

> 2. Changing orientation of the device in emulator (Ctrl+F12) causes
> the EditTexts to lose all changes made. Do I really need to save their
> states manually?

What happens on a rotation is that your activity is shut down and 
restarted with the new resource set.

During the shutdown process, onSaveInstanceState() will be called, and 
you'll get that Bundle back on the ensuing onCreate().

> 3. How to get a row that sticks to the bottom (the two buttons in "New
> contact")? It is apparently achieved by an additional row containing
> nothing.

Since I'm not seeing the same activity as the one you're describing, I 
can't say for certain, but it might be a footer view. Try 
ListView#addFooterView().

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
_The Busy Coder's Guide to Android Development_ Version 1.1 Published!

--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: ListView and custom rows containing EditText

2008-09-03 Thread Jeff Hamilton
ListView isn't really meant to handle that type of UI with editable
entries, as it manages the selection state of the items directly. It's
designed to handle long lists of items that don't take focus
themselves.

The contact editing screen is using a vertical LinearLayout wrapped in
a ScrollView, containing horizontal LinearLayours of the EditTexts and
Buttons. When using a ScrollView you can set
android:fillViewport="true" in your layout file to get it to fill up
the entire screen, which is how contacts pushes the buttons to the
bottom.

-Jeff

On Wed, Sep 3, 2008 at 1:19 PM, istv <[EMAIL PROTECTED]> wrote:
>
> Hello everyone,
>  I had problems today concerning ListView/ListAdapter... I'd like to
> get an activity that is very similar to the "New contact" one in v0.9.
> Basically a ListView, that is expandable by custom rows containing
> EditText, RateBars, etc..
> I tried by extending BaseAdapter's onView (the simple way by inflating
> layout-xmls per row), which actually worked, but nevertheless, it
> raised a couple of problems which I want to address here.
>
> 1. Whenever I "touch" an EditText and start typing, the focus jumps to
> the respective EditText of the first row that has the same inflated
> listitem-layout. Navigating with keys works.
>
> 2. Changing orientation of the device in emulator (Ctrl+F12) causes
> the EditTexts to lose all changes made. Do I really need to save their
> states manually?
>
> 3. How to get a row that sticks to the bottom (the two buttons in "New
> contact")? It is apparently achieved by an additional row containing
> nothing.
>
>
> So, are there any solutions around that I did not see yet? I had a
> look at Mark Murphy's blog, and also some of the tutorials on
> anddev.org..
>
> Thanks & Cheers,
>  István
> >
>

--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Web search

2008-09-03 Thread android_dev

How to get web search results in an application (without launching the
browser)?

Can the getFromLocationName(...) be used for getting web search
results given a search term?

example: getFromLocationName("pizza San Jose, CA", 5)

Will this return the pizza places around San Jose, CA?



--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Replacement for MapView's OnLongPressListener

2008-09-03 Thread Megha Joshi
2008/9/1 plusminus <[EMAIL PROTECTED]>

>
> What is the common replacement for MapView's OnLongPressListener
> (since its gone in 0.9) ?


Since MapView's setOnLongPressListener() method is now removed...if you need
the same functionality...you could try
handling the OnTouchEvent() and passing it on to a GestureDetector to handle
it yourself..

>
> OnLongClick does not provide the Coordinates :(
>
> PS: This is my third try to post o_O.
> >
>

--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Bug in Bitmap.compress when used on JPEGs?

2008-09-03 Thread reed

Can some of these problem images be attached here? That would facility
debugging the issue.

On Sep 3, 7:32 am, Bertl <[EMAIL PROTECTED]> wrote:
> I have another problem refered to Bitmaps, I save png pictures of
> CameraPReview, but when I show them a little smaller were reset, I
> have proved with Log.i(...) and Iit exists and with a normal value my
> Bitmap but when I write pic.width() pich.height() I get always null.
>
> Why?

--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: REST + JSON Web Service Client

2008-09-03 Thread Francisco

Hi everybody!

I finally was able to call the web service i wanted from my
application, i have a problem now.


The String i get from the response method is removing my xml tags. I
get Strings like the following:



http://tempuri.org/";>


Instead of:


  
  http://tempuri.org/";>


Does anyboydy knows hows to aviod this or why is this happening? if i
call the web service from ksoap this doesnt happens but my ksoap
project doest work since the new SDK.


Any help that you could give me will be appreciated.


Thanks


Francisco Ortega


On Aug 25, 11:12 am, "Megha Joshi" <[EMAIL PROTECTED]> wrote:
>    This might help...
>
>     JSONObject mLocationJSON = createLocationJSON(mLatitude,  mLongitude,
> mDateTime);
>     postLocationJSON(SERVER_URL, mLocationJSON);
>
>     /**
>      * @param mUrl The URL of location tracking server.
>      * @param mLocationJSON The location data with time in JSON format.
>      */
>     public void postLocationJSON(String mUrl, JSONObject mLocationJSON) {
>        HttpClient httpClient = new DefaultHttpClient();
>        HttpPost postMethod = new HttpPost(mUrl);
>         try {
>        // prepare parameters
>           HttpParams params = new BasicHttpParams();
>           params.setParameter("locationJSON", mLocationJSON.toString());
>             postMethod.setParams(params);
>             httpClient.execute(postMethod);
>             Log.i(TAG, "Post request, data: " + mLocationJSON.toString());
>         } catch (Exception e) {
>             Log.e("Exception", e.getMessage());
>         } finally {
>             postMethod.abort();
>         }
>     }
>
>    /**
>      * @param mLatitude The latitude data received from location update sent
> by
>      *        LocationManager Service.
>      * @param mLongitude The longitude received from location update sent by
>      *        LocationManager Service.
>      * @param mDateTime The DateTime at which location update was sent.
>      * @return JSONObject The JSONObject holding latitude,longitude reported
> by
>      *         the LocationManager Service and DateTime in RFC3339 format.
>      */
>     public JSONObject createLocationJSON(double mLatitude, double
> mLongitude,
>             String mDateTime) {
>         JSONObject mLocationJSON = new JSONObject();
>         try {
>             mLocationJSON.put("latitude", mLatitude);
>             mLocationJSON.put("longitude", mLongitude);
>             mLocationJSON.put("date", mDateTime);
>         } catch (JSONException ex) {
>             Log.e(TAG, "Error in creating Location JSON object.");
>         }
>         return mLocationJSON;
>     }
>
> 2008/8/25 Baran <[EMAIL PROTECTED]>
>
>
>
>
>
> > Hello Jeffrey,
>
> > I was wondering if you could provide me something about how you
> > appended your JSON string to the web service request. I am trying to
> > communicate with this rest web service via POST method. But I am
> > unable to identify how to append the JSON string as the parameters.
> > Object.setParameter is not working in this scenario...
>
> > Hope to hear from you soon!!
>
> > On Aug 21, 10:12 am, Jeffrey Sharkey <[EMAIL PROTECTED]>
> > wrote:
> > > Just a heads up that I've been using "simpleJSON" with Android, and
> > > it's working pretty well.  It's somewhat nicer than the defaultJSON
> > > included in the SDK because it's iterator-able, making for slick code:
>
> > > for(JSONValue value : (JSONArray)JSONValue.parse(string)) {
> > >     JSONObject obj = (JSONObject)value;
> > >     ...
>
> > > }
>
> > >http://www.json.org/java/simple.txt
>
> > > j
>
> > > On Aug 20, 11:00 pm, Baran <[EMAIL PROTECTED]> wrote:
>
> > > > Hi,
>
> > > > Thanks for the reply, actually I was confused with how we can use
> > > >JSON. I suppose this is for manipulating the response we get after a
> > > > successfulwebservicerequest. Please correct me if I am wrong. Still
> > > > new to this thing.
>
> > > > On Aug 20, 7:00 pm, Mark Murphy <[EMAIL PROTECTED]> wrote:
>
> > > > > Baran wrote:
> > > > > > Hi,
>
> > > > > > I need to access a .NetwebserviceinRestformat usingJSON. I m
> > > > > > pretty new to this concept and very much confused about how this
> > > > > > works
>
> > > > > > Any one who can give an overview of the two. I need the steps that
> > I
> > > > > > need to follow to useJSON. Right now my doubt is how to useJSONto
> > > > > > grab to output. Lets say we create a httpclientand it get the
> > > > > > respone now what?
>
> > > > > > How can we use theJSONobject to manipulate the response...
>
> > > > > There is aJSONparser built into Android:
>
> >http://code.google.com/android/reference/org/json/package-summary.html
>
> > > > > And there is an HTTPclientbuilt into Android:
>
> >http://code.google.com/android/reference/org/apache/http/package-summ...
>
> > > > > though you may wish to view the HttpClient documentation here:
>
> > > > >http://hc.apache.org/
>
> > > > > Both of these are open source projects with their own 

[android-developers] ListView and custom rows containing EditText

2008-09-03 Thread istv

Hello everyone,
 I had problems today concerning ListView/ListAdapter... I'd like to
get an activity that is very similar to the "New contact" one in v0.9.
Basically a ListView, that is expandable by custom rows containing
EditText, RateBars, etc..
I tried by extending BaseAdapter's onView (the simple way by inflating
layout-xmls per row), which actually worked, but nevertheless, it
raised a couple of problems which I want to address here.

1. Whenever I "touch" an EditText and start typing, the focus jumps to
the respective EditText of the first row that has the same inflated
listitem-layout. Navigating with keys works.

2. Changing orientation of the device in emulator (Ctrl+F12) causes
the EditTexts to lose all changes made. Do I really need to save their
states manually?

3. How to get a row that sticks to the bottom (the two buttons in "New
contact")? It is apparently achieved by an additional row containing
nothing.


So, are there any solutions around that I did not see yet? I had a
look at Mark Murphy's blog, and also some of the tutorials on
anddev.org..

Thanks & Cheers,
 István
--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: allocation in loop each 1s

2008-09-03 Thread barbapapaz

For framerate I'm talking about number of request by time unit. Each
request I get messages and display it on map. I launch request only if
map move

Thanks for your advices!

On 3 sep, 21:39, hackbod <[EMAIL PROTECTED]> wrote:
> I'm not sure what you mean by framerate...  we are talking about http
> requests, right?  They shouldn't be tied to a frame rate.  You really
> need to think about the repercussions of running on a mobile device:
>
> - When on a EDGE network, it can easily take more than a second just
> to set up a network connection.
> - Opening a network connection puts the device in to a high power
> state, and it will remain in that state for at least 10 seconds as it
> expects more network traffic.  This will drain the battery very
> quickly.
> - Even if you get the network connection up in time, it is doubtful
> you will get all of your data back within 1 second.
>
> As a target, I would recommend trying to do a network connection no
> more than once a minute (and this only when your app is in the
> foreground; when in the background you want to be much more frugal
> than that).  In that connection, you can retrieve all of the
> information around the current area that you might be interested in.
> That is, batch your requests so that you can get a lot of data in a
> small number of batches, to help mitigate the impact of network
> connection delays and bringing the device in to a high power state by
> performing network activity.
>
> Another option you can use is to keep a persistent connection open
> while your app is in the foreground, which the server and client talk
> back and forth on as needed.  When there is no traffic on the
> connection the device can go into a lower power state (though there is
> still the delay so you still want to batch interactions as much as
> possible), but this avoids the initial setup overhead.  I'm not sure
> how useful this is for doing repeated requests, except for getting rid
> of the htttp and network setup overhead, but it can be very useful
> when a server is pushing data to an app on the server's schedule.
>
> On Sep 3, 10:56 am, barbapapaz <[EMAIL PROTECTED]> wrote:
>
> > Hello it's for a map application you can see a video 
> > herehttp://www.youtube.com/watch?v=3cHyRdLi1D8
>
> > What are rational framerate for this type of application? For example
> > when you use google map or google earth what is methodology?
>
> > Thanks for your interest
>
> > On 3 sep, 18:34, hackbod <[EMAIL PROTECTED]> wrote:
>
> > > You are making an http request every second?  Though I don't know what
> > > you are doing, that seems way too frequent to me.  This will be very
> > > hard on the battery, effectively causing the device to keep its radio
> > > turned on in a high power state for the entire time you are running.
>
> > > On Sep 3, 2:20 am, barbapapaz <[EMAIL PROTECTED]> wrote:
>
> > > > Hello
>
> > > > I have question about efficiency in loop. In my app I have loop called
> > > > with sceduler each second. In this loop I launch request with
> > > > httpclient, I must cronstruct an entity with MultipartEntity.
>
> > > > this procedure explain here (http://groups.google.com/group/android-
> > > > developers/browse_thread/thread/e4230ed22c196772/1284daa5723acd0c?
> > > > lnk=gst&q=MultipartEntity#1284daa5723acd0c)
>
> > > >                         ContentBody[] parts =   {        new
> > > > StringBody(Float.toString(latitudeMin)),
> > > >                                                                         
> > > >   new StringBody(Float.toString(latitudeMax)),
> > > >                                                                         
> > > >   new StringBody(Float.toString(longitudeMin)),
> > > >                                                                         
> > > >   new StringBody(Float.toString(longitudeMax)),
> > > >                                                                         
> > > >   new StringBody(dateMin),
> > > >                                                                         
> > > >   new StringBody(dateMax),
> > > >                                                                         
> > > >   new StringBody(noteMin),
> > > >                                                                         
> > > >   new StringBody(categories)
> > > >                                 };
>
> > > >                         MultipartEntity getMessagesRequestContent = new 
> > > > MultipartEntity();
> > > >                         
> > > > getMessagesRequestContent.addPart("latitudeMin", parts[0]);
> > > >                         
> > > > getMessagesRequestContent.addPart("latitudeMax", parts[1]);
> > > >                         
> > > > getMessagesRequestContent.addPart("longitudeMin", parts[2]);
> > > >                         
> > > > getMessagesRequestContent.addPart("longitudeMax", parts[3]);
> > > >                         getMessagesRequestContent.addPart("dateMin", 
> > > > parts[4]);
> > > >                       

[android-developers] Re: Orientation changes simulation

2008-09-03 Thread hackbod

On Aug 31, 3:58 am, blindfold <[EMAIL PROTECTED]> wrote:
> That's right. My own app includes a talking compass, but I cannot
> really test it and I may first have to wait for user reports with
> the T-Mobile G1.

Nobody should publish their app without first running it on actual
hardware.  Once phones become available, anyone who is developing
should have a phone to test and run their app on.  You can't expect
the emulator to provide 100% fidelity with real hardware, and it
certainly won't give enough fidelity to be able to judge the real
experience on hardware.  If you only ever run in the emulator, you
will ultimately end up with a poor application.

--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: allocation in loop each 1s

2008-09-03 Thread barbapapaz

Hello it's for a map application you can see a video here
http://www.youtube.com/watch?v=3cHyRdLi1D8

What are rational framerate for this type of application? For example
when you use google map or google earth what is methodology?

Thanks for your interest

On 3 sep, 18:34, hackbod <[EMAIL PROTECTED]> wrote:
> You are making an http request every second?  Though I don't know what
> you are doing, that seems way too frequent to me.  This will be very
> hard on the battery, effectively causing the device to keep its radio
> turned on in a high power state for the entire time you are running.
>
> On Sep 3, 2:20 am, barbapapaz <[EMAIL PROTECTED]> wrote:
>
> > Hello
>
> > I have question about efficiency in loop. In my app I have loop called
> > with sceduler each second. In this loop I launch request with
> > httpclient, I must cronstruct an entity with MultipartEntity.
>
> > this procedure explain here (http://groups.google.com/group/android-
> > developers/browse_thread/thread/e4230ed22c196772/1284daa5723acd0c?
> > lnk=gst&q=MultipartEntity#1284daa5723acd0c)
>
> >                         ContentBody[] parts =   {        new
> > StringBody(Float.toString(latitudeMin)),
> >                                                                           
> > new StringBody(Float.toString(latitudeMax)),
> >                                                                           
> > new StringBody(Float.toString(longitudeMin)),
> >                                                                           
> > new StringBody(Float.toString(longitudeMax)),
> >                                                                           
> > new StringBody(dateMin),
> >                                                                           
> > new StringBody(dateMax),
> >                                                                           
> > new StringBody(noteMin),
> >                                                                           
> > new StringBody(categories)
> >                                 };
>
> >                         MultipartEntity getMessagesRequestContent = new 
> > MultipartEntity();
> >                         getMessagesRequestContent.addPart("latitudeMin", 
> > parts[0]);
> >                         getMessagesRequestContent.addPart("latitudeMax", 
> > parts[1]);
> >                         getMessagesRequestContent.addPart("longitudeMin", 
> > parts[2]);
> >                         getMessagesRequestContent.addPart("longitudeMax", 
> > parts[3]);
> >                         getMessagesRequestContent.addPart("dateMin", 
> > parts[4]);
> >                         getMessagesRequestContent.addPart("dateMax", 
> > parts[5]);
> >                         getMessagesRequestContent.addPart("noteMin", 
> > parts[6]);
> >                         getMessagesRequestContent.addPart("categories", 
> > parts[7]);
>
> > In this code there are lot of "new" and the garbage collector is often
> > called!
> > MultipartEntity and StringBody objects aren't clear or erase function,
> > I must called new each loop!
>
> > Do you think that is no problem?
> > Do you think that I musn't use this new (do you have solution)?
>
> > MultipartEntity and StringBody objects are in an opensource library
> > (code 
> > herehttp://hc.apache.org/httpcomponents-client/httpmime/xref/index.html).
> > Do you think that I must write clear funtion to don't called new
> > function (and recompile)?
>
> > 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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: allocation in loop each 1s

2008-09-03 Thread hackbod

I'm not sure what you mean by framerate...  we are talking about http
requests, right?  They shouldn't be tied to a frame rate.  You really
need to think about the repercussions of running on a mobile device:

- When on a EDGE network, it can easily take more than a second just
to set up a network connection.
- Opening a network connection puts the device in to a high power
state, and it will remain in that state for at least 10 seconds as it
expects more network traffic.  This will drain the battery very
quickly.
- Even if you get the network connection up in time, it is doubtful
you will get all of your data back within 1 second.

As a target, I would recommend trying to do a network connection no
more than once a minute (and this only when your app is in the
foreground; when in the background you want to be much more frugal
than that).  In that connection, you can retrieve all of the
information around the current area that you might be interested in.
That is, batch your requests so that you can get a lot of data in a
small number of batches, to help mitigate the impact of network
connection delays and bringing the device in to a high power state by
performing network activity.

Another option you can use is to keep a persistent connection open
while your app is in the foreground, which the server and client talk
back and forth on as needed.  When there is no traffic on the
connection the device can go into a lower power state (though there is
still the delay so you still want to batch interactions as much as
possible), but this avoids the initial setup overhead.  I'm not sure
how useful this is for doing repeated requests, except for getting rid
of the htttp and network setup overhead, but it can be very useful
when a server is pushing data to an app on the server's schedule.

On Sep 3, 10:56 am, barbapapaz <[EMAIL PROTECTED]> wrote:
> Hello it's for a map application you can see a video 
> herehttp://www.youtube.com/watch?v=3cHyRdLi1D8
>
> What are rational framerate for this type of application? For example
> when you use google map or google earth what is methodology?
>
> Thanks for your interest
>
> On 3 sep, 18:34, hackbod <[EMAIL PROTECTED]> wrote:
>
> > You are making an http request every second?  Though I don't know what
> > you are doing, that seems way too frequent to me.  This will be very
> > hard on the battery, effectively causing the device to keep its radio
> > turned on in a high power state for the entire time you are running.
>
> > On Sep 3, 2:20 am, barbapapaz <[EMAIL PROTECTED]> wrote:
>
> > > Hello
>
> > > I have question about efficiency in loop. In my app I have loop called
> > > with sceduler each second. In this loop I launch request with
> > > httpclient, I must cronstruct an entity with MultipartEntity.
>
> > > this procedure explain here (http://groups.google.com/group/android-
> > > developers/browse_thread/thread/e4230ed22c196772/1284daa5723acd0c?
> > > lnk=gst&q=MultipartEntity#1284daa5723acd0c)
>
> > >                         ContentBody[] parts =   {        new
> > > StringBody(Float.toString(latitudeMin)),
> > >                                                                           
> > > new StringBody(Float.toString(latitudeMax)),
> > >                                                                           
> > > new StringBody(Float.toString(longitudeMin)),
> > >                                                                           
> > > new StringBody(Float.toString(longitudeMax)),
> > >                                                                           
> > > new StringBody(dateMin),
> > >                                                                           
> > > new StringBody(dateMax),
> > >                                                                           
> > > new StringBody(noteMin),
> > >                                                                           
> > > new StringBody(categories)
> > >                                 };
>
> > >                         MultipartEntity getMessagesRequestContent = new 
> > > MultipartEntity();
> > >                         getMessagesRequestContent.addPart("latitudeMin", 
> > > parts[0]);
> > >                         getMessagesRequestContent.addPart("latitudeMax", 
> > > parts[1]);
> > >                         getMessagesRequestContent.addPart("longitudeMin", 
> > > parts[2]);
> > >                         getMessagesRequestContent.addPart("longitudeMax", 
> > > parts[3]);
> > >                         getMessagesRequestContent.addPart("dateMin", 
> > > parts[4]);
> > >                         getMessagesRequestContent.addPart("dateMax", 
> > > parts[5]);
> > >                         getMessagesRequestContent.addPart("noteMin", 
> > > parts[6]);
> > >                         getMessagesRequestContent.addPart("categories", 
> > > parts[7]);
>
> > > In this code there are lot of "new" and the garbage collector is often
> > > called!
> > > MultipartEntity and StringBody object

[android-developers] Re: allocation in loop each 1s

2008-09-03 Thread hackbod

You are making an http request every second?  Though I don't know what
you are doing, that seems way too frequent to me.  This will be very
hard on the battery, effectively causing the device to keep its radio
turned on in a high power state for the entire time you are running.

On Sep 3, 2:20 am, barbapapaz <[EMAIL PROTECTED]> wrote:
> Hello
>
> I have question about efficiency in loop. In my app I have loop called
> with sceduler each second. In this loop I launch request with
> httpclient, I must cronstruct an entity with MultipartEntity.
>
> this procedure explain here (http://groups.google.com/group/android-
> developers/browse_thread/thread/e4230ed22c196772/1284daa5723acd0c?
> lnk=gst&q=MultipartEntity#1284daa5723acd0c)
>
>                         ContentBody[] parts =   {        new
> StringBody(Float.toString(latitudeMin)),
>                                                                           new 
> StringBody(Float.toString(latitudeMax)),
>                                                                           new 
> StringBody(Float.toString(longitudeMin)),
>                                                                           new 
> StringBody(Float.toString(longitudeMax)),
>                                                                           new 
> StringBody(dateMin),
>                                                                           new 
> StringBody(dateMax),
>                                                                           new 
> StringBody(noteMin),
>                                                                           new 
> StringBody(categories)
>                                 };
>
>                         MultipartEntity getMessagesRequestContent = new 
> MultipartEntity();
>                         getMessagesRequestContent.addPart("latitudeMin", 
> parts[0]);
>                         getMessagesRequestContent.addPart("latitudeMax", 
> parts[1]);
>                         getMessagesRequestContent.addPart("longitudeMin", 
> parts[2]);
>                         getMessagesRequestContent.addPart("longitudeMax", 
> parts[3]);
>                         getMessagesRequestContent.addPart("dateMin", 
> parts[4]);
>                         getMessagesRequestContent.addPart("dateMax", 
> parts[5]);
>                         getMessagesRequestContent.addPart("noteMin", 
> parts[6]);
>                         getMessagesRequestContent.addPart("categories", 
> parts[7]);
>
> In this code there are lot of "new" and the garbage collector is often
> called!
> MultipartEntity and StringBody objects aren't clear or erase function,
> I must called new each loop!
>
> Do you think that is no problem?
> Do you think that I musn't use this new (do you have solution)?
>
> MultipartEntity and StringBody objects are in an opensource library
> (code 
> herehttp://hc.apache.org/httpcomponents-client/httpmime/xref/index.html).
> Do you think that I must write clear funtion to don't called new
> function (and recompile)?
>
> 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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Multipart Messages - Is there an example how to get them work now. (Uploading to a web API)

2008-09-03 Thread Rajesh

Hi James,
I downloaded the apache common jars and added them to my build path,
but still I get "org.apache.http.entity.mime" cant be resolved.
Don't know if I'm doing something wrong. I just followed the steps you
had explained. Kindly let me know if there is anything extra I should
do with eclipse.

Thanks and regards,
Rajesh

On Aug 27, 12:12 pm, jlapenna <[EMAIL PROTECTED]> wrote:
> Yeah, you're going to need to add it to your build path. You can do
> that by right clicking on your project in the Package Explorer,
> selecting Build Path -> Configure Build Path, clicking on Libraries
> then clicking "Add JARs." If nothing is listed you need to add the
> libraries to your project, you can do that by creating a new folder in
> your project called lib, and copying the .jar files recommended above
> in that directory and then right clicking on that folder and clicking
> refresh. At that point the libraries should be listed in the "Add
> JARs" dialog.
>
> On Aug 26, 7:49 pm, Zack <[EMAIL PROTECTED]> wrote:> Thanks for your many 
> helpful posts!
> > I'm sure this one will be helpful to me but what do I need to do to be
> > able to
> > import org.apache.http.entity.mime.MultipartEntity;?
> > I get "The import org.apache.http.entity.mime cannot be resolved"
> > Do I need to configure eclipse and add something to it?
>
> > Thanks again.
>
> > On Aug 19, 4:18 pm, "Justin (Google Employee)" <[EMAIL PROTECTED]>
> > wrote:
>
> > > Just to finish this thread off nicely, here's some code to use
> > > multipart posts. Again, you need mime4j, httpmime, and Apache Commons
> > > IO.
>
> > > import java.io.ByteArrayInputStream;
> > > import java.io.InputStream;
> > > import org.apache.http.client.HttpClient;
> > > import org.apache.http.client.methods.HttpPost;
> > > import org.apache.http.entity.mime.MultipartEntity;
> > > import org.apache.http.entity.mime.content.ContentBody;
> > > import org.apache.http.entity.mime.content.InputStreamBody;
> > > import org.apache.http.entity.mime.content.StringBody;
> > > import org.apache.http.impl.client.DefaultHttpClient;
> > > ...
> > > HttpClient httpClient = new DefaultHttpClient();
> > > HttpPost request = new HttpPost("http://www.example.com";);
>
> > > // we assume 'data' is some byte array representing a jpeg
> > > InputStream ins = new ByteArrayInputStream(data);
> > > parts[0] = new InputStreamBody(ins, "image.jpg");
> > > parts[1] = new StringBody("some bit of information");
> > > parts[2] = new StringBody("another bit of information");
>
> > > // create the multipart request and add the parts to it
> > > MultipartEntity requestContent = new MultipartEntity();
> > > requestContent.addPart("image.jpg", parts[0]);
> > > requestContent.addPart("data_part1", parts[1]);
> > > requestContent.addPart("data_part2", parts[2]);
>
> > > // execute the request
> > > request.setEntity(requestContent);
> > > httpClient.execute(request);
>
> > > The HttpClient execute method will give you a handle to the response.
> > > From that you can do HttpResponse.getEntity().getContent() which will
> > > give you an InputStream to read the response. Unfortunately the
> > > InputStream doesn't produce a meaningful response for
> > > InputStream.available(). This might be because somewhere along the way
> > > the Content-Length header seems to be getting lost, but I haven't had
> > > time to look into this further yet.
>
> > > Cheers,
> > > Justin
> > > Android Team @ Google
>
> > > On Aug 18, 11:13 pm, code_android_festival_way
>
> > > <[EMAIL PROTECTED]> wrote:
> > > > Thank you Justin for helping me out. It is working pretty fine
> > > > now. :-)
>
> > > > Cheers from Germany!
>
> > > > On 19 Aug., 02:11, "Justin (Google Employee)" <[EMAIL PROTECTED]> wrote:
>
> > > > > Looks like you also need the Apache Commons IO library which you can
> > > > > get fromhttp://commons.apache.org/io/.
>
> > > > > Cheers,
> > > > > Justin
> > > > > Android Team @ Google
>
> > > > > On Aug 18, 3:19 pm, code_android_festival_way
>
> > > > > <[EMAIL PROTECTED]> wrote:
> > > > > > So I'm back with a question. I've imported the libraries mentioned
> > > > > > above and got the following setup:
>
> > > > > >http://paste.pocoo.org/show/82631/
>
> > > > > > Now I get an error while executing the POST method with the
> > > > > > HttpClient. Am I doing sth. wrong or what do I have to change to get
> > > > > > it working. (the paste above is cutted down to the most important
> > > > > > parts)
>
> > > > > > The error message:
>
> > > > > > Error in org.apache.commons.io.ouput.ByteArrayOutputStream
>
> > > > > > I'm looking forward getting some answers.
>
> > > > > > Regards!
>
> > > > > > On 18 Aug., 22:35, code_android_festival_way
>
> > > > > > <[EMAIL PROTECTED]> wrote:
> > > > > > > Thank you for your answer Dan.
>
> > > > > > > I'm looking now how to get the whole thing working. (since I'm 
> > > > > > > not the
> > > > > > > best Java developer :) )
>
> > > > > > > I will come back with the results later on.
>
> 

[android-developers] Re: Orientation changes simulation

2008-09-03 Thread hackbod

Testing across multiple devices may be needed, though our goal is
certainly to have much more consistency across devices than J2ME does.

Testing on at least -one- device, however, should be a basic
expectation.  If you are running on the emulator, you have no idea how
your app will behave on actual hardware.

I don't think we are expecting developers to have their apps up on the
marketplace the first day devices are shipped.  At least, if I was a
developer, I certainly wouldn't want to do that, because I would have
no idea how my app would actually behave on real hardware.  Since
Android is about a third party developer ecosystem as much as it is
about a phone platform, we are in the somewhat tricky situation where
initial hardware is available at the same time for both users and
developers, which does imply that developers won't have their
applications available to users the first day devices are on sale.

On Sep 3, 11:13 am, blindfold <[EMAIL PROTECTED]> wrote:
> > Nobody should publish their app without first running it on actual
> > hardware.
>
> I don't know what your assumptions on resource constraints are, but
> while developing for J2ME, I've had to deal with a wide variety of
> firmware issues making that no single phone is representative either
> any more than an emulator, and the cost of testing on the myriad of
> Symbian based phones is for most developers prohibitive. I do not
> see how Android will be much different in this respect.
>
> The emulator had better be fairly representative, although of course
> I'd love to play with the first physical Android phone if I can find
> one. :-)
>
> Regards
>
> On Sep 3, 6:27 pm, hackbod <[EMAIL PROTECTED]> wrote:
>
> > On Aug 31, 3:58 am, blindfold <[EMAIL PROTECTED]> wrote:
>
> > > That's right. My own app includes a talking compass, but I cannot
> > > really test it and I may first have to wait for user reports with
> > > the T-Mobile G1.
>
> > Nobody should publish their app without first running it on actual
> > hardware.  Once phones become available, anyone who is developing
> > should have a phone to test and run their app on.  You can't expect
> > the emulator to provide 100% fidelity with real hardware, and it
> > certainly won't give enough fidelity to be able to judge the real
> > experience on hardware.  If you only ever run in the emulator, you
> > will ultimately end up with a poor application.
--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Setting highlight text color (textColorHighlight doesn't do it)

2008-09-03 Thread Megha Joshi
If you want the textcolor to change to white when you select it...you should
use ColorStateList.

Say, you have a ColorStateList drawable  named textcolor:

http://schemas.android.com/apk/res/android";>




you can set your textview's attributes to:

android:textColorHighlight="#00f"
android:textColor="@drawable/textcolor"

2008/9/2 Andrew Dupont <[EMAIL PROTECTED]>

>
> Despite its name, the global "textColorHighlight" attribute controls
> the color of the highlight itself, rather than the highlighted text.
> So if I've got gray text and a dark blue highlight color, it appears
> as gray on blue, and I can't make the selected text white on blue no
> matter what I try. None of the "inverse" text color styles work for
> this. Any ideas?
>
> Cheers,
> Andrew Dupont
> >
>

--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Orientation changes simulation

2008-09-03 Thread blindfold

> Nobody should publish their app without first running it on actual
> hardware.

I don't know what your assumptions on resource constraints are, but
while developing for J2ME, I've had to deal with a wide variety of
firmware issues making that no single phone is representative either
any more than an emulator, and the cost of testing on the myriad of
Symbian based phones is for most developers prohibitive. I do not
see how Android will be much different in this respect.

The emulator had better be fairly representative, although of course
I'd love to play with the first physical Android phone if I can find
one. :-)

Regards

On Sep 3, 6:27 pm, hackbod <[EMAIL PROTECTED]> wrote:
> On Aug 31, 3:58 am, blindfold <[EMAIL PROTECTED]> wrote:
>
> > That's right. My own app includes a talking compass, but I cannot
> > really test it and I may first have to wait for user reports with
> > the T-Mobile G1.
>
> Nobody should publish their app without first running it on actual
> hardware.  Once phones become available, anyone who is developing
> should have a phone to test and run their app on.  You can't expect
> the emulator to provide 100% fidelity with real hardware, and it
> certainly won't give enough fidelity to be able to judge the real
> experience on hardware.  If you only ever run in the emulator, you
> will ultimately end up with a poor application.

--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Does getLocationFromName work in 0.9?

2008-09-03 Thread [EMAIL PROTECTED]

Does anyone know if getLocationFromName (with a bounding box) works in
0.9? I can use the simpler version just fine:

public List getFromLocationName(String locationName, int
maxResults)

When I use the version that accepts a bounding box, I always get a
null result:
public List getFromLocationName(String locationName, int
maxResults, double lowerLeftLatitude, double lowerLeftLongitude,
double upperRightLatitude, double upperRightLongitude)

Has anyone successfully used 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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Mock Location Provider [SOLVED+IMPROVED]

2008-09-03 Thread Stefan Handschuh

Small correction:

http://pastebin.com/m684e7561


On Sep 3, 6:56 pm, Stefan Handschuh <[EMAIL PROTECTED]> wrote:
> I somehow improved Justins code.
>
> Seehttp://pastebin.com/m1f06415f
>
> It has now a New-York based journey (longer than before) and the
> time-interval between each points can be set so that the update inveral
> (set to 500ms) can be arbitraryly small (see line 177)
>
> @Justin: if you like it, please include it in you zip-file
>
> > I just posted some code 
> > athttp://groups.google.com/group/android-developers/web/mock_provider.zip
> > that implements a mock location provider. This runs entirely in the
> > emulator, so it should work across all platforms. It allows you to
> > specify a set of coordinates and will the just loop through them
> > forever. This could easily be adapted to read data from a file, URL,
> > etc. As Stefan points out 
> > onhttp://groups.google.com/group/android-developers/browse_frm/thread/2...
> > , its important to set the time value on the Location you pass to the
> > location service. If a new Location has the same time value as the
> > previous one the LocationManager received, the location won't be
> > updated.
>
> > You should be able to compile this, install it on the emulator, run
> > it, and then see the location change in Maps application.
>
> > Hopefully this puts it all together and resolves issues that many have
> > been encountering.
>
> > Cheers,
> > Justin
> > Android Team @ Google
--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Mock Location Provider [SOLVED+IMPROVED]

2008-09-03 Thread Stefan Handschuh

I somehow improved Justins code.

See http://pastebin.com/m1f06415f 

It has now a New-York based journey (longer than before) and the
time-interval between each points can be set so that the update inveral
(set to 500ms) can be arbitraryly small (see line 177)



@Justin: if you like it, please include it in you zip-file


> I just posted some code at 
> http://groups.google.com/group/android-developers/web/mock_provider.zip
> that implements a mock location provider. This runs entirely in the
> emulator, so it should work across all platforms. It allows you to
> specify a set of coordinates and will the just loop through them
> forever. This could easily be adapted to read data from a file, URL,
> etc. As Stefan points out on 
> http://groups.google.com/group/android-developers/browse_frm/thread/2b71c14f34dd8788
> , its important to set the time value on the Location you pass to the
> location service. If a new Location has the same time value as the
> previous one the LocationManager received, the location won't be
> updated.
> 
> You should be able to compile this, install it on the emulator, run
> it, and then see the location change in Maps application.
> 
> Hopefully this puts it all together and resolves issues that many have
> been encountering.
> 
> Cheers,
> Justin
> Android Team @ Google
> > 


--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Creating pop-up menu

2008-09-03 Thread jalandar

Hi
I am junior andriod developer.
In my application of active note .I want to create  menu-item list of
main menu
e.g.
Options-->1.New note-->a.send ,b.delete,c.exit
  2.help
  3.exit
(Here Options is main menu )

when i click on Options there should be pop -up list of menu-items
(new note,help,exit) .

If anybudy knows plz provide code for implimentation.

plz provide  me suggetions. how to create this application.

thank u
jagtap jalandar
[EMAIL PROTECTED]
[EMAIL PROTECTED]
--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Will android provide Mail API??

2008-09-03 Thread hackbod

Where did you get these classes from?  These are not part of the SDK,
nor internal implementation of the platform, as far as I know.  Given
that, you shouldn't be having classes in the com.android namespace,
since that is reserved for android.

On Sep 3, 12:55 am, elvisw <[EMAIL PROTECTED]> wrote:
> I am now using some classes under the packages
> com.android.email.mail  as my Mail API,
> and now I can receive mail from GMail.
> but have some problems to send mail using SMTP.
> I dont know to use the API to create MimeMessage actually.
> Anyone know about this???
>
> my code to send mail with one text part and one attachment file is as
> follows
> (it works if i just send first part only, but fail if I add the second
> part...)
> appreciate if any ideal...
>
> *
> import com.android.email.mail.Address;
> import com.android.email.mail.MessagingException;
> import com.android.email.mail.Message.RecipientType;
> import com.android.email.mail.internet.ByteArrayBody;
> import com.android.email.mail.internet.MimeBodyPart;
> import com.android.email.mail.internet.MimeMessage;
> import com.android.email.mail.internet.MimeMultipart;
> import com.android.email.mail.transport.SmtpTransport;
>
> 
>
> try
> {
> MimeMessage message = new MimeMessage();
> message.setSentDate(new Date());
> Address from = new Address("[EMAIL PROTECTED]");
> Address[] to = new Address[]{new
> Address("[EMAIL PROTECTED]")};
> message.setFrom(from);
> message.setRecipients(RecipientType.TO, to);
> message.setSubject("This is a test...");
>
> String text = mailText.getText().toString();
>
> ByteArrayBody body = new 
> ByteArrayBody(text.getBytes());
> MimeMultipart rootPart = new MimeMultipart("multipart/
> mixed");
>
> MimeBodyPart part1 = new MimeBodyPart();
>
> part1.setBody(body);
>
> MimeBodyPart part2 = new MimeBodyPart();
> File f = new File("/sdcard/mail/5424/song.mp3");
> Uri uri = Uri.fromFile(f);
> ContentResolver contentResolver = 
> getContentResolver();
> String contentType = contentResolver.getType(uri);
>
> if (contentType == null) {
> contentType = "";
> }
>
> String name = null;
> int size = 0;
>
> Cursor metadataCursor = contentResolver.query(
> uri,
> new String[]{OpenableColumns.DISPLAY_NAME,
> OpenableColumns.SIZE},
> null,
> null,
> null);
> if (metadataCursor != null) {
> try {
> if (metadataCursor.moveToNext()) {
> name = metadataCursor.getString(0);
> size = metadataCursor.getInt(1);
> }
> } finally {
> metadataCursor.close();
> }
> }
>
> if (name == null) {
> name = uri.getLastPathSegment();
> }
>
> Log.d("SendActivity", "contentType=" + contentType + "
> name="  + name + "   size=" + size);
>
> ByteArrayOutputStream bos = new 
> ByteArrayOutputStream();
>
> bos.reset();
> try
> {
> byte[] tmp = new byte[8192];
> int cnt = 0;
> FileInputStream fis = new FileInputStream(f);
> while( (cnt=fis.read(tmp)) != -1)
> {
> bos.write(tmp, 0, cnt);
> }
> } catch (FileNotFoundException e)
> {
> e.printStackTrace();
> } catch (IOException e)
> {
> e.printStackTrace();
> }
>
> Log.d("SendActivity", new
> Long(bos.toByteArray().length).toString());
> Log.d("SendActivity", new
> Long(Base64.encodeBase64(bos.toByteArray

[android-developers] Re: Adding "standard" "Moreicon to More submenu

2008-09-03 Thread Joa

Sorry hit the "submit" button by accident

On Sep 2, 9:53 pm, Joa <[EMAIL PROTECTED]> wrote:
> Polishing my app, I am trying to add the "standard"
>
> http://code.google.com/android/reference/android/R.styleable.html#Ico...
--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Httpunit and Android

2008-09-03 Thread acet

Hello all,
has anyone had any experience with using httpunit in an android
project? I have been unable to build my eclipse project once i have
imported the required files for httpunit.

When I import the httpuint jar files:

activation-1.1.jar
js-1.6R5.jar
jtidy-4aug2000r7-dev.jar
junit-3.8.1.jar
mail-1.4.jar
nekohtml-0.9.5.jar
servlet-api-2.4.jar
xercesImpl-2.6.1.jar
xmlParserAPIs-2.6.1.jar
httpunit.jar

After adding all the jar files to the build path of the project I
receive this error when trying to build:

trouble processing:
[2008-09-03 11:33:05 - votex] bad utf-8 byte a0 at offset 0004
...while parsing cst 00bf at offset 08dd
...while parsing cst 003c at offset 0109
...while parsing org/apache/xerces/impl/xpath/regex/
ParserForXMLSchema.class
...while processing org/apache/xerces/impl/xpath/regex/
ParserForXMLSchema.class
[2008-09-03 11:33:05 - votex]
trouble processing:
[2008-09-03 11:33:05 - votex] bad utf-8 byte 80 at offset 0021
...while parsing cst 0247 at offset 1879
...while parsing cst 0051 at offset 016e
...while parsing org/apache/xerces/impl/xpath/regex/Token.class
...while processing org/apache/xerces/impl/xpath/regex/Token.class
[2008-09-03 11:33:09 - votex]
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lorg/w3c/dom/Attr;
[2008-09-03 11:33:09 - votex]   at
com.google.dex.file.ClassDefsSection.add(ClassDefsSection.java:114)
[2008-09-03 11:33:09 - votex]   at
com.google.dex.file.DexFile.add(DexFile.java:103)
[2008-09-03 11:33:09 - votex]   at
com.google.command.dexer.Main.processClass(Main.java:364)
[2008-09-03 11:33:09 - votex]   at
com.google.command.dexer.Main.processFileBytes(Main.java:346)
[2008-09-03 11:33:09 - votex]   at
com.google.command.dexer.Main.processArchive(Main.java:311)
[2008-09-03 11:33:09 - votex]   at
com.google.command.dexer.Main.processOne(Main.java:233)
[2008-09-03 11:33:09 - votex]   at
com.google.command.dexer.Main.processAllFiles(Main.java:169)
[2008-09-03 11:33:09 - votex]   at
com.google.command.dexer.Main.run(Main.java:126)
[2008-09-03 11:33:09 - votex]   at
com.android.ide.eclipse.adt.build.ApkBuilder.executeDx(ApkBuilder.java:
569)
[2008-09-03 11:33:09 - votex]   at
com.android.ide.eclipse.adt.build.ApkBuilder.build(ApkBuilder.java:
380)
[2008-09-03 11:33:09 - votex]   at
org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:
624)
[2008-09-03 11:33:09 - votex]   at
org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
[2008-09-03 11:33:09 - votex]   at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:
166)
[2008-09-03 11:33:09 - votex]   at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:
197)
[2008-09-03 11:33:09 - votex]   at
org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:
246)
[2008-09-03 11:33:09 - votex]   at
org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
[2008-09-03 11:33:09 - votex]   at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:
249)
[2008-09-03 11:33:09 - votex]   at
org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:
302)
[2008-09-03 11:33:09 - votex]   at
org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:
334)
[2008-09-03 11:33:09 - votex]   at
org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:
137)
[2008-09-03 11:33:09 - votex]   at
org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:
235)
[2008-09-03 11:33:09 - votex]   at
org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
[2008-09-03 11:33:10 - votex] 2 warnings
[2008-09-03 11:33:10 - votex] 1 error; aborting
[2008-09-03 11:33:10 - votex] Conversion to Dalvik format failed with
error 1

Does anyone have an idea about how to solve this problem?

--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: How to transfer Image bytes from MediaStore.Image ContentProvider to byte [] array

2008-09-03 Thread alexa

Bitmap bitmap = Media.getBitmap(getContentResolver(), imageUri);
ByteArrayOutputStream bytes = new ByteArrayOutputStream();

bitmap.compress(Bitmap.CompressFormat.JPEG, 90, bytes);
ByteArrayInputStream stream = new
ByteArrayInputStream(bytes.toByteArray());

--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Some help with webservices?!

2008-09-03 Thread kennyg

Did you set the android.permission.INTERNET permission in the
Android.Manifest.xml?

Not providing this leads to unexpected errors when connecting.

Kenny.

Cezar Augustus Signori wrote:
> Hi all!
>
> i still try to send/receive data from/to webservices...well, i tried
> the kSoap2 (as almost of us), but all that i get is an "unknown error"
> message.
>
> After some tries, i've decided to simple send XML to the webservice
> through a connection and receive the response as String to later
> handle it with some XML parser. But all i can get is a bug "Does Not
> Support Output" message from the URLConnection. If i use another class
> such HttpUrlConnection from java.net or apache,  the "unknown error"
> message comes again.
>
> I tried things like described:
>
> http://www.anddev.org/calling_a_web_service_from_android-t348.html
> http://chitgoks.blogspot.com/2008/03/android-and-web-services.html
> and other resources from this group..
>
> Thanks in advance!

--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Can Android be installed on a Palm TX?

2008-09-03 Thread leeand00

I was just wondering if it would be possible to install Android on a
Palm TX?

Thank you,
Andrew J. Leer

--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Bug in Bitmap.compress when used on JPEGs?

2008-09-03 Thread kp

Maybe some of the requests are getting blocked. Try adding connect and
read timeouts by replacing url.openStream() with
openConnection().getInputStream():

...
URL url = uri.toURL();
URLConnection con = url.openConnection();
con.setConnectTimeout(3000);
con.setReadTimeout(3000);
Bitmap bmp = BitmapFactory.decodeStream(con.getInputStream());
...

Adjust the 3000 ms timeout values if necessary.

You can add exception handling for the connection timeouts.

Regards,

Kim

On Sep 1, 4:36 am, snowcrash <[EMAIL PROTECTED]> wrote:
> Hi there,
>
> I experience strange things when using the compress method from
> Bitmap. I'm useing the code at the bottom to download JPEGs from a
> server. Out of all images downloaded, ~10% fail to be written with a
> NullpointerException and a preceding message from something called
> 'skia'. Each image is different and it doesn't always happen for the
> same ones:
>
> 09-01 13:19:04.126: DEBUG/skia(1124): xx failure to skip
> request 9936 actual 6906
> 09-01 13:19:04.132: DEBUG/skia(1124): x jpeg
> setjump exit
> 09-01 13:19:04.132: ERROR/ImageUtil(1124):
> java.lang.NullPointerException
>
> If I use the same code on PNGs, all works like a charm.
>
> The code used is:
>
> public static String saveImageFromURI(URI uri, String name,
>                         final Activity ctx, Handler handler) {
>                 boolean success = false;
>                 String qualifiedName = name + ".jpg";
>                 FileOutputStream fos = null;
>                 try {
>                         URL url = uri.toURL();
>                         Bitmap bmp = 
> BitmapFactory.decodeStream(url.openStream());
>                         fos = ctx.openFileOutput(qualifiedName, 
> Context.MODE_PRIVATE);
>                         success = bmp.compress(Bitmap.CompressFormat.JPEG, 
> 75, fos);
>                 } catch (MalformedURLException e) {
>                         Log.e(TAG, e.toString(), e);
>                 } catch (IOException e) {
>                         Log.e(TAG, e.toString(), e);
>                 } catch (IllegalArgumentException e) {
>                         Log.e(TAG, e.toString());
>                 } catch (NullPointerException e) {
>                         Log.e(TAG, e.toString(), e);
>                 } finally {
>                         try {
>                                 if (fos != null)
>                                         fos.close();
>                         } catch (IOException e) {
>                                 Log.e(TAG, e.toString(), e);
>                         }
>                 }
>                 if (success) {
>                         return qualifiedName;
>                 } else {
>                         return null;
>                 }
>         }
>
> Any ideas what could cause this behaviour?
>
> snowcrash

--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Creating pop-up menu

2008-09-03 Thread Mark Murphy

jalandar wrote:
> Hi
> I am junior andriod developer.
> In my application of active note .I want to create  menu-item list of
> main menu
> e.g.
> Options-->1.New note-->a.send ,b.delete,c.exit
>   2.help
>   3.exit
> (Here Options is main menu )
> 
> when i click on Options there should be pop -up list of menu-items
> (new note,help,exit) .
> 
> plz provide  me suggetions. how to create this application.

You want an options menu, typically defined in 
Activity#onCreateOptionsMenu() on onPrepareOptionsMenu().

To create your submenu, use Menu#addSubMenu().

If you have specific questions or problems with implementing option 
menus, write back!

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
_The Busy Coder's Guide to Android Development_ Version 1.1 Published!

--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Some help with webservices?!

2008-09-03 Thread Cezar Augustus Signori

Hi all!

i still try to send/receive data from/to webservices...well, i tried
the kSoap2 (as almost of us), but all that i get is an "unknown error"
message.

After some tries, i've decided to simple send XML to the webservice
through a connection and receive the response as String to later
handle it with some XML parser. But all i can get is a bug "Does Not
Support Output" message from the URLConnection. If i use another class
such HttpUrlConnection from java.net or apache,  the "unknown error"
message comes again.

I tried things like described:

http://www.anddev.org/calling_a_web_service_from_android-t348.html
http://chitgoks.blogspot.com/2008/03/android-and-web-services.html
and other resources from this group..

Thanks in advance!
--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Activity inside TabActivity: never bound to my Service.

2008-09-03 Thread marielisacr


Hi,

I have the same problem, for some reason you can't bind a service in
an activity inside tabs.

Check this post
http://groups.google.com/group/android-developers/browse_thread/thread/b58e2487ec03c200/8c2035b4149951ee#8c2035b4149951ee
--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Bug in Bitmap.compress when used on JPEGs?

2008-09-03 Thread snowcrash

Hi there,

I think I was able to track it down.
It seems to be based on how the JPEG was saved. If it was saved using
Photoshop in 'normal' mode, it doesn't work. If it's saved using 'Save
for Web & Devices...', it works. The same applies for saving it with
GIMP, it then works flawlessly, too.
I did a 'strings ' in a terminal on the different files, and
it yielded that saving it in Photoshop/normal mode puts quite a bunch
of extra material like EXIF and additional Photoshop-metadata in the
file. This seems to make something inside Android (OpenCORE?) choke on
it.

Can anyone confirm this?

Cheers,
snowcrash

@Kim: It wasn't a timeout, but it is a good idea to set one
nevertheless. 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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Using the ItemizedOverlay and OverlayItem

2008-09-03 Thread Peter Stevenson

Chris Chiappone wrote:
> Marcel,
>
> Thanks for that seems to work as you described.  The only thing that
> doesn't seem right is the way the map draws the markers shadow.  Any
> idea on how to correct that.
>
> Thanks.
>
> On Mon, Sep 1, 2008 at 2:03 PM, marcel-182 <[EMAIL PROTECTED]> wrote:
>   
>> Hi everyone,
>>
>> I finally got this thing working. Just set the bounds of the marker to
>> be drawn and that's it!
>>
>> Sample:
>> Drawable defaultMarker =
>> getResources().getDrawable(R.drawable.map_marker_red);
>> defaultMarker.setBounds(0, 0, defaultMarker.getIntrinsicWidth(),
>> defaultMarker.getIntrinsicHeight());
>> mMapView.getOverlays().add(new DemoOverlay(defaultMarker)); //
>> DemoOverlay is of course an ItemizedOverlay
>>
>> I made a small demo showing one OverlayItem and how to handle tap-
>> events. If someone is interested:
>> http://www.marcelp.info/2008/09/01/android-itemizedoverlay-demo/
>>
>> Regards, Marcel
>>
>> 
>
>
>
>   
try changing

private GeoPoint mRandomPoint = new GeoPoint(5309691, 8851933);
to some thing like this
currentPoint = new GeoPoint((int) (-43.2973 * 100), (int) (172.5929 
* 100));
the map is draw much faster

peter



--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Background image disapearing

2008-09-03 Thread etooler

Hi All,

I have been tinkering with the Notepad V1 tutorial to try out a few
things. One thing that I did was put a background image in the linear
layout using the android:background attribute in the
notepage_list.xml
layout file. This works as expected.
When I run the application, if I click the mouse and drag it, two
things that I cannot explain happen:

1.) The background image disappears as soon as I start to drag the
mouse with the left mouse button held down (I assume this is
simulating a finger drag on a touch screen). The image comes back
when
I unclick the left mouse button.
2.) When I drag the mouse up, the list of notes scrolls down and when
I drag the mouse up, the list of notes scrolls down (this seems
counter intuitive to me).

Is there anyway to ensure that the background image is always
rendered
when scrolling? The other thing that I can't determine is what the
orange color indicates? Does this mean that the element in the UI is
selected? Is there anyway to change this colour?

 Thanks for any information people can provide.

--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: MediaPlayer and LocalSocket problem

2008-09-03 Thread Denis Rybakov
2008/9/3 3,14 <[EMAIL PROTECTED]>:
>
> I want to set LocalSocket FileDescriptor as a data source for the
> MediaPlayer. Here is my code:

Блять, опять русские

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] allocation in loop each 1s

2008-09-03 Thread barbapapaz

Hello

I have question about efficiency in loop. In my app I have loop called
with sceduler each second. In this loop I launch request with
httpclient, I must cronstruct an entity with MultipartEntity.

this procedure explain here (http://groups.google.com/group/android-
developers/browse_thread/thread/e4230ed22c196772/1284daa5723acd0c?
lnk=gst&q=MultipartEntity#1284daa5723acd0c)


ContentBody[] parts =   {new
StringBody(Float.toString(latitudeMin)),
  new 
StringBody(Float.toString(latitudeMax)),
  new 
StringBody(Float.toString(longitudeMin)),
  new 
StringBody(Float.toString(longitudeMax)),
  new 
StringBody(dateMin),
  new 
StringBody(dateMax),
  new 
StringBody(noteMin),
  new 
StringBody(categories)
};

MultipartEntity getMessagesRequestContent = new 
MultipartEntity();
getMessagesRequestContent.addPart("latitudeMin", 
parts[0]);
getMessagesRequestContent.addPart("latitudeMax", 
parts[1]);
getMessagesRequestContent.addPart("longitudeMin", 
parts[2]);
getMessagesRequestContent.addPart("longitudeMax", 
parts[3]);
getMessagesRequestContent.addPart("dateMin", parts[4]);
getMessagesRequestContent.addPart("dateMax", parts[5]);
getMessagesRequestContent.addPart("noteMin", parts[6]);
getMessagesRequestContent.addPart("categories", 
parts[7]);

In this code there are lot of "new" and the garbage collector is often
called!
MultipartEntity and StringBody objects aren't clear or erase function,
I must called new each loop!

Do you think that is no problem?
Do you think that I musn't use this new (do you have solution)?

MultipartEntity and StringBody objects are in an opensource library
(code here http://hc.apache.org/httpcomponents-client/httpmime/xref/index.html).
Do you think that I must write clear funtion to don't called new
function (and recompile)?

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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] How to transfer Image bytes from MediaStore.Image ContentProvider to byte [] array

2008-09-03 Thread Graeme

Hi

I am puzzled how best to copy a JPEG image data bytes held by the
MediaStore.Images ContentProvider to a byte []  within an Activity. I
am not certain about how the java.io
Classses fit into my scenario...

So a sketch of the code might look something like ...

import android.provider.MediaStore.Images;
import android.net.Uri;
import android.database.Cursor;




Uri extImagesUri = Images.Media.EXTERNAL_CONTENT_URI; // Images on SD
Card
// Obtain a  Cursor
Cursor cur = managedQuery(extImagesUri, null, null, null, null);
int rowIndex = cur.getColumnIndexOrThrow(Images.ImageColumns._ID);
Uri imageUri = null;
byte [] imageBytes = null;
String rowStr = null;
InputStream inStream=null;
OutputStream outStream = null;


// Iterate through cursor rows
cur.moveToFirst();
while ( cur.moveToNext()  )  {

// Get RowID
long rowID = cur.getLong( rowIndex );

// Image URI
rowStr = (new Long(rowID)).toString();
imageUri = Uri.withAppendedPath(extImagesUri, rowStr) ;

   // Now open an InputStream or OutputStream or a File ??
   
   inStream = getContentResolver().openInputStream( imageUri );
  // OR ??
   outStream = getContentResolver().openOutputStream( imageUri );
  // OR ??
ParcelFiledescriptor pFD = getContentResolver().
openFileDescriptor(imageUri, "r");
// then open a FileInputStream ??



   // transfer (copy) image content bytes  to imageBytes array
   < Please help here !!>

   // do something with imageBytes ...

}

Can someone please give me some pointers. I am rather a Java newbie
so
am notclear about which of the java.io classes to leverage.

Thanks
Graeme
--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Will android provide Mail API??

2008-09-03 Thread elvisw

I am now using some classes under the packages
com.android.email.mail  as my Mail API,
and now I can receive mail from GMail.
but have some problems to send mail using SMTP.
I dont know to use the API to create MimeMessage actually.
Anyone know about this???

my code to send mail with one text part and one attachment file is as
follows
(it works if i just send first part only, but fail if I add the second
part...)
appreciate if any ideal...


*
import com.android.email.mail.Address;
import com.android.email.mail.MessagingException;
import com.android.email.mail.Message.RecipientType;
import com.android.email.mail.internet.ByteArrayBody;
import com.android.email.mail.internet.MimeBodyPart;
import com.android.email.mail.internet.MimeMessage;
import com.android.email.mail.internet.MimeMultipart;
import com.android.email.mail.transport.SmtpTransport;



try
{
MimeMessage message = new MimeMessage();
message.setSentDate(new Date());
Address from = new Address("[EMAIL PROTECTED]");
Address[] to = new Address[]{new
Address("[EMAIL PROTECTED]")};
message.setFrom(from);
message.setRecipients(RecipientType.TO, to);
message.setSubject("This is a test...");

String text = mailText.getText().toString();

ByteArrayBody body = new ByteArrayBody(text.getBytes());
MimeMultipart rootPart = new MimeMultipart("multipart/
mixed");

MimeBodyPart part1 = new MimeBodyPart();

part1.setBody(body);

MimeBodyPart part2 = new MimeBodyPart();
File f = new File("/sdcard/mail/5424/song.mp3");
Uri uri = Uri.fromFile(f);
ContentResolver contentResolver = getContentResolver();
String contentType = contentResolver.getType(uri);

if (contentType == null) {
contentType = "";
}

String name = null;
int size = 0;

Cursor metadataCursor = contentResolver.query(
uri,
new String[]{OpenableColumns.DISPLAY_NAME,
OpenableColumns.SIZE},
null,
null,
null);
if (metadataCursor != null) {
try {
if (metadataCursor.moveToNext()) {
name = metadataCursor.getString(0);
size = metadataCursor.getInt(1);
}
} finally {
metadataCursor.close();
}
}

if (name == null) {
name = uri.getLastPathSegment();
}

Log.d("SendActivity", "contentType=" + contentType + "
name="  + name + "   size=" + size);

ByteArrayOutputStream bos = new ByteArrayOutputStream();

bos.reset();
try
{
byte[] tmp = new byte[8192];
int cnt = 0;
FileInputStream fis = new FileInputStream(f);
while( (cnt=fis.read(tmp)) != -1)
{
bos.write(tmp, 0, cnt);
}
} catch (FileNotFoundException e)
{
e.printStackTrace();
} catch (IOException e)
{
e.printStackTrace();
}

Log.d("SendActivity", new
Long(bos.toByteArray().length).toString());
Log.d("SendActivity", new
Long(Base64.encodeBase64(bos.toByteArray()).length).toString() );

ByteArrayBody body2 = new
ByteArrayBody(Base64.encodeBase64(bos.toByteArray()));
part2.setBody(body2);
part2.setHeader("Content-type", "audio/mpeg; name=" + 
name);
part2.setHeader("Content-Transfer-Encoding", "base64");

rootPart.addBodyPart(part1);
rootPart.addBodyPart(part2);
message.setBody(rootPart);

   

[android-developers] Re: getScale replacement for BaseAdapter in 0.9 beta?

2008-09-03 Thread Chris Cicc

Hey,
I appreciate the prompt reply. Unfortunately I'm having trouble making
complete sense of your instructions. I admit I'm new to Java and
Android (though I'm very experienced in C#.NET so I'm picking it up
pretty quickly).

Right now I have the following code in an activity:

Gallery gal = new Gallery(ctx);
gal.setLayoutParams(new 
LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT));
gal.setAdapter(new HomeGalImgAdapter(ctx));
gal.setHorizontalFadingEdgeEnabled(true);
gal.setSpacing(0);
gal.setClickable(true);
gal.setFocusable(true);
//  gal.setUnselectedAlpha(0.5f);
topPanel.addView(gal);

Along with this image adapter class:

public class HomeGalImgAdapter extends BaseAdapter {
private Context myContext;

private int[] myImageIds = {
R.drawable.test128_add_to_folder,
R.drawable.test128_calendar,
R.drawable.test128_chart_pie,
R.drawable.test128_clock,
R.drawable.test128_comments
};
public HomeGalImgAdapter(Context c) { this.myContext = c; }
public int getCount() { return this.myImageIds.length; }
public Object getItem(int position) { return position; }
public long getItemId(int position) { return position; }

public View getView(int position, View convertView, ViewGroup parent)
{
ImageView i = new ImageView(this.myContext);

i.setImageResource(this.myImageIds[position]);
/* Image should be scaled as width/height are set. */
i.setScaleType(ImageView.ScaleType.FIT_XY);
/* Set the Width/Height of the ImageView. */
i.setLayoutParams(new Gallery.LayoutParams(96, 96));
return i;
}
}

This works perfectly, and the gallery displays with a bunch of other
content. How do I implement your suggestion to have the not-in-focus
images be scaled smaller?

Also, I am trying to figure out how to set a TextView to act as a
caption whenever the picture changes focus, but at the moment as soon
as I start scrolling through the gallery and the first image loses
focus I am unable to get another image to take focus. Still trying to
figure that one out...

Thanks for your help!



On Sep 2, 5:10 pm, "Romain Guy" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Just override the method getChildStaticTransformation() in ViewGroup
> and for the given child, set the transformation to a smaller scale.
> Then in your constructors, make sure you set the flag
> FLAG_SUPPORT_STATIC_TRANSFORMATIONS in mGroupFlags:
>
> mGroupFlags |= FLAG_SUPPORT_STATIC_TRANSFORMATIONS;
>
>
>
> On Tue, Sep 2, 2008 at 12:47 PM, Chris Cicc <[EMAIL PROTECTED]> wrote:
>
> > Hi Romain Guy,
> > How would I go about doing this? I'd really like to enable two pieces
> > of functionality that were removed in the 0.9 Beta, a smaller scale
> > for the not-in-focus images, and the ability to automatically loop
> > (and rotate through) the gallery. Alpha on the edges would be nice,
> > but I can live without that...
>
> > Any chance we could get a code sample on what you suggest?
>
> > Thanks,
> > Chris
>
> > On Aug 29, 7:42 pm, "Romain Guy" <[EMAIL PROTECTED]> wrote:
> >> Note that you can build your own replacement by creating a subclass of
> >> a ViewGroup and enabling support for children static transformations.
>
> >> On Fri, Aug 29, 2008 at 3:50 PM, Megha Joshi <[EMAIL PROTECTED]> wrote:
> >> > The getScale() API was removed from BaseAdapter, because now theGallery
> >> > widget does not support scaling the focussed item in relation to the 
> >> > other
> >> > items.
> >> > No replacement was added. It is recommended that you don't alter the
> >> > standard behavior of theGallerywidget.
> >> > Is there any particular reason you want to do this?
>
> >> > 2008/8/29 blim <[EMAIL PROTECTED]>
>
> >> >> What should we use to replace getScale from BaseAdapter, which has
> >> >> been deHey,
I appreciate the prompt reply. Unfortunately I'm having trouble making
complete sense of your instructions. I admit I'm new to Java and
Android (though I'm very experienced in C#.NET so I'm picking it up
pretty quickly).

Right now I have the following code in an activity:

Gallery gal = new Gallery(ctx);
gal.setLayoutParams(new 
LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT));
gal.setAdapter(new HomeGalImgAdapter(ctx));
gal.setHorizontalFadingEdgeEnabled(true);
gal.setSpacing(0);
gal.setClickable(true);
gal.setFocusable(true);
//  gal.setUnselectedAlpha(0.5f);
topPanel.addView(gal);

Al

[android-developers] Re: Bug in Bitmap.compress when used on JPEGs?

2008-09-03 Thread Kim Pedersen

Maybe some of the requests are getting blocked. Try adding connect and
read timeouts by rewriting the url.openStream() to
openConnection().getInputStream():

...
URL url = uri.toURL();
URLConnection con = url.openConnection();
con.setConnectTimeout(3000);
con.setReadTimeout(3000);
Bitmap bmp = BitmapFactory.decodeStream(con.getInputStream());
...

Adjust the 3000 ms timeout values if necessary.

You can add exception handling for the connection timeouts.

Regards,

Kim

On Mon, Sep 1, 2008 at 4:36 AM, snowcrash <[EMAIL PROTECTED]> wrote:
>
> Hi there,
>
> I experience strange things when using the compress method from
> Bitmap. I'm useing the code at the bottom to download JPEGs from a
> server. Out of all images downloaded, ~10% fail to be written with a
> NullpointerException and a preceding message from something called
> 'skia'. Each image is different and it doesn't always happen for the
> same ones:
>
> 09-01 13:19:04.126: DEBUG/skia(1124): xx failure to skip
> request 9936 actual 6906
> 09-01 13:19:04.132: DEBUG/skia(1124): x jpeg
> setjump exit
> 09-01 13:19:04.132: ERROR/ImageUtil(1124):
> java.lang.NullPointerException
>
> If I use the same code on PNGs, all works like a charm.
>
> The code used is:
>
> public static String saveImageFromURI(URI uri, String name,
>final Activity ctx, Handler handler) {
>boolean success = false;
>String qualifiedName = name + ".jpg";
>FileOutputStream fos = null;
>try {
>URL url = uri.toURL();
>Bitmap bmp = 
> BitmapFactory.decodeStream(url.openStream());
>fos = ctx.openFileOutput(qualifiedName, 
> Context.MODE_PRIVATE);
>success = bmp.compress(Bitmap.CompressFormat.JPEG, 75, 
> fos);
>} catch (MalformedURLException e) {
>Log.e(TAG, e.toString(), e);
>} catch (IOException e) {
>Log.e(TAG, e.toString(), e);
>} catch (IllegalArgumentException e) {
>Log.e(TAG, e.toString());
>} catch (NullPointerException e) {
>Log.e(TAG, e.toString(), e);
>} finally {
>try {
>if (fos != null)
>fos.close();
>} catch (IOException e) {
>Log.e(TAG, e.toString(), e);
>}
>}
>if (success) {
>return qualifiedName;
>} else {
>return null;
>}
>}
>
> Any ideas what could cause this behaviour?
>
> snowcrash
>
> >
>

--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Bug in Bitmap.compress when used on JPEGs?

2008-09-03 Thread kp

Maybe some of the requests are getting blocked. Try adding connect and
read timeouts by rewriting the url.openStream() to
openConnection().getInputStream():

URL url = uri.toURL();
URLConnection con = url.openConnection();
con.setConnectTimeout(3000);
con.setReadTimeout(3000);
Bitmap bmp = BitmapFactory.decodeStream(con.getInputStream());

Adjust the 3000 ms timeout values if necessary.

You can add exception handling for the connection timeouts.

Regards,

Kim

On Sep 1, 4:36 am, snowcrash <[EMAIL PROTECTED]> wrote:
> Hi there,
>
> I experience strange things when using the compress method from
> Bitmap. I'm useing the code at the bottom to download JPEGs from a
> server. Out of all images downloaded, ~10% fail to be written with a
> NullpointerException and a preceding message from something called
> 'skia'. Each image is different and it doesn't always happen for the
> same ones:
>
> 09-01 13:19:04.126: DEBUG/skia(1124): xx failure to skip
> request 9936 actual 6906
> 09-01 13:19:04.132: DEBUG/skia(1124): x jpeg
> setjump exit
> 09-01 13:19:04.132: ERROR/ImageUtil(1124):
> java.lang.NullPointerException
>
> If I use the same code on PNGs, all works like a charm.
>
> The code used is:
>
> public static String saveImageFromURI(URI uri, String name,
>                         final Activity ctx, Handler handler) {
>                 boolean success = false;
>                 String qualifiedName = name + ".jpg";
>                 FileOutputStream fos = null;
>                 try {
>                         URL url = uri.toURL();
>                         Bitmap bmp = 
> BitmapFactory.decodeStream(url.openStream());
>                         fos = ctx.openFileOutput(qualifiedName, 
> Context.MODE_PRIVATE);
>                         success = bmp.compress(Bitmap.CompressFormat.JPEG, 
> 75, fos);
>                 } catch (MalformedURLException e) {
>                         Log.e(TAG, e.toString(), e);
>                 } catch (IOException e) {
>                         Log.e(TAG, e.toString(), e);
>                 } catch (IllegalArgumentException e) {
>                         Log.e(TAG, e.toString());
>                 } catch (NullPointerException e) {
>                         Log.e(TAG, e.toString(), e);
>                 } finally {
>                         try {
>                                 if (fos != null)
>                                         fos.close();
>                         } catch (IOException e) {
>                                 Log.e(TAG, e.toString(), e);
>                         }
>                 }
>                 if (success) {
>                         return qualifiedName;
>                 } else {
>                         return null;
>                 }
>         }
>
> Any ideas what could cause this behaviour?
>
> snowcrash

--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Orientation changes simulation

2008-09-03 Thread Andrew Stadler

Just to clarify things a bit, two different forms of orientation are
being discussed here.

The orientation changes that are triggered by emulator keys are
"gross" orientation of the device itself - primarily, is the screen in
portrait or landscape mode.  Because the screen will be laid out
differently for portrait vs. landscape orientations, this has direct
impact on the view system and your activities.  See

for more information.

Finer-grained orientation changes, such as those that might come from
sensors such as an accelerometer, and do not immediately impact the
view system, are provided via the android.hardware.SensorManager and
android.hardware.SensorListener classes.

It is helpful to clarify which type you're interested in, as the
answers are quite different.

--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] MediaPlayer and LocalSocket problem

2008-09-03 Thread 3,14

I want to set LocalSocket FileDescriptor as a data source for the
MediaPlayer. Here is my code:

public class sipActivity extends Activity {
public static final String S_ADDR = "test.server";

public class Server implements Runnable {
public LocalSocket receiver = null;

public void run() {
try {
LocalServerSocket server = new LocalServerSocket 
(S_ADDR);
while (receiver == null) {
receiver = server.accept();
}
} catch (Exception e) {
Log.e("me", "ooops", e);
}
}
}

public class MediaWriter implements Runnable {
public LocalSocket sender = null;

public void run() {
try {
sender = new LocalSocket();
sender.connect(new LocalSocketAddress(S_ADDR));
FileInputStream media = new 
FileInputStream("/system/media/
audio/alarms/Alarm_Classic.ogg");
int readed;
byte [] b = new byte [1024];
do {
readed = media.read(b);
if (readed > 0) {
sender.getOutputStream().write(b, 0, 
readed);
}
} while (readed > -1);
} catch (Exception e) {
Log.e("me", "ooops", e);
}
}
}

/** Called when the activity is first created. */
@Override

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

try {
Server mServer = new Server ();
new Thread (mServer).start();
MediaWriter mMedia = new MediaWriter ();
new Thread (mMedia).start();
while (mServer.receiver == null) {
Thread.sleep(10);
}
MediaPlayer mMediaPlayer = new MediaPlayer();
mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
 
mMediaPlayer.setDataSource(mServer.receiver.getFileDescriptor());
mMediaPlayer.prepare();
mMediaPlayer.start();
} catch(Exception e) {
Log.e("me", "ooops", e);
}
}
}

But I got an exception on the line:
mMediaPlayer.setDataSource(mServer.receiver.getFileDescriptor());

The error is following:
java.io.IOException: setDataSourceFD failed: status=0x8000
  at android.Media.MediaPlayer.setDataSource(Native Method)
  at android.Media.MediaPlayer.setDataSource(MediaPlayer.java:251)
  ...

--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---