[android-developers] Re: General lag issues with real-time games

2010-03-13 Thread Bob Kerns
There's nothing in what you describe to suggest it's the GC in other
processes.

GC is just a component of what happens in a process -- and it's always
a side-effect of the process doing other things.

You're probably right in that it's other processes, but wrong to pin
it specifically on the GC.

It's possible, however, for the GC to happen in a bigger chunk than
the series of short executions that eventually trigger it. So the GC
may contribute to the minimum size of a lag. Even then, it's not
useful to focus on GC as the cause, as neither you nor your users have
any control over the GC behavior of someone else's application.

On Mar 13, 7:44 pm, markusn82  wrote:
> I developed and published a game about two months ago. Since then,
> I've received several negative comments about input lag in the game.
> Before releasing the game, I already took several measures to
> hopefully prevent lag from occurring:
>
> 1) Game is almost entirely written in native code
> 2) After initialization, my process never invokes the GC during
> gameplay (no GC executions from my process show up in the log)
> 3) Average FPS is generally > 30 fps
> 4) I tested the game on both a Motorola Milestone and an HTC Magic and
> I don't experience any noticeable input lag (except perhaps when the
> GC is executed by other processes)
>
> My guess is that the lag that users are experiencing is a result of
> the GC being invoked by another process. Has anyone been able to
> address this issue? Specifically, have any game developers been able
> to achieve a completely lag-free game and thus avoid negative ratings
> that drag down your app?
>
> The only other suspicious thing I've noticed is the following lines
> showing up in my log any time a SoundPool clip is played:
>
> D/AudioHardwareMot( 1054): AudioMgr:AudioStreamOutMot::standby called
> D/AudioHardwareMot( 1054): AudioMgr:Output 0xb538 entering standby
> D/AudioHardwareMot( 1054): AudioMgr:Closing stereo device
> D/AudioHardwareMot( 1054): AudioMgr:Output 0xb538 exiting standby
>
> Any ideas or suggestions?
>
> Thanks

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


[android-developers] Re: NoClassDefFoundError for gdata CalendarService class

2010-03-13 Thread Bob Kerns
Yes. The reason I do copy them (and recommend copying them) to a lib/
directory is twofold:

1) It makes them an explicit part of your project for versioning. If
you use Subversion you can make these be a copy from a directory of
third-party components. You could copy the third-party directory for
tagging as well as your project, but this makes the dependency more
apparent.

2) It's compatible with how the ant build scripts are set up out-of-
the-box, so it makes it easier to transition to an ant-based
production build.

But as you note, Eclipse doesn't really care.

On Mar 13, 9:14 pm, Kumar Bibek  wrote:
> It doesn't really matter if you create a lib folder and put the jars
> and link them. It just works if you have added the jars the the build
> path. Though I am not able to figure out why you are getting this
> error.

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


Re: [android-developers] Get item selected from spinner

2010-03-13 Thread TreKing
On Sat, Mar 13, 2010 at 11:07 PM, murali raju  wrote:

> use spinner.setOnItemClickListener(new OnItemClickListener()
>

No, this won't work, read the documentation: "A spinner does not support
item click events."
You want setOnItemSelectedListener().

On Sat, Mar 13, 2010 at 11:51 PM, Nitesh Mehta  wrote:

> Well i already know how to get the item and which index. My problem is that
> the index is same irrespective of what was selected in spinner 1. How do i
> know whether spinner 1 was selected or spinner 2?


Read the documentation:

http://developer.android.com/intl/de/reference/android/widget/AdapterView.OnItemSelectedListener.html#onItemSelected(android.widget.AdapterView,
android.view.View, int, long)

The first parameter is the AdapterView that triggered the listener, in your
case this would be the Spinner.
Or you could also set a different listener on each spinner ..

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

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

[android-developers] Re: General lag issues with real-time games

2010-03-13 Thread Robert Green
Markus,

You'd be surprised by how much stuff people have running on their
phones.  2.0/2.1 seem to be better at handling it with a game but in
general, I think it's an issue of educating people to shut off sync
and certain wasteful tasks while playing games.  I REALLY wish Android
would add a game-mode as a core feature of the OS, which suspends all
but essential functionality (maybe user selectable, such as take phone
calls, get SMS and optional email, other services, etc).  Then a game
declares itself as such in the manifest and the OS knows to give it
better priority and stop other things from lagging it out.

I find that when I shut off sync and kill most everything running, my
games run smooth, but even on my nexus one if I fail to do all of
that, I get lag.

On Mar 13, 9:44 pm, markusn82  wrote:
> I developed and published a game about two months ago. Since then,
> I've received several negative comments about input lag in the game.
> Before releasing the game, I already took several measures to
> hopefully prevent lag from occurring:
>
> 1) Game is almost entirely written in native code
> 2) After initialization, my process never invokes the GC during
> gameplay (no GC executions from my process show up in the log)
> 3) Average FPS is generally > 30 fps
> 4) I tested the game on both a Motorola Milestone and an HTC Magic and
> I don't experience any noticeable input lag (except perhaps when the
> GC is executed by other processes)
>
> My guess is that the lag that users are experiencing is a result of
> the GC being invoked by another process. Has anyone been able to
> address this issue? Specifically, have any game developers been able
> to achieve a completely lag-free game and thus avoid negative ratings
> that drag down your app?
>
> The only other suspicious thing I've noticed is the following lines
> showing up in my log any time a SoundPool clip is played:
>
> D/AudioHardwareMot( 1054): AudioMgr:AudioStreamOutMot::standby called
> D/AudioHardwareMot( 1054): AudioMgr:Output 0xb538 entering standby
> D/AudioHardwareMot( 1054): AudioMgr:Closing stereo device
> D/AudioHardwareMot( 1054): AudioMgr:Output 0xb538 exiting standby
>
> Any ideas or suggestions?
>
> Thanks

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


Re: [android-developers] Get item selected from spinner

2010-03-13 Thread Nitesh Mehta
Well i already know how to get the item and which index. My problem is that
the index is same irrespective of what was selected in spinner 1. How do i
know whether spinner 1 was selected or spinner 2?

Thanks!

On Sat, Mar 13, 2010 at 10:07 PM, murali raju  wrote:

> Hi,
>
> use spinner.setOnItemClickListener(new OnItemClickListener() {
>
> public void onItemClick(AdapterView parent, View v, int
> position,
> long id) {
>
> }
> });
>
>   here the argument position gives the selected item in the
> spinner.
>
>
>
> On Fri, Mar 12, 2010 at 9:43 AM, Nitesh  wrote:
>
>> Hi all,
>>
>> I am a newbie coder and new to the SDK. I was just playing around with
>> an app that i made. I wanted to know as to how to retrieve the item id
>> of the selected item from the spinner when the spinner is re-
>> populated.
>>
>> For example,
>> I created 2 spinners, if you selected item 0 from spinner1 then
>> spinner2 will have a bunch of items and if you selected item 1 from
>> spinner1 then spinner2 will have a different set of items. Now, my
>> question is that when i select item 1 from spinner 1 then the items in
>> spinner2 dont have different ids. So how do i differentiate from the
>> two sets of data?
>>
>> To illustrate,
>>
>> User selected item 0 in spinner1 -> spinner2 gets data from array1 ->
>> item 0 in spinner2 has id '0' and item text is "apple"
>>
>> User selected item 1 in spinner1 -> spinner2 gets data from array2 ->
>> item 0 in spinner2 has id '0' and item text is "oranges"
>>
>> I know this sounds confusing but i hope the right people understood
>> it..
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to android-developers@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-developers+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Sincerely,
Nitesh Mehta

Growing old is mandatory. Growing up? Definitely optional.

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

[android-developers] Re: NoClassDefFoundError for gdata CalendarService class

2010-03-13 Thread Kumar Bibek
It doesn't really matter if you create a lib folder and put the jars
and link them. It just works if you have added the jars the the build
path. Though I am not able to figure out why you are getting this
error.

> But I *highly* recommend not using Eclipse for your production builds,
> but rather have a build script that handles checkout, version
> numbering, naming the resulting builds, etc.

Well, as far as developing with Eclipse is concerned, I would say that
eclipse is the best and the only IDE available for Android. You can
also try Motodev Studio, but that's almost similar to eclipse.
Learning Android command line tools is great, but eclipse does make
your development and publishing task a lot easier.

Thanks and Regards,
Kumar Bibek

On Mar 14, 8:54 am, Bob Kerns  wrote:
> What I do is to create a libs/ directory in Eclipse, and add them to
> the Eclipse build path.  Android Tools/Export Signed Application
> Properties works fine.
>
> But I *highly* recommend not using Eclipse for your production builds,
> but rather have a build script that handles checkout, version
> numbering, naming the resulting builds, etc. A disciplined build
> process greatly reduces the possibility of confusion and mistakes
> making it into customer's hands.
>
> Unforutnately, the way Eclipse does things, that means two different
> build methodologies; one for debugging, one for production.
> Fortunately, the Eclipse side of that is generally pretty painless,
> and the 'android' command gives you a leg up on an ant script for the
> production builds.
>
> But as to your problem. If you have a 3rd party jar file which is
> working fine, and it's set up the same way, then the way it's set up
> isn't really the problem. You need to find out what the problem is.
>
> NoClassDefFoundError does not mean what you think it means. Reading
> the name, you'd think it means what ClassNotFoundException means.
>
> No, what it means is that while LOADING a class, and probably while
> actually running the static initializers of a class, an exception was
> encountered. If that happens, you don't get a reference to the class,
> and NoClassDefFoundError is thrown.
>
> Unfortunately, you don't get told what the problem was. So you have to
> use the debugger to figure it out. Set an exception breakpoint on
> NoClassDefFoundError, and ones for Exception and Error, and run your
> code. This should expose what the original problem was.
>
> I can never understand why NoClassDefFoundError doesn't include the
> original cause -- it really makes such problems a lot more obscure
> than they need to be.
>
> On Mar 13, 4:00 pm, Tom  wrote:
>
> > I created the libs directory where you specified and copied the
> > gdata .jar files in there, then from Eclipse ran "Export" project,
> > then installed on the phone - but with the same result -
> > NoClassDefFoundError for CalendarService.
>
> > It seems that Eclipse is "silently" failing to handle the gdata jar
> > files somehow - my project contains another 3rd party jar file which
> > appears to work just fine.
>
> > Something tells me that I have to stop relying on Eclipse and actually
> > learn how to use the Android SDK command-line tools... I knew it
> > wouldn't be this easy. ;-)
>
> > Thanks for all of your help.
>
> > On Mar 13, 3:24 pm, Mark Murphy  wrote:
>
> > > Tom wrote:
> > > >>> This code compiles with no errors, using Eclipse on MacOS, using
> > > >>> external jar files from the Google gdata project:
> > > >>> gdata/java/lib/gdata-calendar-2.0.jar
> > > >>> gdata/java/lib/gdata-calendar-meta-2.0.jar
> > > >> Did you copy these into your project's libs/ directory?
>
> > > > No, I merely specified the path to the external jar in the Eclipse
> > > > "Java build path" libraries dialog. This seemed to work for other
> > > > projects I've developed. I look in my Eclipse project workspace and
> > > > see assets, bin, gen, res, and src directories but no libs. Where
> > > > should that directory appear?
>
> > > As a peer to assets/, bin/, gen/, res/, and src/.
>
> > > Now, it is conceivable that Eclipse handles things differently. I don't
> > > use Eclipse, and from the command line, just dropping the dependent JARs
> > > in libs/ is all you need. My recommendation to my students is that they
> > > put their dependent JARs in libs/ plus add them to the Eclipse build path.
>
> > > --
> > > Mark Murphy (a Commons 
> > > Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> > > Warescription: Three Android Books, Plus Updates, One Low Price!

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


Re: [android-developers] Re: Custom Spinner

2010-03-13 Thread murali raju
Hi,

   Thanks for your reply. I need a spinner, which when clicked I get a drop
down view
which do not cover the entire width of the screen.

   In my application i display all the items of the sdcard in table
layout. I have a spinner on top of my application with some options. So when
i click the spinner, i get a drop down, which covers the entire width of
screen, and so i cant see any items of sdcard. But i want to see the items
on the layout.

   How can i do that?

thanks in advance.

On Thu, Mar 11, 2010 at 11:43 AM, Kumar Bibek  wrote:

> It is possible. But we need to know first what your requirements are.
> You can fully customize any widget.
>
> Thanks and Regards,
> Kumar Bibek.
>
> On Mar 9, 6:42 pm, mmkr  wrote:
> > Hi all,
> >
> > The default drop down view of the spinner occupies the entire
> > width of the screen. I tried to create a custom spinner which occupies
> > only some portion of the width of the screen, but I'm unable to do. I
> > want to see the objects behind the drop down. Here is what i tried, I
> > changed the drop down view as,
> >
> > adapter.setDropDownViewResource(R.layout.simple_spinner_dropdown_item);
> > instead of
> >
> >
> adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
> >
> >  In the layout.simple_spinner_dropdown_item.xml file I specified the
> > width, but it still occupies the entire width. Can any one help. Is
> > there any other view which is similar to spinner but I should be able
> > to see the background objects like a alert dialog. Is it really
> > possible? Please reply.
> >
> > Thank you.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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

Re: [android-developers] Get item selected from spinner

2010-03-13 Thread murali raju
Hi,

use spinner.setOnItemClickListener(new OnItemClickListener() {

public void onItemClick(AdapterView parent, View v, int
position,
long id) {

}
});

  here the argument position gives the selected item in the
spinner.


On Fri, Mar 12, 2010 at 9:43 AM, Nitesh  wrote:

> Hi all,
>
> I am a newbie coder and new to the SDK. I was just playing around with
> an app that i made. I wanted to know as to how to retrieve the item id
> of the selected item from the spinner when the spinner is re-
> populated.
>
> For example,
> I created 2 spinners, if you selected item 0 from spinner1 then
> spinner2 will have a bunch of items and if you selected item 1 from
> spinner1 then spinner2 will have a different set of items. Now, my
> question is that when i select item 1 from spinner 1 then the items in
> spinner2 dont have different ids. So how do i differentiate from the
> two sets of data?
>
> To illustrate,
>
> User selected item 0 in spinner1 -> spinner2 gets data from array1 ->
> item 0 in spinner2 has id '0' and item text is "apple"
>
> User selected item 1 in spinner1 -> spinner2 gets data from array2 ->
> item 0 in spinner2 has id '0' and item text is "oranges"
>
> I know this sounds confusing but i hope the right people understood
> it..
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

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

[android-developers] Re: How can i call one activity to other activity without using intents and services

2010-03-13 Thread Kumar Bibek
Why would you want to do it? Intents are the best and the only way to
achieve this. Are you having problems with the Intent mechanism?

Thanks and Regards,
Kumar Bibek

On Mar 14, 9:57 am, murali raju  wrote:
> Hi satish,
>
> It is not possible..
>
> On Fri, Mar 12, 2010 at 1:31 PM, satish k  wrote:
>
> > On Fri, Mar 12, 2010 at 1:30 PM, satish k  wrote:
>
> >> Hi All,
>
> >> How can i call one activity to other activity without using intents and
> >> services
>
> >> is there any solution for this
>
> >> please help me
>
> >> cheers,
> >> k.satish
>
> >  --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en

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


Re: [android-developers] How can i call one activity to other activity without using intents and services

2010-03-13 Thread murali raju
Hi satish,

It is not possible..

On Fri, Mar 12, 2010 at 1:31 PM, satish k  wrote:

>
>
> On Fri, Mar 12, 2010 at 1:30 PM, satish k  wrote:
>
>> Hi All,
>>
>>
>>
>> How can i call one activity to other activity without using intents and
>> services
>>
>> is there any solution for this
>>
>> please help me
>>
>>
>> cheers,
>> k.satish
>>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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

Re: [android-developers] showing media volume controller

2010-03-13 Thread murali raju
Hi,

   We have to create our view for volume control. i dont think we can
display the android media player volume screen.

On Sat, Mar 13, 2010 at 3:24 PM, kavitha  wrote:

> Hi All,
>
> how to show media volume controller on my screen in android?
>
> Thanks
> kavitha
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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

Re: [android-developers] Re: Custom Spinner

2010-03-13 Thread murali raju
Hi Bob,

 Even i gave up on that. Finally i created a custom layout which
displays the list of items( the items which i want to display in the spinner
), in a listview, at any position on the screen.

 We can create a listview with any height and width, using
LayoutParams , my requirement is fulfilled, but not the way i intended to
do. Instead of using a spinner drop down view we can use a list view to
display the items, which looks like a customized spinner drop down.


On Thu, Mar 11, 2010 at 2:58 PM, Bob Kerns  wrote:

> I was trying to do the same thing about 24 hours ago. I finally gave
> up, and made what I wanted to coexist with the Spinner be part of the
> view inside the spinner.
>
> I could find no combination of things that allowed the layout to both
> size the text to the left, and left-align the text within the spinner.
> The items within the spinner are created disconnected from the view
> hierarchy, and so they don't have any interaction with the parent's
> layout at that point, and I couldn't figure out any way to inject the
> proper interaction when they do come together.
>
> On Mar 9, 5:42 am, mmkr  wrote:
> > Hi all,
> >
> > The default drop down view of the spinner occupies the entire
> > width of the screen. I tried to create a custom spinner which occupies
> > only some portion of the width of the screen, but I'm unable to do. I
> > want to see the objects behind the drop down. Here is what i tried, I
> > changed the drop down view as,
> >
> > adapter.setDropDownViewResource(R.layout.simple_spinner_dropdown_item);
> > instead of
> >
> >
> adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_it
> em);
> >
> >  In the layout.simple_spinner_dropdown_item.xml file I specified the
> > width, but it still occupies the entire width. Can any one help. Is
> > there any other view which is similar to spinner but I should be able
> > to see the background objects like a alert dialog. Is it really
> > possible? Please reply.
> >
> > Thank you.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

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

Re: [android-developers] Re: Custom Spinner

2010-03-13 Thread murali raju
Hi,

   Thanks for your reply. I need a spinner, which when clicked I get a drop
down view
which do not cover the entire width of the screen.

   In my application i display all the items of the sdcard in table
layout. I have a spinner on top of my application with some options. So when
i click the spinner, i get a drop down, which covers the entire width of
screen, and so i cant see any items of sdcard. But i want to see the items
on the layout.

   How can i do that?

thanks in advance.


On Thu, Mar 11, 2010 at 11:43 AM, Kumar Bibek  wrote:

> It is possible. But we need to know first what your requirements are.
> You can fully customize any widget.
>
> Thanks and Regards,
> Kumar Bibek.
>
> On Mar 9, 6:42 pm, mmkr  wrote:
> > Hi all,
> >
> > The default drop down view of the spinner occupies the entire
> > width of the screen. I tried to create a custom spinner which occupies
> > only some portion of the width of the screen, but I'm unable to do. I
> > want to see the objects behind the drop down. Here is what i tried, I
> > changed the drop down view as,
> >
> > adapter.setDropDownViewResource(R.layout.simple_spinner_dropdown_item);
> > instead of
> >
> >
> adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
> >
> >  In the layout.simple_spinner_dropdown_item.xml file I specified the
> > width, but it still occupies the entire width. Can any one help. Is
> > there any other view which is similar to spinner but I should be able
> > to see the background objects like a alert dialog. Is it really
> > possible? Please reply.
> >
> > Thank you.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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

[android-developers] Re: NoClassDefFoundError for gdata CalendarService class

2010-03-13 Thread Bob Kerns
What I do is to create a libs/ directory in Eclipse, and add them to
the Eclipse build path.  Android Tools/Export Signed Application
Properties works fine.

But I *highly* recommend not using Eclipse for your production builds,
but rather have a build script that handles checkout, version
numbering, naming the resulting builds, etc. A disciplined build
process greatly reduces the possibility of confusion and mistakes
making it into customer's hands.

Unforutnately, the way Eclipse does things, that means two different
build methodologies; one for debugging, one for production.
Fortunately, the Eclipse side of that is generally pretty painless,
and the 'android' command gives you a leg up on an ant script for the
production builds.

But as to your problem. If you have a 3rd party jar file which is
working fine, and it's set up the same way, then the way it's set up
isn't really the problem. You need to find out what the problem is.

NoClassDefFoundError does not mean what you think it means. Reading
the name, you'd think it means what ClassNotFoundException means.

No, what it means is that while LOADING a class, and probably while
actually running the static initializers of a class, an exception was
encountered. If that happens, you don't get a reference to the class,
and NoClassDefFoundError is thrown.

Unfortunately, you don't get told what the problem was. So you have to
use the debugger to figure it out. Set an exception breakpoint on
NoClassDefFoundError, and ones for Exception and Error, and run your
code. This should expose what the original problem was.

I can never understand why NoClassDefFoundError doesn't include the
original cause -- it really makes such problems a lot more obscure
than they need to be.

On Mar 13, 4:00 pm, Tom  wrote:
> I created the libs directory where you specified and copied the
> gdata .jar files in there, then from Eclipse ran "Export" project,
> then installed on the phone - but with the same result -
> NoClassDefFoundError for CalendarService.
>
> It seems that Eclipse is "silently" failing to handle the gdata jar
> files somehow - my project contains another 3rd party jar file which
> appears to work just fine.
>
> Something tells me that I have to stop relying on Eclipse and actually
> learn how to use the Android SDK command-line tools... I knew it
> wouldn't be this easy. ;-)
>
> Thanks for all of your help.
>
> On Mar 13, 3:24 pm, Mark Murphy  wrote:
>
>
>
> > Tom wrote:
> > >>> This code compiles with no errors, using Eclipse on MacOS, using
> > >>> external jar files from the Google gdata project:
> > >>> gdata/java/lib/gdata-calendar-2.0.jar
> > >>> gdata/java/lib/gdata-calendar-meta-2.0.jar
> > >> Did you copy these into your project's libs/ directory?
>
> > > No, I merely specified the path to the external jar in the Eclipse
> > > "Java build path" libraries dialog. This seemed to work for other
> > > projects I've developed. I look in my Eclipse project workspace and
> > > see assets, bin, gen, res, and src directories but no libs. Where
> > > should that directory appear?
>
> > As a peer to assets/, bin/, gen/, res/, and src/.
>
> > Now, it is conceivable that Eclipse handles things differently. I don't
> > use Eclipse, and from the command line, just dropping the dependent JARs
> > in libs/ is all you need. My recommendation to my students is that they
> > put their dependent JARs in libs/ plus add them to the Eclipse build path.
>
> > --
> > Mark Murphy (a Commons 
> > Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> > Warescription: Three Android Books, Plus Updates, One Low Price!

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


[android-developers] General lag issues with real-time games

2010-03-13 Thread markusn82
I developed and published a game about two months ago. Since then,
I've received several negative comments about input lag in the game.
Before releasing the game, I already took several measures to
hopefully prevent lag from occurring:

1) Game is almost entirely written in native code
2) After initialization, my process never invokes the GC during
gameplay (no GC executions from my process show up in the log)
3) Average FPS is generally > 30 fps
4) I tested the game on both a Motorola Milestone and an HTC Magic and
I don't experience any noticeable input lag (except perhaps when the
GC is executed by other processes)

My guess is that the lag that users are experiencing is a result of
the GC being invoked by another process. Has anyone been able to
address this issue? Specifically, have any game developers been able
to achieve a completely lag-free game and thus avoid negative ratings
that drag down your app?

The only other suspicious thing I've noticed is the following lines
showing up in my log any time a SoundPool clip is played:

D/AudioHardwareMot( 1054): AudioMgr:AudioStreamOutMot::standby called
D/AudioHardwareMot( 1054): AudioMgr:Output 0xb538 entering standby
D/AudioHardwareMot( 1054): AudioMgr:Closing stereo device
D/AudioHardwareMot( 1054): AudioMgr:Output 0xb538 exiting standby

Any ideas or suggestions?

Thanks

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


[android-developers] Re: Issues with Listener, "back" button, and onDestroy().

2010-03-13 Thread Bob Kerns
Yes, it's quite possible to create the same situation with your own
listeners as with listeners passed to Android.

All that's required is that 1) you hang onto the listener somewhere
that isn't itself GC'd, and 2) it points to your Activity (which may
be implicit, for a non-static nested class).

You COULD analyze the situation closely. Or, you could simply arrange
to unregister your own listeners. Personally, I would take AT LEAST
the second option, and probably the first as well if I were designing
a library.

You don't ideally want to actually make your app's process disappear
on the Back button in most cases. It slows down the interface. You
want to leave memory management to the OS.

On Mar 13, 6:31 pm, AuxOne  wrote:
> This whole "static context" thing has me worried. Now I'm wondering
> what loose end is left that is causing this behavior. I'm not
> registering any Android listeners but perhaps my own listeners are
> holding it up. It seems to me that whatever state the application is
> in when the phone first starts, is where I'd like mine to be when the
> back button is pressed... because it works great on the first launch.
>
> What is the difference between the BACK button being pressed versus
> Android killing your app from low memory? I'm asking because one
> solution I've found is to override the behavior of the BACK button so
> it acts like the HOME button, which makes sense in the context of my
> application. The only problem is if the app is killed by the OS (and
> if that behavior is the same as the BACK button) then my app will have
> the same problems when it's relaunched. Otherwise, that's the solution
> I'm going with.
>
> Thanks
>
> On Mar 13, 2:13 pm, Mark Murphy  wrote:
>
>
>
> > AuxOne wrote:
> > > I've chosen singletonInstance in hopes of avoiding the problem I have
> > > now. It just seems to me from a memory perspective it could be better
> > > to have less instances of the application in memory, but based on your
> > > response I will remove it.
>
> > Android handles cleaning up destroyed activities for you automatically,
> > so long as you're not holding onto them from a static context, which is
> > where an unregistered LocationListener will get you in trouble.
>
> > --
> > Mark Murphy (a Commons 
> > Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> > Android Training...At Your Office:http://commonsware.com/training

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


[android-developers] Re: Call processing

2010-03-13 Thread songs
It actually depends on how it's called.  There's a sequential version
and a non-sequential version.  Calls use the sequential version.  The
priority attribute is referenced in the documentation specifically for
call processing.  I figured out how to do what I need to do, but it
was a little inobvious relative to the documentation and the examples
that are all over the web.

On Mar 11, 4:20 am, James Wang  wrote:
> I do not believe Android  call BroadcastReceiver.onReceive
> synchronously.

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


[android-developers] Re: Issues with Listener, "back" button, and onDestroy().

2010-03-13 Thread AuxOne
This whole "static context" thing has me worried. Now I'm wondering
what loose end is left that is causing this behavior. I'm not
registering any Android listeners but perhaps my own listeners are
holding it up. It seems to me that whatever state the application is
in when the phone first starts, is where I'd like mine to be when the
back button is pressed... because it works great on the first launch.

What is the difference between the BACK button being pressed versus
Android killing your app from low memory? I'm asking because one
solution I've found is to override the behavior of the BACK button so
it acts like the HOME button, which makes sense in the context of my
application. The only problem is if the app is killed by the OS (and
if that behavior is the same as the BACK button) then my app will have
the same problems when it's relaunched. Otherwise, that's the solution
I'm going with.

Thanks

On Mar 13, 2:13 pm, Mark Murphy  wrote:
> AuxOne wrote:
> > I've chosen singletonInstance in hopes of avoiding the problem I have
> > now. It just seems to me from a memory perspective it could be better
> > to have less instances of the application in memory, but based on your
> > response I will remove it.
>
> Android handles cleaning up destroyed activities for you automatically,
> so long as you're not holding onto them from a static context, which is
> where an unregistered LocationListener will get you in trouble.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Android Training...At Your Office:http://commonsware.com/training

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


Re: [android-developers] Re: Asynctask threads never end!

2010-03-13 Thread Mark Murphy
Ken Warner wrote:
> Is AsyncTask a part of the Android SDK?

Yes. android.os.AsyncTask arrived in Android 1.5.

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

_The Busy Coder's Guide to *Advanced* Android Development_
Version 1.3 Available!

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


Re: [android-developers] Re: Asynctask threads never end!

2010-03-13 Thread Ken Warner

I'm not trying to argue -- but I've seen dead threads (zombies) hang
around for a long time.  Null all possible references in your code
*AFTER* you are done with the thread and do an explicit gc().  I didn't
say that nulling a reference would kill the thread.  It only helps
garbage collection.

The flag (or semaphore) I'm talking about is going to be app specific.
Many times I will start a thread that will run for a while in a loop.
For my apps, I do while(!KILL){} loop then set the KILL flag true when
I want the thread to exit the loop and finish.  And I certainly do
know first hand about deadlock and how hard it is to find where and
why and how to fix.

I understand now that AsyncTask is not a thread -- I didn't before.
So the programming tricks for threads I suggested don't apply here.
A group of managed threads is a whole different deal.

I've never used AsyncTask.  I don't even know if it's in the JDK
because I've never looked for it.  I usually manage my own threads.

Is AsyncTask a part of the Android SDK?

Bob Kerns wrote:

What evidence do you have of this? What exactly do you mean by a
zombie thread?

I've been programming Java since sometime near when it came out --
well over a decade, on various platforms. I've never seen anything I'd
term a zombie thread, nor a thread problem that would be solved by
nulling thread references to null.

I hesitate to say you're incorrect without more specifics, however.

I'm not sure what sort of exit flag you're suggesting. One that
indicates a thread has exited, or one that indicates it should exit?

I'll add that it's certainly possible in Java to write a program that
leaves a thread blocked forever, waiting for something that never
happens. You can also introduce deadlocks -- when two thread each lock
an object, and then try to get a lock on the object locked by the
other.

But this is an issue with ANY thread programming, not Java, and is not
something I'd term zombie threads, nor a Java problem.

Coordinating threads properly is tricky. That's one reason why
AsyncTask is provided, so that you don't have to worry about how to do
it correctly and safely.

BTW, nulling out references to a thread isn't going to make the thread
stop running. In fact, the thread's stack is one of the things that
the GC has to trace through.to find things to keep. The GC cannot just
eliminate the running thread during its run -- and at any point, the
thread's code could ask for the current thread.

Still, I'm not arguing against nulling out the references once you no
longer need them. It documents where you no longer expect to reference
them, and it forces any references after that point to get a
NullPointerException, which will allow you to detect bugs closer to
the point of origin (or worse, detect bugs that might not be noticed).

On Mar 13, 9:44 am, Ken Warner  wrote:

Null out all references to the thread.  Java has a problem
with zombie threads -- this is a java app right?

I can't say exactly how you should do the following but make
sure there is an explicit way to exit each thread. I usually
set a flag to tell the thread to exit.

Those two things -- null all references and setting an explicit
exit flag are the most you can do.

After you null all references to the thread, do an explicit
gc() if that's available.



Gabriel Sim es wrote:

Hello,
Today, while debugging and app that uses AsyncTask to record audio and
update UI I noticed that everytime that an AsyncTask object ends
running (finishes doInBackground() and onPostExecute() or
onCancelled()) it s thread stays alive (running status).
At least for me that should not be the behavior of the class since the
doInBackground task may not stay running forever (as an example the
android manual says that a status bar should be updated by an
asynctask, and it won t last for the whole app running time).
Is there anything I m missing, as a method to destroy it, or should I
just ignore and keep creating threads as I need and the VM will handle
them as it needs resources?
Thank you,
Gabriel Sim es




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


[android-developers] Android google calendar client application?

2010-03-13 Thread Tom
Does anyone one know of an example that shows how to add a new Google
calendar entry? I am trying to add an entry to the Google web
calendar  (not to the phone's calendar). I assumed that I could simply
use the google gdata client APIs described at
http://code.google.com/apis/gdata/articles/java_client_lib.html - but
I am having a devil of time getting this to work. Despite building my
application with the gdata-calendar-2.0.jar downloaded from google,
the DVM in both emulator and phone is unable to find the relevant
classes, i.e. the application throws NoClassDefFoundError.

Several hours of searching the web does not reveal any obvious
application example - does anyone know of such an example?

Thanks,
Tom

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


[android-developers] Re: Asynctask threads never end!

2010-03-13 Thread Bob Kerns
What evidence do you have of this? What exactly do you mean by a
zombie thread?

I've been programming Java since sometime near when it came out --
well over a decade, on various platforms. I've never seen anything I'd
term a zombie thread, nor a thread problem that would be solved by
nulling thread references to null.

I hesitate to say you're incorrect without more specifics, however.

I'm not sure what sort of exit flag you're suggesting. One that
indicates a thread has exited, or one that indicates it should exit?

I'll add that it's certainly possible in Java to write a program that
leaves a thread blocked forever, waiting for something that never
happens. You can also introduce deadlocks -- when two thread each lock
an object, and then try to get a lock on the object locked by the
other.

But this is an issue with ANY thread programming, not Java, and is not
something I'd term zombie threads, nor a Java problem.

Coordinating threads properly is tricky. That's one reason why
AsyncTask is provided, so that you don't have to worry about how to do
it correctly and safely.

BTW, nulling out references to a thread isn't going to make the thread
stop running. In fact, the thread's stack is one of the things that
the GC has to trace through.to find things to keep. The GC cannot just
eliminate the running thread during its run -- and at any point, the
thread's code could ask for the current thread.

Still, I'm not arguing against nulling out the references once you no
longer need them. It documents where you no longer expect to reference
them, and it forces any references after that point to get a
NullPointerException, which will allow you to detect bugs closer to
the point of origin (or worse, detect bugs that might not be noticed).

On Mar 13, 9:44 am, Ken Warner  wrote:
> Null out all references to the thread.  Java has a problem
> with zombie threads -- this is a java app right?
>
> I can't say exactly how you should do the following but make
> sure there is an explicit way to exit each thread. I usually
> set a flag to tell the thread to exit.
>
> Those two things -- null all references and setting an explicit
> exit flag are the most you can do.
>
> After you null all references to the thread, do an explicit
> gc() if that's available.
>
>
>
> Gabriel Sim es wrote:
> > Hello,
>
> > Today, while debugging and app that uses AsyncTask to record audio and
> > update UI I noticed that everytime that an AsyncTask object ends
> > running (finishes doInBackground() and onPostExecute() or
> > onCancelled()) it s thread stays alive (running status).
> > At least for me that should not be the behavior of the class since the
> > doInBackground task may not stay running forever (as an example the
> > android manual says that a status bar should be updated by an
> > asynctask, and it won t last for the whole app running time).
>
> > Is there anything I m missing, as a method to destroy it, or should I
> > just ignore and keep creating threads as I need and the VM will handle
> > them as it needs resources?
>
> > Thank you,
> > Gabriel Sim es

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


[android-developers] Re: TextView before ListView

2010-03-13 Thread Bob Kerns
Well, thanks for thinking about it for me, I appreciate it. But that's
not the problem here.

It's not really the constraint between the siblings (Spinner,
TextView) that's the problem, but rather the content of the Spinner is
not reflected in the Spinner's size computations.

There are issues with doing so. You could do so statically - but it
would require enumerating your entire collection, which could be very
expensive. Or you can do it dynamically and re-layout whenever the
selected view changes. That's not ideal, either; you may not want to
have your view change sizes dynamically. But I don't see a solution
that doesn't involve one of the two -- or doing neither, and having
things not work.

In my testing, I do more than just move the XML elements around; I do
adjust the constraints to not be forward references. (I'd like to keep
it working on 1.5 for now).

But Mark's message points out I didn't try using forward references. I
don't expect that to be different, if my analysis of the situation is
correct, but it's a hole in my analysis.

On Mar 13, 6:21 am, Brion Emde  wrote:
> Bob,
>
> Forgive me if this is obvious to you, but I have to remind myself over
> and over. RelativeLayout makes only a single pass through your XML to
> determine the Ids and collect the layout information. So it is
> essential that you order the elements correctly to make sure you have
> no forward references. RelativeLayout does not complain if you do and
> it will appear that the elements are not obeying your layout
> parameters.
>
> Just a thought that came to me this morning...
>
> Brion
>
> On Mar 11, 4:21 pm, Bob Kerns  wrote:
>
>
>
> > Are you sure? This sounds like exactly what I was asking earlier
> > today, based on my experience with Spinner. I speculated that ListView
> > might exhibit the same behavior.
>
> > You describe the behavior I was expecting. Instead, the Spinner
> > ignored all constraints. If I put it first in the layout, it would
> > overlay or squeeze out the text. (I forget what distinguished the two
> > behaviors).
>
> > If I put it second, the text would fail to wrap and the Spinner would
> > get squeezed out. I just could not get the Adapter-supplied views to
> > participate in the sizing process.
>
> > I expect that I could have given it a fixed size, but that would be a
> > bug itself.
>
> > I don't have time to try it again with ListViews at the moment, but if
> > anyone can confirm this working, especially with RelativeLayout, I'd
> > appreciate it.
>
> > On Mar 11, 10:35 am,BrionEmde  wrote:
>
> > > You can totally do this.
>
> > > Make sure that your TextView is set to
> > > android:layout_height="wrap_content" and not to "fill_parent". That
> > > will surely do what you are describing.
>
> > > ---
>
> > > On Mar 11, 5:35 am, Pipen  wrote:
>
> > > > Dear All,
>
> > > > I've tried to add a TextView before a ListView in a LinearLayout. The
> > > > result is that the ListView wont show at all. The same thing happens
> > > > if I put the TextView after the ListView, but then I will only see the
> > > > ListView.
>
> > > > Is there a way to get a text view above the ListView without to much
> > > > of a hassle?
>
> > > > Kind regards

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


[android-developers] Re: Recommendations for split app (eg free/pro versions using 95% the same code)

2010-03-13 Thread Bob Kerns
I find this works fine sometimes, and is a real pain other times. It
tends to work fine when you're just developing along on the stuff
that's shared.

But later in the project, when you're testing and bug fixing in both
branches on both shared and differentiated parts, then you end up
having to do a lot of merging. You may even get merge conflicts.

What I suggest is putting all the code into one project, and
customizing the build process to build two (or more) versions.

What my build script does is:
1) Tag via a copy of trunk to /tags/builds//
is the maximum of the SVN revision of each included
component, including the build scripts themselves + any third-party
pieces.
2) I switch my build working copy to this branch. (If it's missing, I
do a checkout).
3) I then export two copies from the build working copy.
4) I then run a configuration step that adjusts for the differences.
Mostly this consists of modifying the package name in the manifest,
etc. I have subclasses of each entry point so I can customize each as
needed.
5) I then build normally, and export the results to a dist directory.

This has several benefits. ZERO merging. It's a bit faster to build
both versions together, with only a single checkout/swtich time,
though some of that is lost with the extra copy step. All the code is
in one place. There's only one Eclipse project, so you never end up
pulling up the wrong source, yet both versions of the code are always
available. And it's completely automated, so you get consistent
results.

Also, all the differences are explicit. The code differences are
segregated in the respective version-specific packages, while the
shared stuff is in the other packages. For resources and the manifest,
the differences are explicit in XSLT scripts that configure those
resources.

My build numbers are completely automated and guaranteed to increment.

On Mar 13, 1:51 am, Anders Aagaard  wrote:
> Personally I'd use a version control system with branches to do this.
> And keep it in one project.
>
> Doing it with branches you could easily merge changes that go in both
> versions, and just do a refresh in eclipse when doing development on
> the other version.
>
> On Mar 11, 10:51 pm, "Matt (preinvent)"  wrote:
>
>
>
> > I have a free app out there and am going to write a pro version with
> > some extra functionality that I'll charge for.
>
> > The plan is to use the same code for both apps, although I need
> > different Eclipse projects to use different manfiest files.  The
> > obvious way is to have all my code in a shared library which the free
> > and pro projects reference.
>
> > Is there a recommended way of doing this?

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


[android-developers] Re: NoClassDefFoundError for gdata CalendarService class

2010-03-13 Thread Tom
I created the libs directory where you specified and copied the
gdata .jar files in there, then from Eclipse ran "Export" project,
then installed on the phone - but with the same result -
NoClassDefFoundError for CalendarService.

It seems that Eclipse is "silently" failing to handle the gdata jar
files somehow - my project contains another 3rd party jar file which
appears to work just fine.

Something tells me that I have to stop relying on Eclipse and actually
learn how to use the Android SDK command-line tools... I knew it
wouldn't be this easy. ;-)

Thanks for all of your help.


On Mar 13, 3:24 pm, Mark Murphy  wrote:
> Tom wrote:
> >>> This code compiles with no errors, using Eclipse on MacOS, using
> >>> external jar files from the Google gdata project:
> >>> gdata/java/lib/gdata-calendar-2.0.jar
> >>> gdata/java/lib/gdata-calendar-meta-2.0.jar
> >> Did you copy these into your project's libs/ directory?
>
> > No, I merely specified the path to the external jar in the Eclipse
> > "Java build path" libraries dialog. This seemed to work for other
> > projects I've developed. I look in my Eclipse project workspace and
> > see assets, bin, gen, res, and src directories but no libs. Where
> > should that directory appear?
>
> As a peer to assets/, bin/, gen/, res/, and src/.
>
> Now, it is conceivable that Eclipse handles things differently. I don't
> use Eclipse, and from the command line, just dropping the dependent JARs
> in libs/ is all you need. My recommendation to my students is that they
> put their dependent JARs in libs/ plus add them to the Eclipse build path.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Warescription: Three Android Books, Plus Updates, One Low Price!

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


Re: [android-developers] Re: getContextMenuInfo() returns null on sub-menu MenuItems

2010-03-13 Thread TreKing
I've submitted a bug report for this issue:
http://code.google.com/p/android/issues/detail?id=7139

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

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

[android-developers] Re: is there a way to get a view to the front?

2010-03-13 Thread skink


On Mar 13, 10:56 pm, skink  wrote:
> On Mar 13, 10:37 pm, mot12  wrote:
>
> > Yes. I don't believe it either. Maybe I am screwing things up because
> > I had some wine (it is past midnight here). But it seems to work and I
> > am happy (again, that may be the wine speaking).
>
> > I also saw that FrameLayout has a method setForeground(Drawable) and
> > Drawable has a method setAlpha (and also setColorFilter if that is of
> > interest) which sound spot on for my needs. I will investigate more
> > and post what I find.
>
> i didn'n know that FrameLayout has setForeground(Drawable) method.
>
> it's obviously the best solution for your problem, so remoVe filter
> View and set e.g. ColorDrawable to foreground attribute.
> thanks for info!

of course you can define it in xml as well by adding e.g.
android:foreground="#8000" inside FrameLayout

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


[android-developers] Re: is there a way to get a view to the front?

2010-03-13 Thread skink


On Mar 13, 10:37 pm, mot12  wrote:
> Yes. I don't believe it either. Maybe I am screwing things up because
> I had some wine (it is past midnight here). But it seems to work and I
> am happy (again, that may be the wine speaking).
>
> I also saw that FrameLayout has a method setForeground(Drawable) and
> Drawable has a method setAlpha (and also setColorFilter if that is of
> interest) which sound spot on for my needs. I will investigate more
> and post what I find.

i didn'n know that FrameLayout has setForeground(Drawable) method.

it's obviously the best solution for your problem, so remoVe filter
View and set e.g. ColorDrawable to foreground attribute.
thanks for info!

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


[android-developers] Re: is there a way to get a view to the front?

2010-03-13 Thread mot12
Yes. I don't believe it either. Maybe I am screwing things up because
I had some wine (it is past midnight here). But it seems to work and I
am happy (again, that may be the wine speaking).

I also saw that FrameLayout has a method setForeground(Drawable) and
Drawable has a method setAlpha (and also setColorFilter if that is of
interest) which sound spot on for my needs. I will investigate more
and post what I find.

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


Re: [android-developers] Re: Override default icons of BaseExpandableListAdapter

2010-03-13 Thread TreKing
On Sat, Mar 13, 2010 at 3:53 PM, Ali Chousein wrote:

> Is there a way to disable this stretching?


Did you also set the bounds for the indicator?

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

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

Re: [android-developers] Re: NoClassDefFoundError for gdata CalendarService class

2010-03-13 Thread Mark Murphy
Tom wrote:
>>> This code compiles with no errors, using Eclipse on MacOS, using
>>> external jar files from the Google gdata project:
>>> gdata/java/lib/gdata-calendar-2.0.jar
>>> gdata/java/lib/gdata-calendar-meta-2.0.jar
>> Did you copy these into your project's libs/ directory?
>>
> 
> No, I merely specified the path to the external jar in the Eclipse
> "Java build path" libraries dialog. This seemed to work for other
> projects I've developed. I look in my Eclipse project workspace and
> see assets, bin, gen, res, and src directories but no libs. Where
> should that directory appear?

As a peer to assets/, bin/, gen/, res/, and src/.

Now, it is conceivable that Eclipse handles things differently. I don't
use Eclipse, and from the command line, just dropping the dependent JARs
in libs/ is all you need. My recommendation to my students is that they
put their dependent JARs in libs/ plus add them to the Eclipse build path.

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

Warescription: Three Android Books, Plus Updates, One Low Price!

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


[android-developers] Re: NoClassDefFoundError for gdata CalendarService class

2010-03-13 Thread Tom


On Mar 13, 3:15 pm, Mark Murphy  wrote:
> Tom wrote:
> > I'm writing an android 2.1 application that writes an entry to my
> > Google calendar. The relevant part of my application code looks like
> > this:
>
> >    void addCalendarEntry(String googleUser, String password)
> >    throws Exception {
>
> >            URL postURL =
> >                     new URL("http://www.google.com/calendar/feeds/"; +
> > googleUser +
> >                              "/private/full");
>
> >            CalendarService myService =
> >                     new CalendarService("myCompany-exampleApp-1.0");
>
> > This code compiles with no errors, using Eclipse on MacOS, using
> > external jar files from the Google gdata project:
> > gdata/java/lib/gdata-calendar-2.0.jar
> > gdata/java/lib/gdata-calendar-meta-2.0.jar
>
> Did you copy these into your project's libs/ directory?
>

No, I merely specified the path to the external jar in the Eclipse
"Java build path" libraries dialog. This seemed to work for other
projects I've developed. I look in my Eclipse project workspace and
see assets, bin, gen, res, and src directories but no libs. Where
should that directory appear?

Thanks very much,
Tom

> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Android Training in US: 14-18 June 2010:http://bignerdranch.com

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


[android-developers] Re: is there a way to get a view to the front?

2010-03-13 Thread skink


On Mar 13, 10:16 pm, mot12  wrote:
> Amazingly, it works with your order just fine, too. That seems to be
> in contrast to the documentation. Whatever. I am happy :).

so it works both with my and your order???

i cannot believe it...

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


[android-developers] Re: is there a way to get a view to the front?

2010-03-13 Thread mot12
Amazingly, it works with your order just fine, too. That seems to be
in contrast to the documentation. Whatever. I am happy :).

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


Re: [android-developers] NoClassDefFoundError for gdata CalendarService class

2010-03-13 Thread Mark Murphy
Tom wrote:
> I'm writing an android 2.1 application that writes an entry to my
> Google calendar. The relevant part of my application code looks like
> this:
> 
>   void addCalendarEntry(String googleUser, String password)
>   throws Exception {
> 
>   URL postURL =
> new URL("http://www.google.com/calendar/feeds/"; +
> googleUser +
>  "/private/full");
> 
>   CalendarService myService =
> new CalendarService("myCompany-exampleApp-1.0");
> 
> 
> This code compiles with no errors, using Eclipse on MacOS, using
> external jar files from the Google gdata project:
> gdata/java/lib/gdata-calendar-2.0.jar
> gdata/java/lib/gdata-calendar-meta-2.0.jar

Did you copy these into your project's libs/ directory?

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

Android Training in US: 14-18 June 2010: http://bignerdranch.com

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


[android-developers] Re: is there a way to get a view to the front?

2010-03-13 Thread skink


On Mar 13, 10:07 pm, mot12  wrote:
> This works perfectly. Thanks, pskink. Really appreciate your help!!

glad to hear it works and sorry for wrong children order...
fortunately you read the docs and found out my mistake

pskink

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


[android-developers] NoClassDefFoundError for gdata CalendarService class

2010-03-13 Thread Tom
I'm writing an android 2.1 application that writes an entry to my
Google calendar. The relevant part of my application code looks like
this:

void addCalendarEntry(String googleUser, String password)
throws Exception {

URL postURL =
new URL("http://www.google.com/calendar/feeds/"; +
googleUser +
 "/private/full");

CalendarService myService =
new CalendarService("myCompany-exampleApp-1.0");


This code compiles with no errors, using Eclipse on MacOS, using
external jar files from the Google gdata project:
gdata/java/lib/gdata-calendar-2.0.jar
gdata/java/lib/gdata-calendar-meta-2.0.jar

I export the application through Eclipse to generate the .apk file
which I install on my N-1 phone. However the application cannot find
the CalendarService class, giving me the following runtime error:

W/dalvikvm(11552): threadid=3: thread exiting with uncaught exception
(group=0x4001b180)
E/AndroidRuntime(11552): Uncaught handler: thread main exiting due to
uncaught exception
E/AndroidRuntime(11552): java.lang.NoClassDefFoundError:
com.google.gdata.client.calendar.CalendarService
E/AndroidRuntime(11552):at
org.mbari.satellite.PassSummaryActivity.addCalendarEntry(PassSummaryActivity.java:
206)

When developing other android applications the "external jar files"
always seem to be cross-compiled and packed into the apk file - so I
do not understand why the app cannot find the CalendarService class.
Anyone have any ideas?

Thanks,
Tom

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


[android-developers] Re: is there a way to get a view to the front?

2010-03-13 Thread mot12
This works perfectly. Thanks, pskink. Really appreciate your help!!

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


[android-developers] Re: is there a way to get a view to the front?

2010-03-13 Thread mot12
FrameLayout seems like it could be the solution, thanks so much for
the tip pskink. Reading up on the documentation, FrameLayout allows
several children, all pegged to the topleft corner, with the last
child being on top.

So I will try something like this:
FrameLayout
--LinearLayout
your control1
your control2
your controlN
--View (the filter)

I will report results here tomorrow.

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


Re: [android-developers] Re: How to display all contacts?

2010-03-13 Thread Dmitri Plotnikov
Code snippets provided on this mailing list are often sketches or ideas
without the expectation that they would work by simply copying and pasting.

mResolver in the above snippets is assumed to have been initialized like
this:

ContentResolver mResolver;

onCreate() {
...
mResolver = getContentResolver();
...
}

The above, again, is a sketch.

Cheers,
- Dmitri

On Fri, Mar 12, 2010 at 8:15 AM, Nox  wrote:

> Thank you for your replies but I´ve still a problem.
> I´ve pasted the last code  from Dmitri Plotnikov  into my project but
> Eclipse doesn´t know what mResolver is.
> Do you know how to fix this problem?
>
> By the way, I tried the code from Karan too, but there I have the same
> problem with mResolver and another problem with "where" ( in the first
> line ).
>
>
>
>
>
>
>
>
> On 11 Mrz., 19:50, Dmitri Plotnikov  wrote:
> > Nice, but this might be even better:
> >
> > Cursor cursor = mResolver.query( Data.CONTENT_URI,
> > new String[]{Event.DISPLAY_NAME, Event.DATA},
> > Data.MIMETYPE + "=" + Event.CONTENT_ITEM_TYPE + " AND " + Event.TYPE
> +
> > "=" + Event.TYPE_BIRTHDAY,
> > null,
> > Data.DISPLAY_NAME );
> > if( cursor != null ) {
> >try {
> >  while( cursor.moveToNext() ) {
> >  String displayName = cursor.getString(0);
> >  String date =cursor.getString(1);
> >  }
> >   } finally {
> >  cursor.close();
> >   }
> >
> >
> >
> > }
> > On Wed, Mar 10, 2010 at 11:12 PM, Karan  wrote:
> > > Use the following code to read the data.
> >
> > > Cursor cursor = mResolver.query( Data.CONTENT_URI, null, where, null,
> > > Data.DISPLAY_NAME );
> > > if( cursor != null ) {
> > >while( cursor.moveToNext() ) {
> > >String rawContactID =
> > > cursor.getString( cursor.getColumnIndex( Data.RAW_CONTACT_ID ) );
> > >String mimetype =
> > > cursor.getString( cursor.getColumnIndex( ContactsContract.Data.MIMETYPE
> )
> > > );
> > >if( mimetype.equals( StructuredName.CONTENT_ITEM_TYPE ) ) {
> > >// Read name : Field = StructuredName.DISPLAY_NAME
> > >}
> > >else if( mimetype.equals( Relation.CONTENT_ITEM_TYPE ) ) {
> > >// Read birthdate : Field = Relation.DATA
> > >}
> > >// Note : The name and the birthday will be there in different
> > > entries
> > >// So make sure that you match them properly and maintain it
> > > accordingly
> > > }
> > > }
> >
> > > On Mar 10, 11:38 pm, Mark Murphy  wrote:
> > > > Nox wrote:
> > > > > Thank you for your replies,
> > > > > but unfortunately it doesn t work.
> > > > > If I open my app there ll appear the error message:
> >
> > > > > The application has stopped unexpectedly. Please try again.
> >
> > > > > Do you know what I have to do now?
> >
> > > > Use adb logcat, DDMS, or the DDMS perspective in Eclipse to look at
> the
> > > > Java stack trace that was generated when that dialog appeared. It
> should
> > > > give you some clues for fixing your problem.
> >
> > > > --
> > > > Mark Murphy (a Commons Guy)http://commonsware.com|
> > >http://twitter.com/commonsguy
> >
> > > > _The Busy Coder's Guide to *Advanced* Android Development_
> > > > Version 1.3 Available!
> >
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to
> android-developers@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > android-developers+unsubscr...@googlegroups.com cr...@googlegroups.com>
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

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

[android-developers] Re: OnPause() - how to resume to an activity which has a Bundle passed to it when it is created

2010-03-13 Thread Makas Tzavellas
Hi Prajakta,

I think you might be mistaken about the use of "onSaveInstanceState()"
method in an Activity. It is useful only when the Activity is about to
be killed and expected to be restored later by the system. Otherwise,
the information saved when the method is called is not reused.

If Activity A starts Activity B then user presses "back" to Activity
A. The Activity B will always be destroyed, which means a new instance
of Activity B will always be created when it is called again by
Activity A, *unless* Activity B is the already in the task and the
singleTask/singleInstance launchMode is set. The Activity B will only
exist in the task if it's the root activity or previously started by
other Activities without being destroyed. E.g

C -> B -> A -> B

In that sense, the same instance of Activity B will be reused if
singleTask/singleInstance is set. Otherwise new instances of Activity
B will be created.


Makas

On Mar 14, 1:31 am, Prajakta Shitole  wrote:
> Hi Makas,
>
> Thanks for your suggestion, but when I tried changing it to singleTask, I
> still could not start my activity. It kept giving me NullPointerException as
> my activity expects a Bundle. I had even stored the values that I needed
> from the bundle in my OnSaveInstance method, but dint get it to work.
>
> However when I tried using a service and created a new activity I was able
> to get my functionality running, but I would like to get the same activity
> which was created earlier to the foreground.
>
> I will look into this again by changing the launchModes and debugging and
> will let you know if that worked.
>
> Thanks,
> Prajakta
>
> On Sat, Mar 13, 2010 at 1:53 AM, Makas Tzavellas
> wrote:
>
> > Hi Prajakta,
>
> > By default, an activity will be "destroyed" (onDestroyed() will be
> > called) being called when the "back" button is called. E.g A calls B,
> > and user presses the "back" button, then activity B will be destroyed.
> > So from calling activity B again from activity A will create a new
> > instance of activity B (onCreate() will be called).
>
> > So if I understand you right, you would like to use the same instance
> > of Activity B instead of recreating a new instance each time the
> > Activity is called from other activities. Therefore, you *might* want
> > to use "singleTask" as the Activity's "launchMode".
>
> > You can find out more information from here.
>
> >http://developer.android.com/guide/topics/fundamentals.html#lmodes
>
> > On Mar 13, 9:25 am, Prajakta Shitole  wrote:
> > > Hi Jeffrey,
>
> > > Thanks for the suggestion but I have activities and not views. I have
> > > separate activities which are being called so I am not sure how I will be
> > > able to achieve the same thing that you have implemented.
>
> > > Thanks,
> > > Prajakta
>
> > > On Fri, Mar 12, 2010 at 10:19 AM, Jeffrey 
> > wrote:
> > > > What I have done with success in some of my apps is making several
> > > > parent views that hold each layout within a table layout, and use the
> > > > menu buttons to change the visibility of the parent view containing
> > > > the info you want them to see. Since the view is never really closed,
> > > > it's state is kept. Just use setVisibility(View.GONE) or View.VISIBILE
> > > > and it should keep everything good.
>
> > > > Just make sure that each button press hides all the other parent views
> > > > or else you will basically end up with two screens showing one after
> > > > the other.
>
> > > > On Mar 12, 7:21 am, TreKing  wrote:
> > > > > On Fri, Mar 12, 2010 at 12:28 AM, Prajakta Shitole <
> > prajakt...@gmail.com
> > > > >wrote:
>
> > > > > > One of my idea was to store the picture and the text view in the
> > > > service
> > > > > > and on click of a menu button navigate to another activity which
> > will
> > > > > > connect to the service and draw the stored pictures, text views in
> > its
> > > > > > activity.
>
> > > > > I haven't done anything like this but this seems like what you would
> > want
> > > > to
> > > > > do.
>
> > ---­--
> > > > > TreKing - Chicago transit tracking app for Android-powered
> > deviceshttp://
> > > > sites.google.com/site/rezmobileapps/treking
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "Android Developers" group.
> > > > To post to this group, send email to
> > android-developers@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > android-developers+unsubscr...@googlegroups.com
> > 
>
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/android-developers?hl=en
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For mor

[android-developers] Restarting an activity within a tab (TabActivity)

2010-03-13 Thread Mark Wyszomierski
Hi,

I have a TabActivity, each tab holds an activity. At some point I'd
like to 'refresh' the tabs. I'd basically like to restart each
activity in the tabs. I'm not sure how to do this. Calling:

   getTabHost().clearTabs();

removes the tabs, but the activities still seem to be in alive, in
limbo. How can I get them to really quit?

Thanks

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


[android-developers] Re: is there a way to get a view to the front?

2010-03-13 Thread skink


On Mar 13, 7:45 pm, mot12  wrote:
> Hi,
>
> I have a root view (LinearLayout) and a bunch of views placed on top
> of it. Now, I would like to change the brightness of all views, let's
> say to 50%.
>
> Instead of changing the color of each view individually, it would be
> so much nicer if I could just place a view on top of all views,
> covering the whole screen and acting like a filter. If this top-view
> is black, I can control the brightness of all the views underneath it
> by adjusting the alpha value.
>
> For this to work, I would need to tell Android to render the root view
> in front of all the other views but I can't find a way to do this. Any
> ideas?
>
> The actual reason for this weird request is that I want to be able to
> dim the screen. There's some functionality to turn the brightness of
> the screen down but the lowest setting is still too bright. The only
> way to get the views darker seems to be to change the colors of the
> views themselves. Rather than changing 50 items, it would be great to
> put just one view on top of the whole tree, like a pair of sunglasses.
>
> Or is there a better way?
>
> thanks for your time,
> Martin


you can place your LinearLayout inside FrameLayout and add also simple
View which android:background would act as your filter:

FrameLayout
--View
--LinearLayout
your control1
your control2
your controlN

pskink

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


[android-developers] Re: Override default icons of BaseExpandableListAdapter

2010-03-13 Thread Ali Chousein
Hi TreKing,

The ExpandableListView.setGroupIndicator does the job indeed, except
it stretches the new icon. Is there a way to disable this stretching?
I find it a bit strange that stretching is the default behavior
instead of displaying an icon in it's original size. Any feedback
would be very helpful.

-Ali

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


Re: [android-developers] Application losing SharedPreferences and Sqlite database on Droid

2010-03-13 Thread Yuvi
Hi,

the database issue happened on my phone (HTC Hero, 1.5), with my app. I also
wrote to this mailing group ("Corrupted Database
(SQLiteDatabaseCorruptException: database disk image is malformed)"), but
got no replies :(

I hope someone has some news about that.


Yuvi

-- 
YuviDroid
http://android.yuvalsharon.net

On Sat, Mar 13, 2010 at 10:16 PM, Matt (preinvent) wrote:

> I've had several reports (and experienced it once myself) of users of
> my app experiencing loss of all application data - both
> SharedPreferences and the SQLite database.  There's nothing in my code
> that could do this so there must be something going on at a lower
> level.  I've only had reports from Droid users so it's more than
> likely confined to that phone, although that doesn't mean it doesn't
> happen on other phones.
>
> Has anyone experienced this before? I've seen threads in here
> regarding loss of just SharedPreferences, but a database as well?
>
> Thanks,
>
> Matt
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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

[android-developers] AppWidgetProvider and setTypeface

2010-03-13 Thread David Toledo
Hi All

How can to format the font a TextView with setTyface in the
AppWidgetProvider


example:

 RemoteViews views = new RemoteViews(context.getPackageName(),
R.layout.widget_xxx);
Cursor cursor = displayRecords(context);
cursor.moveToPosition(0);
String text= cursor.getString(cursor.getColumnIndex(BOOK_TITLE));
views.setTextViewText(R.id.resume,text);

??

  georgia = Typeface.createFromAsset(context.getAssets(),
"fonts/helvetica.ttf");
  tvResume.setTypeface(georgia);



Thanks
David

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

[android-developers] Application losing SharedPreferences and Sqlite database on Droid

2010-03-13 Thread Matt (preinvent)
I've had several reports (and experienced it once myself) of users of
my app experiencing loss of all application data - both
SharedPreferences and the SQLite database.  There's nothing in my code
that could do this so there must be something going on at a lower
level.  I've only had reports from Droid users so it's more than
likely confined to that phone, although that doesn't mean it doesn't
happen on other phones.

Has anyone experienced this before? I've seen threads in here
regarding loss of just SharedPreferences, but a database as well?

Thanks,

Matt

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


[android-developers] is there a way to get a view to the front?

2010-03-13 Thread mot12
Hi,

I have a root view (LinearLayout) and a bunch of views placed on top
of it. Now, I would like to change the brightness of all views, let's
say to 50%.

Instead of changing the color of each view individually, it would be
so much nicer if I could just place a view on top of all views,
covering the whole screen and acting like a filter. If this top-view
is black, I can control the brightness of all the views underneath it
by adjusting the alpha value.

For this to work, I would need to tell Android to render the root view
in front of all the other views but I can't find a way to do this. Any
ideas?

The actual reason for this weird request is that I want to be able to
dim the screen. There's some functionality to turn the brightness of
the screen down but the lowest setting is still too bright. The only
way to get the views darker seems to be to change the colors of the
views themselves. Rather than changing 50 items, it would be great to
put just one view on top of the whole tree, like a pair of sunglasses.

Or is there a better way?

thanks for your time,
Martin

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


[android-developers] Re: How to display all contacts?

2010-03-13 Thread ydario
Hi Dmitri,


> Cursor cursor = mResolver.query( Data.CONTENT_URI,
>     new String[]{Event.DISPLAY_NAME, Event.DATA},
>     Data.MIMETYPE + "=" + Event.CONTENT_ITEM_TYPE + " AND " + Event.TYPE +
> "=" + Event.TYPE_BIRTHDAY,


I use a similar code, and I can retrieve data edited using Google
Contacts on the web.

But if I update the date on the local phone contacts db, the change is
visible in  Android contacts book, but it is not synced to the Web.
Looking at contacts database, I don't see differences with records
synced from Google contacts.

Is this a bug or a feature? :-)

thanks,

Yuri

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


[android-developers] Re: AlarmManager on droids

2010-03-13 Thread mot12
I misspoke: I meant to turn off user applications running in the
background.

Many people use the flightmode at night as they use their phones as a
bedside alarm clock. Many alarm clocks offer this functionality and I
would consider this a typical use of the device.

>From some 6000 active users I had ~20 people confirm the problem.
There are probably lots more who don't report it.

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


[android-developers] Re: AlarmManager on droids

2010-03-13 Thread mot12
I misspoke: I meant to turn off user applications running in the
background.

Many people use the flightmode at night as they use their phones as a
bedside alarm clock. Many alarm clocks offer this functionality and I
would consider this a typical use of the device.

>From some 6000 active users I had ~20 people confirm the problem.
There are probably lots more who don't report it.

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


[android-developers] Re: Asynctask threads never end!

2010-03-13 Thread Gabriel Simões
So, there´s nothing to worry about then!
Thanks for your answers and help!

On 13 mar, 15:42, Streets Of Boston  wrote:
> Like Mark said, AsyncTasks use a pool of threads that manages itself.
>
> An AsyncTask is NOT a thread. It uses a pool of threads to execute a
> task on. It is based on the FutureTasks and ExecutorService of the
> java.util.concurrent package.
>
> When you create a new AsyncTask, you don't create a new thread. You
> create a unit of work (a task) that will run on one thread chosen from
> a pool of threads. This pool has a fixed size and won't grow (this
> means that if you create tons of AsyncTasks, faster than they finish,
> some of these AsyncTasks will wait until a thread from the pool
> becomes available).
>
> On Mar 13, 12:26 pm, Gabriel Simões  wrote:
>
>
>
> > Hello,
>
> > Today, while debugging and app that uses AsyncTask to record audio and
> > update UI I noticed that everytime that an AsyncTask object ends
> > running (finishes doInBackground() and onPostExecute() or
> > onCancelled()) it´s thread stays alive (running status).
> > At least for me that should not be the behavior of the class since the
> > doInBackground task may not stay running forever (as an example the
> > android manual says that a status bar should be updated by an
> > asynctask, and it won´t last for the whole app running time).
>
> > Is there anything I´m missing, as a method to destroy it, or should I
> > just ignore and keep creating threads as I need and the VM will handle
> > them as it needs resources?
>
> > Thank you,
> > Gabriel Simões- Ocultar texto das mensagens anteriores -
>
> - Mostrar texto das mensagens anteriores -

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


Re: [android-developers] Re: Issues with Listener, "back" button, and onDestroy().

2010-03-13 Thread Mark Murphy
AuxOne wrote:
> I've chosen singletonInstance in hopes of avoiding the problem I have
> now. It just seems to me from a memory perspective it could be better
> to have less instances of the application in memory, but based on your
> response I will remove it.

Android handles cleaning up destroyed activities for you automatically,
so long as you're not holding onto them from a static context, which is
where an unregistered LocationListener will get you in trouble.

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

Android Training...At Your Office: http://commonsware.com/training

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


[android-developers] Re: Issues with Listener, "back" button, and onDestroy().

2010-03-13 Thread AuxOne
The listener I'm talking about is custom and only accepts a single
listener at a time which is held as a member variable of my custom
listener class, it's not an Android Listener. I did have a
LocationListener in my code but even after commenting it out I still
see the same behavior.

I've chosen singletonInstance in hopes of avoiding the problem I have
now. It just seems to me from a memory perspective it could be better
to have less instances of the application in memory, but based on your
response I will remove it.

I better understand the innerworkings of Android, and I thank you,
however the problem remains.

Thanks!

On Mar 13, 1:37 pm, Mark Murphy  wrote:
> AuxOne wrote:
> > Shouldn't it suffice to just re-register the listener onCreate()?
>
> If you are talking about registering some listener with Android
> (LocationListener, etc.), then no. Please unregister your listeners.
>
> > Btw, the Activity is a singleton
> > ( android:launchMode="singleInstance") so there's only one instance.
>
> singleInstance != singleton.
>
> Let's walk through this, starting with a freshly-rebooted phone. At this
> point, there are zero instances of your activity.
>
> 1. User taps on your icon in the Launcher. Android starts up an instance
> of your Activity. At this point, there is one instance of your activity
> in the system.
>
> 2. You register a LocationListener. At this point, there is one instance
> of your activity in the system.
>
> 3. User presses BACK, and you fail to unregister the LocationListener.
> At this point, from the standpoint of singleInstance, there are zero
> instances of your activity in the system. However, from a garbage
> collection standpoint, there is one instance of your activity in RAM,
> since Android holds onto your LocationListener, which holds onto your
> activity.
>
> 4. User taps on your icon in the Launcher. Android thinks there are zero
> instances of your activity in the system (from a singleInstance
> perspective), and so starts up an instance of your Activity. At this
> point, there are two instances of your Activity in RAM -- the old one
> and the new one.
>
> It is unclear to me what you think you need singleInstance for -- most
> single-activity applications do not need singleInstance. So, I would get
> rid of that, plus clean up your listeners.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Android 2.0 Programming Books:http://commonsware.com/books

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


[android-developers] Re: Asynctask threads never end!

2010-03-13 Thread Streets Of Boston
Like Mark said, AsyncTasks use a pool of threads that manages itself.

An AsyncTask is NOT a thread. It uses a pool of threads to execute a
task on. It is based on the FutureTasks and ExecutorService of the
java.util.concurrent package.

When you create a new AsyncTask, you don't create a new thread. You
create a unit of work (a task) that will run on one thread chosen from
a pool of threads. This pool has a fixed size and won't grow (this
means that if you create tons of AsyncTasks, faster than they finish,
some of these AsyncTasks will wait until a thread from the pool
becomes available).

On Mar 13, 12:26 pm, Gabriel Simões  wrote:
> Hello,
>
> Today, while debugging and app that uses AsyncTask to record audio and
> update UI I noticed that everytime that an AsyncTask object ends
> running (finishes doInBackground() and onPostExecute() or
> onCancelled()) it´s thread stays alive (running status).
> At least for me that should not be the behavior of the class since the
> doInBackground task may not stay running forever (as an example the
> android manual says that a status bar should be updated by an
> asynctask, and it won´t last for the whole app running time).
>
> Is there anything I´m missing, as a method to destroy it, or should I
> just ignore and keep creating threads as I need and the VM will handle
> them as it needs resources?
>
> Thank you,
> Gabriel Simões

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


Re: [android-developers] Re: Issues with Listener, "back" button, and onDestroy().

2010-03-13 Thread Mark Murphy
AuxOne wrote:
> Shouldn't it suffice to just re-register the listener onCreate()?

If you are talking about registering some listener with Android
(LocationListener, etc.), then no. Please unregister your listeners.

> Btw, the Activity is a singleton
> ( android:launchMode="singleInstance") so there's only one instance.

singleInstance != singleton.

Let's walk through this, starting with a freshly-rebooted phone. At this
point, there are zero instances of your activity.

1. User taps on your icon in the Launcher. Android starts up an instance
of your Activity. At this point, there is one instance of your activity
in the system.

2. You register a LocationListener. At this point, there is one instance
of your activity in the system.

3. User presses BACK, and you fail to unregister the LocationListener.
At this point, from the standpoint of singleInstance, there are zero
instances of your activity in the system. However, from a garbage
collection standpoint, there is one instance of your activity in RAM,
since Android holds onto your LocationListener, which holds onto your
activity.

4. User taps on your icon in the Launcher. Android thinks there are zero
instances of your activity in the system (from a singleInstance
perspective), and so starts up an instance of your Activity. At this
point, there are two instances of your Activity in RAM -- the old one
and the new one.

It is unclear to me what you think you need singleInstance for -- most
single-activity applications do not need singleInstance. So, I would get
rid of that, plus clean up your listeners.

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

Android 2.0 Programming Books: http://commonsware.com/books

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


[android-developers] Re: Issues with Listener, "back" button, and onDestroy().

2010-03-13 Thread AuxOne
Shouldn't it suffice to just re-register the listener onCreate()?

My setter looks like
public void Listener(Listener listener){
theListener = listener;
}

Btw, the Activity is a singleton
( android:launchMode="singleInstance") so there's only one instance.

Thanks

On Mar 13, 1:08 pm, Mark Murphy  wrote:
> AuxOne wrote:
> > When the application is first run the Listener works fine. When I use
> > the "home" button to minimize it, then open it again it's still fine.
>
> > But when I press the back button then run it again from the
> > application icon, the Listener doesn't work fully. The code runs and
> > the Listening methods are called as usual but none of the UI elements
> > that are listening update. It requires a restart of the phone to get
> > the listener working again after this point.
>
> My guess is that you still have a listener from the first instance of
> your activity registered. Please unregister all listeners in or before
> onDestroy() and register them anew in onCreate() or some similar spot.
>
> > Is there a way to use the
> > onDestroy() or similar method to call a function that actually closes
> > the application?
>
> No.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Android App Developer Books:http://commonsware.com/books

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


Re: [android-developers] Issues with Listener, "back" button, and onDestroy().

2010-03-13 Thread Mark Murphy
AuxOne wrote:
> When the application is first run the Listener works fine. When I use
> the "home" button to minimize it, then open it again it's still fine.
> 
> But when I press the back button then run it again from the
> application icon, the Listener doesn't work fully. The code runs and
> the Listening methods are called as usual but none of the UI elements
> that are listening update. It requires a restart of the phone to get
> the listener working again after this point.

My guess is that you still have a listener from the first instance of
your activity registered. Please unregister all listeners in or before
onDestroy() and register them anew in onCreate() or some similar spot.

> Is there a way to use the
> onDestroy() or similar method to call a function that actually closes
> the application? 

No.

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

Android App Developer Books: http://commonsware.com/books

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


[android-developers] Issues with Listener, "back" button, and onDestroy().

2010-03-13 Thread AuxOne
I have an application with a single Activity implemented as a
singleton (in the AndroidManifest). It implements a Listener I wrote.
When the application is first run the Listener works fine. When I use
the "home" button to minimize it, then open it again it's still fine.

But when I press the back button then run it again from the
application icon, the Listener doesn't work fully. The code runs and
the Listening methods are called as usual but none of the UI elements
that are listening update. It requires a restart of the phone to get
the listener working again after this point.

I know the "back" button doesn't really close the application, per se.
But resetting the phone sure does! Is there a way to use the
onDestroy() or similar method to call a function that actually closes
the application? I'm asking because restarting the phone is the only
way to get the listener back so I was hoping I could do that
programmatic ally.

For example, my progress bar is a member variable of my Activity, but
onCreate() I do "progressBar = (ProgressBar)
findViewById(R.id.progress_bar);" Is this perhaps creating a separate
instance of it or something?


Thanks!!

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


[android-developers] Append Text To Start Of TextView

2010-03-13 Thread Ben
I am trying to simply append a small string to the start of a TextView
without having to handle the whole log.

Was thinking of adding "main message CharSequence\n" to push whatever
is currently in the TextView to the next line.

Essentially trying to accomplish having an in-game combat log that
they don't have to scroll down to see the last round of combat.

Any help would be greatly appreciated.

Respectfully,
Ben

https://sites.google.com/site/defiledroid/

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


Re: [android-developers] Asynctask threads never end!

2010-03-13 Thread Ken Warner

Null out all references to the thread.  Java has a problem
with zombie threads -- this is a java app right?

I can't say exactly how you should do the following but make
sure there is an explicit way to exit each thread. I usually
set a flag to tell the thread to exit.

Those two things -- null all references and setting an explicit
exit flag are the most you can do.

After you null all references to the thread, do an explicit
gc() if that's available.

Gabriel Simões wrote:

Hello,

Today, while debugging and app that uses AsyncTask to record audio and
update UI I noticed that everytime that an AsyncTask object ends
running (finishes doInBackground() and onPostExecute() or
onCancelled()) it´s thread stays alive (running status).
At least for me that should not be the behavior of the class since the
doInBackground task may not stay running forever (as an example the
android manual says that a status bar should be updated by an
asynctask, and it won´t last for the whole app running time).

Is there anything I´m missing, as a method to destroy it, or should I
just ignore and keep creating threads as I need and the VM will handle
them as it needs resources?

Thank you,
Gabriel Simões



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


Re: [android-developers] Asynctask threads never end!

2010-03-13 Thread Mark Murphy
Gabriel Simões wrote:
> Hello,
> 
> Today, while debugging and app that uses AsyncTask to record audio and
> update UI I noticed that everytime that an AsyncTask object ends
> running (finishes doInBackground() and onPostExecute() or
> onCancelled()) it´s thread stays alive (running status).
> At least for me that should not be the behavior of the class since the
> doInBackground task may not stay running forever (as an example the
> android manual says that a status bar should be updated by an
> asynctask, and it won´t last for the whole app running time).
> 
> Is there anything I´m missing, as a method to destroy it, or should I
> just ignore and keep creating threads as I need and the VM will handle
> them as it needs resources?

AsyncTask uses a thread pool and manages that itself. You do not have to
worry about those threads, AFAICT.

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

Android App Developer Books: http://commonsware.com/books

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


Re: [android-developers] Re: OnPause() - how to resume to an activity which has a Bundle passed to it when it is created

2010-03-13 Thread Prajakta Shitole
Hi Makas,

Thanks for your suggestion, but when I tried changing it to singleTask, I
still could not start my activity. It kept giving me NullPointerException as
my activity expects a Bundle. I had even stored the values that I needed
from the bundle in my OnSaveInstance method, but dint get it to work.

However when I tried using a service and created a new activity I was able
to get my functionality running, but I would like to get the same activity
which was created earlier to the foreground.

I will look into this again by changing the launchModes and debugging and
will let you know if that worked.

Thanks,
Prajakta

On Sat, Mar 13, 2010 at 1:53 AM, Makas Tzavellas
wrote:

> Hi Prajakta,
>
> By default, an activity will be "destroyed" (onDestroyed() will be
> called) being called when the "back" button is called. E.g A calls B,
> and user presses the "back" button, then activity B will be destroyed.
> So from calling activity B again from activity A will create a new
> instance of activity B (onCreate() will be called).
>
> So if I understand you right, you would like to use the same instance
> of Activity B instead of recreating a new instance each time the
> Activity is called from other activities. Therefore, you *might* want
> to use "singleTask" as the Activity's "launchMode".
>
> You can find out more information from here.
>
> http://developer.android.com/guide/topics/fundamentals.html#lmodes
>
> On Mar 13, 9:25 am, Prajakta Shitole  wrote:
> > Hi Jeffrey,
> >
> > Thanks for the suggestion but I have activities and not views. I have
> > separate activities which are being called so I am not sure how I will be
> > able to achieve the same thing that you have implemented.
> >
> > Thanks,
> > Prajakta
> >
> > On Fri, Mar 12, 2010 at 10:19 AM, Jeffrey 
> wrote:
> > > What I have done with success in some of my apps is making several
> > > parent views that hold each layout within a table layout, and use the
> > > menu buttons to change the visibility of the parent view containing
> > > the info you want them to see. Since the view is never really closed,
> > > it's state is kept. Just use setVisibility(View.GONE) or View.VISIBILE
> > > and it should keep everything good.
> >
> > > Just make sure that each button press hides all the other parent views
> > > or else you will basically end up with two screens showing one after
> > > the other.
> >
> > > On Mar 12, 7:21 am, TreKing  wrote:
> > > > On Fri, Mar 12, 2010 at 12:28 AM, Prajakta Shitole <
> prajakt...@gmail.com
> > > >wrote:
> >
> > > > > One of my idea was to store the picture and the text view in the
> > > service
> > > > > and on click of a menu button navigate to another activity which
> will
> > > > > connect to the service and draw the stored pictures, text views in
> its
> > > > > activity.
> >
> > > > I haven't done anything like this but this seems like what you would
> want
> > > to
> > > > do.
> >
> > >
> ---­--
> > > > TreKing - Chicago transit tracking app for Android-powered
> deviceshttp://
> > > sites.google.com/site/rezmobileapps/treking
> >
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to
> android-developers@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > android-developers+unsubscr...@googlegroups.com
> 
> >
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
> >
> >
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

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

[android-developers] Asynctask threads never end!

2010-03-13 Thread Gabriel Simões
Hello,

Today, while debugging and app that uses AsyncTask to record audio and
update UI I noticed that everytime that an AsyncTask object ends
running (finishes doInBackground() and onPostExecute() or
onCancelled()) it´s thread stays alive (running status).
At least for me that should not be the behavior of the class since the
doInBackground task may not stay running forever (as an example the
android manual says that a status bar should be updated by an
asynctask, and it won´t last for the whole app running time).

Is there anything I´m missing, as a method to destroy it, or should I
just ignore and keep creating threads as I need and the VM will handle
them as it needs resources?

Thank you,
Gabriel Simões

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


[android-developers] Re: Java OpenGL ES 2.0 bindings project

2010-03-13 Thread MichaelEGR
On Mar 13, 7:50 am, Mario Zechner  wrote:
> Cool. Thanks for the flowers. The thing is apache 2 licensed so you
> are free to do with it whatever you want. It's not rocket science
> after all :). I'm not such a big fan of lwjgl but the more libraries
> there are out there for android the better.

Perhaps add the license to the source code as I missed it. What you
came up with may not be rocket science per se, but it was just one
more thing tacked onto a long list I'm trying to work through, so it's
excellent to see this get cleared away to enough satisfaction that
work can continue into 2.x land with no delay. And do send on that
Paypal email if you'd like; your effort saved me more than $50 of my
time! :)

The uncertainty factor for 2.x support with all the other anxiety/
stress in getting the project I'm working on out adds up. I'm pretty
impartial regarding bindings as I support JOGL, LWJGL, and Android
OpenGL ES with Typhon (the middleware I'm releasing for desktop &
Android), but I do like the history and community in general
surrounding LWJGL and that perhaps has something to do with being a
part of JGO (www.javagaming.org) for quite some time. Having a
separate community driven binding is always a good thing and keeps the
big corps on their toes at least a little.

> On 13 Mrz., 16:19, MichaelEGR  wrote:
>
> > Figured I'd repost in this thread and include the variable time kill
> > frag test...
>
> > Awesome! Got it up and running here. You are my Android dev hero for
> > the month if not longer!

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


[android-developers] Re: Sending huge files with HttpsUrlConnection???

2010-03-13 Thread AuxOne
Sorry for the double post. I reloaded the page

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


[android-developers] Re: Sending huge files with HttpsUrlConnection???

2010-03-13 Thread AuxOne
I tried os.flush() as you recommended previously, it did not work. I
even set large chunks and did System.gc() in the loop, that didn't
work. Then I even tried putting the System.gc() after I close the
connection, but the heap still remains quite large.

When I transfer a bunch photos (say, 50 for example) I see the heap
grow occasionally but shrink again staying within 5-8M. When sending 2
videos I can get the first one to work, but the heap never shrinks
down low enough before the next video tries to send and I get the
error. Granted, that is a moot point as any single large video would
fail and I need support for any large file.

Thanks!

On Mar 13, 5:05 am, Makas Tzavellas  wrote:
> Hi,
>
> There is no guarantee that this will work, but try placing
> "os.flush()" in your loop. Which in theory tells the outputstream
> implementation to write out the buffered data.
>
> E.g
>
> while ((len = is.read(buffer)) != -1){
> os.write(buffer, 0, len);
> os.flush();
>
> }
>
> I haven't looked at the underlying implementation of org.apache.http
> package in Android. But perhaps it is worth investigating if you
> continue to have problems.
>
> Makas
> On Mar 13, 8:17 am, AuxOne  wrote:
>
> > I have some Android code that can sendfilesto my webserver using an
> >HttpsUrlConnection, but when it tries to send largerfilesI get an
> > OutOfMemory exception when opening the OutputStream. Can anyone offer
> > some assistance?
>
> > It looks something like this:
>
> > httpConn = (HttpsURLConnection) new URL(uri).openConnection();
> > httpConn.setDoInput(true);
> > httpConn.setDoOutput(true);
> > httpConn.setUseCaches(false);
> > httpConn.setRequestMethod("POST");
>
> > This is where I try different things. The closes solution has been:
> > httpConn.setChunkedStreamingMode(1024);
> > In this case, I don't get the OutOfMemory immediately when opening the
> > OutputStream, but I see the heap growing as I os.write() and it
> > eventually runs out.
>
> > httpConn.connect();
> > OutputStream os = httpConn.getOutputStream();
> > byte[] buffer = new byte[4096];
> > int len;
> > while ((len = is.read(buffer)) != -1){
> > os.write(buffer, 0, len);}
>
> > os.flush();
>
> > Each time I open the .getOutputStream() the contents of the file I am
> > trying to send is loaded into memory, per the discussion here (http://
> > bugs.sun.com/bugdatabase/view_bug.do?bug_id=4212479) -- so I go out of
> > memory.
>
> > My server supports HTTP 1.1. I've tried the following code.
> > 1. httpConn.setRequestProperty("Transfer-Encoding","chunked");
> > 2. httpConn.setChunkedStreamingMode(1024);
> > 3. httpConn.setRequestProperty("Content-Length", length);
> > 4. httpConn.setFixedLengthStreamingMode(1024)
> > 5. Combo of 1+2.
> > 6. Combo of 3+4
>
> > Can anyone offer any assistance?! It seems like no matter what, the
> > data going to the OutputStream is being buffered. ChunkedStreamMode
> > seems to just buffer it in pieces, whereas it would otherwise buffer
> > it all at once. Both go out of memory.
>
> > Thanks in advance.
>
> > PS> I have similar code for J2ME and memory has not been a problem.
> > Also, if I try to send two medium sizedfilesin a row, the first one
> > makes it, but then the heap doesn't seem to compact and the second one
> > fails.
>
>

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


Re: [android-developers] Re: Sending huge files with HttpsUrlConnection???

2010-03-13 Thread Mark Murphy
AuxOne wrote:
> I tried os.flush() as you recommended previously, it did not work. I
> even set large chunks and did System.gc() in the loop, that didn't
> work. Then I even tried putting the System.gc() after I close the
> connection, but the heap still remains quite large.
> 
> When I transfer a bunch photos (say, 50 for example) I see the heap
> grow occasionally but shrink again staying within 5-8M. When sending 2
> videos I can get the first one to work, but the heap never shrinks
> down low enough before the next video tries to send and I get the
> error. Granted, that is a moot point as any single large video would
> fail and I need support for any large file.

Try switching to HttpClient and following this example:

http://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.0.x/httpclient/src/examples/org/apache/http/examples/client/ClientChunkEncodedPost.java

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

_Android Programming Tutorials_ Version 2.0 Available!

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


[android-developers] Re: Sending huge files with HttpsUrlConnection???

2010-03-13 Thread AuxOne
I tried os.flush() as you recommended previously, it did not work. I
even set large chunks and did System.gc() in the loop, that didn't
work. Then I even tried putting the System.gc() after I close the
connection, but the heap still remains quite large.

When I transfer a bunch photos (say, 50 for example) I see the heap
grow occasionally but shrink again staying within 5-8M. When sending 2
videos I can get the first one to work, but the heap never shrinks
down low enough before the next video tries to send and I get the
error. Granted, that is a moot point as any single large video would
fail and I need support for any large file.

Thanks!

On Mar 13, 5:05 am, Makas Tzavellas  wrote:
> Hi,
>
> There is no guarantee that this will work, but try placing
> "os.flush()" in your loop. Which in theory tells the outputstream
> implementation to write out the buffered data.
>
> E.g
>
> while ((len = is.read(buffer)) != -1){
> os.write(buffer, 0, len);
> os.flush();
>
> }
>
> I haven't looked at the underlying implementation of org.apache.http
> package in Android. But perhaps it is worth investigating if you
> continue to have problems.
>
> Makas
> On Mar 13, 8:17 am, AuxOne  wrote:
>
> > I have some Android code that can sendfilesto my webserver using an
> >HttpsUrlConnection, but when it tries to send largerfilesI get an
> > OutOfMemory exception when opening the OutputStream. Can anyone offer
> > some assistance?
>
> > It looks something like this:
>
> > httpConn = (HttpsURLConnection) new URL(uri).openConnection();
> > httpConn.setDoInput(true);
> > httpConn.setDoOutput(true);
> > httpConn.setUseCaches(false);
> > httpConn.setRequestMethod("POST");
>
> > This is where I try different things. The closes solution has been:
> > httpConn.setChunkedStreamingMode(1024);
> > In this case, I don't get the OutOfMemory immediately when opening the
> > OutputStream, but I see the heap growing as I os.write() and it
> > eventually runs out.
>
> > httpConn.connect();
> > OutputStream os = httpConn.getOutputStream();
> > byte[] buffer = new byte[4096];
> > int len;
> > while ((len = is.read(buffer)) != -1){
> > os.write(buffer, 0, len);}
>
> > os.flush();
>
> > Each time I open the .getOutputStream() the contents of the file I am
> > trying to send is loaded into memory, per the discussion here (http://
> > bugs.sun.com/bugdatabase/view_bug.do?bug_id=4212479) -- so I go out of
> > memory.
>
> > My server supports HTTP 1.1. I've tried the following code.
> > 1. httpConn.setRequestProperty("Transfer-Encoding","chunked");
> > 2. httpConn.setChunkedStreamingMode(1024);
> > 3. httpConn.setRequestProperty("Content-Length", length);
> > 4. httpConn.setFixedLengthStreamingMode(1024)
> > 5. Combo of 1+2.
> > 6. Combo of 3+4
>
> > Can anyone offer any assistance?! It seems like no matter what, the
> > data going to the OutputStream is being buffered. ChunkedStreamMode
> > seems to just buffer it in pieces, whereas it would otherwise buffer
> > it all at once. Both go out of memory.
>
> > Thanks in advance.
>
> > PS> I have similar code for J2ME and memory has not been a problem.
> > Also, if I try to send two medium sizedfilesin a row, the first one
> > makes it, but then the heap doesn't seem to compact and the second one
> > fails.
>
>

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


[android-developers] Re: TextView before ListView

2010-03-13 Thread Brion Emde
Thank you, Mark, that is indeed good to know and a nice addition.

I am indeed targeting 1.6, so I could have used this. I'm sure there
were situations under the previous rules that things could not be done
easily, or maybe at all.

For me, things are working correctly using the pre-1.6 rules, so I'll
let sleeping dogs lie until changes are required.



On Mar 13, 8:05 am, Mark Murphy  wrote:
> Brion Emde wrote:
> > RelativeLayout makes only a single pass through your XML to
> > determine the Ids and collect the layout information.
>
> That is not true, as of Android 1.6.
>
> It didn't get much publicity, but RelativeLayout now supports forward
> references. The key is you need to use the + sign on the *first
> occurrence* of the ID:
>
> 
>          xmlns:android="http://schemas.android.com/apk/res/android";
>         android:layout_width="fill_parent"
>         android:layout_height="wrap_content"
>         android:padding="5px">
>                          android:layout_width="wrap_content"
>                 android:layout_height="wrap_content"
>                 android:text="URL:"
>                 android:layout_alignBaseline="@+id/entry"
>                 android:layout_alignParentLeft="true"/>
>                          android:id="@id/entry"
>                 android:layout_width="fill_parent"
>                 android:layout_height="wrap_content"
>                 android:layout_toRightOf="@id/label"
>                 android:layout_alignParentTop="true"/>
>                          android:id="@+id/ok"
>                 android:layout_width="wrap_content"
>                 android:layout_height="wrap_content"
>                 android:layout_below="@id/entry"
>                 android:layout_alignRight="@id/entry"
>                 android:text="OK" />
>                          android:id="@+id/cancel"
>                 android:layout_width="wrap_content"
>                 android:layout_height="wrap_content"
>                 android:layout_toLeftOf="@id/ok"
>                 android:layout_alignTop="@id/ok"
>                 android:text="Cancel" />
> 
>
> Here, the first reference to the ID of "entry" is in:
>
> android:layout_alignBaseline="@+id/entry"
>
> That means we can skip the + sign in the corresponding android:id attribute:
>
>          android:id="@id/entry"
>
> So long as you are still targeting Android 1.5, I would not rely upon
> this. However, once Android 1.5 is in your rear-view mirror, you gain
> more flexibility.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Android Training in NYC: 10-11 April 2010:http://guruloft.com

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


[android-developers] I need a recommendation for some kind of Android device to test 2.1 app on.

2010-03-13 Thread Ken Warner

I'm setting up to rewrite my Java panorama viewer for Android.
I'll be using Eclipse on W7 for development platform.

I'll need some sort of *CHEAP* probably un-activated device -- maybe
a phone -- maybe a netbook -- I don't know -- that's what I'm asking.

It has to have GPS for geotagging and accelerometers for control
of pan/tilt by motion. OpenGL ES is important.  It will be a
texture mapping graphics app.

Any suggestions for a reliable, *CHEAP* Android device with those
characteristics?

See my applet here --

Flash: http://pancyl.com/Driveway.html
Java: http://pancyl.com/BloodMountain.htm

Click drag to pan/tilt -- mousewheel to zoom --

Fullscreen Java - 'f'
Fullscreen Flash - bottom right center button

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


[android-developers] Re: Java OpenGL ES 2.0 bindings project

2010-03-13 Thread Mario Zechner
Cool. Thanks for the flowers. The thing is apache 2 licensed so you
are free to do with it whatever you want. It's not rocket science
after all :). I'm not such a big fan of lwjgl but the more libraries
there are out there for android the better.

On 13 Mrz., 16:19, MichaelEGR  wrote:
> Figured I'd repost in this thread and include the variable time kill
> frag test...
>
> Awesome! Got it up and running here. You are my Android dev hero for
> the month if not longer! Where I can I paypal you $50; I'd send more
> if I could right now.. You also got a life long purchaser of all your
> games on the market. Folks... Support Mario and buy his games! I like
> your Newton game by the way! :)
>
> I knew this was a trivial, but perhaps tedious exercise, so thanks for
> stepping up _and_ sharing your work / effort.
>
> I'm also rabble rousing now on the LWJGL community forums to get an ES
> version of LWJGL ported to Android. That would be absolutely fantastic
> as Slick2D plus many other LWJGL games could make it to Android sooner
> rather than later with few changes from their desktop counterparts.
>
> I'm not sure what license you may want to attribute to your work, but
> perhaps MIT or a completely open license that doesn't conflict with
> anything.
>
> If you need any further assistance I have a bunch of Android devices I
> can test on, but things work fine on the Droid / N1!
>
> Again you rock!!! This is fantastic..
>
> The following is a slightly modified test that has a variable time
> kill fragment shader:
> -
> package com.badlogic.gdx;
>
> import java.nio.ByteBuffer;
> import java.nio.ByteOrder;
> import java.nio.FloatBuffer;
> import java.nio.IntBuffer;
>
> import javax.microedition.khronos.egl.EGL10;
> import javax.microedition.khronos.egl.EGLConfig;
> import javax.microedition.khronos.egl.EGLContext;
> import javax.microedition.khronos.egl.EGLDisplay;
> import javax.microedition.khronos.opengles.GL10;
>
> import android.view.Menu;
> import android.view.MenuItem;
> import com.badlogic.gdx.backends.android.AndroidGL20;
> import com.badlogic.gdx.backends.android.surfaceview.GLSurfaceView;
> import com.badlogic.gdx.backends.android.surfaceview.GLSurfaceView20;
> import
> com.badlogic.gdx.backends.android.surfaceview.GLSurfaceView.Renderer;
> import com.badlogic.gdx.graphics.GL20;
>
> import android.app.Activity;
> import android.content.Context;
> import android.os.Bundle;
> import android.util.Log;
>
> public class GL2Test extends Activity
> {
>    GLSurfaceView view;
>    int appCutoff1, appCutoff2;
>    long startTime;
>    int equationIndex = 0;
>
>    /**
>     * Called when the activity is first created.
>     */
>   �...@override
>    public void onCreate(Bundle savedInstanceState)
>    {
>       super.onCreate(savedInstanceState);
>
>       if (checkGL20Support(this))
>          view = new GLSurfaceView20(this);
>       else
>          view = new GLSurfaceView(this);
>
>       view.setRenderer(new TestRenderer());
>       setContentView(view);
>    }
>
>    public boolean onCreateOptionsMenu(Menu menu)
>    {
>       Menu menuEquations = menu.addSubMenu(10, 10, 0, "Kill Frag
> Equations (t == time)");
>       menuEquations.add(10, 0, 0, "x: .5 y: cos(t)");
>       menuEquations.add(10, 1, 1, "x: sin(t) y: .2");
>       menuEquations.add(10, 2, 2, "x: sin(t) y: cos(t)");
>       menuEquations.add(10, 3, 3, "x: sin(t)/2 y: cos(t)/2");
>       menuEquations.add(10, 4, 4, "x: .5*sin(3*t+4) y: .5*sin(t)");
>       menuEquations.add(10, 5, 5, "all killed; x&y: -1");
>       menuEquations.add(10, 6, 6, "none killed; x&y: 1");
>       return true;
>    }
>
>    public boolean onOptionsItemSelected(MenuItem item)
>    {
>       if (item.getItemId() <= 6)
>          equationIndex = item.getItemId();
>       return true;
>    }
>
>    protected void onPause()
>    {
>       super.onPause();
>       view.onPause();
>    }
>
>    protected void onResume()
>    {
>       super.onResume();
>       view.onResume();
>    }
>
>    private boolean checkGL20Support(Context context)
>    {
>       EGL10 egl = (EGL10) EGLContext.getEGL();
>       EGLDisplay display =
> egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
>
>       int[] version = new int[2];
>       egl.eglInitialize(display, version);
>
>       int EGL_OPENGL_ES2_BIT = 4;
>       int[] configAttribs =
>               {
>                       EGL10.EGL_RED_SIZE, 4,
>                       EGL10.EGL_GREEN_SIZE, 4,
>                       EGL10.EGL_BLUE_SIZE, 4,
>                       EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
>                       EGL10.EGL_NONE
>               };
>
>       EGLConfig[] configs = new EGLConfig[10];
>       int[] num_config = new int[1];
>       egl.eglChooseConfig(display, configAttribs, configs, 10,
> num_config);
>       egl.eglTerminate(display);
>       return num_config[0] > 0;
>    }
>
>    class TestRenderer implements Renderer
>    {
>       AndroidGL20 gl2 = new Androi

[android-developers] Re: Live Wallpapers. Cant get actions like android.wallpaper.tap

2010-03-13 Thread STKFF
Does it have something to do with using an Android Virtual Device ? My
Android phone is still on 1.6 version. I can't test on a real device.
I planned to use both "android.wallpaper.tap" and "android.home.drop"
to let users interact with the Live Wallpaper I'm developping. But
now, I'm stuck...


On 8 mar, 08:15, STKFF  wrote:
> I'm facing the very same issue. Did you find the solution ?
>
> On 11 fév, 03:52, vovkab  wrote:
>
>
>
> > Can't get actions like:
> > # android.wallpaper.tap
> > # android.home.drop
>
> > I tried on CubeWallpaperexample by adding to CubeEngine class:
> >                 @Override
> >                 public BundleonCommand(String action, int x, int y, int z, 
> > Bundle
> > extras,
> >                                 boolean resultRequested) {
> >                         System.out.println("action" + action);
> >                         return super.onCommand(action, x, y, z, extras, 
> > resultRequested);
> >                 }
>
> > No actions happens by tapping dropping and etc.

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


[android-developers] Re: Disable spinner item?

2010-03-13 Thread extrapedestrian
I did another workaround.

Since I implement SpinnerAdapter, In function GetDropdownView, I check
if item at position x should be disabled, then I make that view (row)
disabled. Unfortunately, SetEnabled(false) is not working on this
view, so I found workaround, like this:

row.SetClickable(true); //makes item unresponsive to clicks(?)
//grayout text and icon
TextView.SetTextColor(Color.LTGRAY);
Image.getDrawable().mutate().setAlpha(70);

so it looks disabled and doesn't respond to clicks.

hate workarounds...

On Jan 29, 4:07 pm, Piwai  wrote:
> Hi there !
>
> I spent a bit of time trying to create a spinner that would have some
> disabled items, and finally found a SOLUTION ! Yay !
>
> Romain pointed in the right direction, BUT it's not that easy.
>
> If one try to create a specific adapter for the spinner, for
> instance :
>
> ArrayAdapter spinnerAdapter = new ArrayAdapter(this,
> android.R.layout.simple_spinner_item,filters) {
>   public boolean isEnabled(int position) {
>     // Specific code to decide whether it's enabled or not
>   }
>   public boolean areAllItemsEnabled() {
>     return false;
>   }};
>
> spinner.setAdapter(spinnerAdapter);
> => DOESN'T work yet
>
> When you click on a spinner, it opens a dialog with the items feeded
> from the adapter.
>
> BUT the adapter is wrapped by the spinner class into a DropDownAdapter
> (private class inside the spinner class).
>
> This wrapper delegates almost all method calls, except...
>
> public boolean areAllItemsEnabled() {
>   return true;
>
> }
>
> public boolean isEnabled(int position) {
>   return true;
>
> }
>
> I don't know if there's a real reason for that. The delegate is
> wrapped as as SpinnerAdapter, which doesn't hold those methods.
>
> So the solution was pretty simple thought a bit dirty : extends
> Spinner, override performClick() (this is were the adapter is
> wrapped), and basically do the same thing as a spinner, but with a
> patched DropDownAdapter :
>
> /**
>  * A patcher spinner so that the wrapping drop down adapter delegates
>  * areAllItemsEnabled and isEnabled calls to the wrapped adapter.
>  */
> public class PatchedSpinner extends Spinner {
>
>     public PatchedSpinner(Context context, AttributeSet attrs, int
> defStyle) {
>         super(context, attrs, defStyle);
>     }
>     public PatchedSpinner(Context context) {
>         super(context);
>     }
>     public PatchedSpinner(Context context, AttributeSet attrs) {
>         super(context, attrs);
>     }
>
>     @Override
>     public boolean performClick() {
>
>         // boolean handled = super.performClick(); => this line
> removed, we do not want to delegate the click to the spinner.
>
>         Context context = getContext();
>
>         final DropDownAdapter adapter = new DropDownAdapter(getAdapter
> ());
>
>         CharSequence mPrompt = getPrompt();
>
>         AlertDialog.Builder builder = new AlertDialog.Builder
> (context);
>         if (mPrompt != null) {
>             builder.setTitle(mPrompt);
>         }
>         builder.setSingleChoiceItems(adapter, getSelectedItemPosition
> (), this).show();
>
>         return true;
>     }
>
>     private static class DropDownAdapter implements ListAdapter,
> SpinnerAdapter {
>         private SpinnerAdapter mAdapter;
>
>         public DropDownAdapter(SpinnerAdapter adapter) {
>             mAdapter = adapter;
>         }
>
>         public int getCount() {
>             return mAdapter == null ? 0 : mAdapter.getCount();
>         }
>
>         public Object getItem(int position) {
>             return mAdapter == null ? null : mAdapter.getItem
> (position);
>         }
>
>         public long getItemId(int position) {
>             return mAdapter == null ? -1 : mAdapter.getItemId
> (position);
>         }
>
>         public View getView(int position, View convertView, ViewGroup
> parent) {
>             return getDropDownView(position, convertView, parent);
>         }
>
>         public View getDropDownView(int position, View convertView,
> ViewGroup parent) {
>             return mAdapter == null ? null : mAdapter.getDropDownView
> (position, convertView, parent);
>         }
>
>         public boolean hasStableIds() {
>             return mAdapter != null && mAdapter.hasStableIds();
>         }
>
>         public void registerDataSetObserver(DataSetObserver observer)
> {
>             if (mAdapter != null) {
>                 mAdapter.registerDataSetObserver(observer);
>             }
>         }
>
>         public void unregisterDataSetObserver(DataSetObserver
> observer) {
>             if (mAdapter != null) {
>                 mAdapter.unregisterDataSetObserver(observer);
>             }
>         }
>
>         // PATCHED
>         public boolean areAllItemsEnabled() {
>             if (mAdapter instanceof BaseAdapter) {
>                 return ((BaseAdapter) mAdapter).areAllItemsEnabled();
>             } else {
>                 return true;
>             }
>         }
>
>         // PATCHED
>         p

Re: [android-developers] Sending custom headers in WebView

2010-03-13 Thread Mark Murphy
kelvin wrote:
> I've found some information about this topic, but I was curious as to
> whether anyone has had any success loading webpages in a WebView with
> custom headers.  There doesn't seem to be any simple way of doing
> this. 

There is no WebView API for setting custom headers, mostly because Web
browsers don't usually send custom headers. It's not like you can link
to a Web page and embed custom headers into the link.

AFAIK, custom headers is a technique mostly for Web services (which
wouldn't use WebView) or for browser plug-ins (which Android doesn't
support at the SDK level).

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

_The Busy Coder's Guide to *Advanced* Android Development_
Version 1.3 Available!

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


[android-developers] Re: Java OpenGL ES 2.0 bindings project

2010-03-13 Thread MichaelEGR
Figured I'd repost in this thread and include the variable time kill
frag test...

Awesome! Got it up and running here. You are my Android dev hero for
the month if not longer! Where I can I paypal you $50; I'd send more
if I could right now.. You also got a life long purchaser of all your
games on the market. Folks... Support Mario and buy his games! I like
your Newton game by the way! :)

I knew this was a trivial, but perhaps tedious exercise, so thanks for
stepping up _and_ sharing your work / effort.

I'm also rabble rousing now on the LWJGL community forums to get an ES
version of LWJGL ported to Android. That would be absolutely fantastic
as Slick2D plus many other LWJGL games could make it to Android sooner
rather than later with few changes from their desktop counterparts.

I'm not sure what license you may want to attribute to your work, but
perhaps MIT or a completely open license that doesn't conflict with
anything.

If you need any further assistance I have a bunch of Android devices I
can test on, but things work fine on the Droid / N1!

Again you rock!!! This is fantastic..

The following is a slightly modified test that has a variable time
kill fragment shader:
-
package com.badlogic.gdx;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;

import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLContext;
import javax.microedition.khronos.egl.EGLDisplay;
import javax.microedition.khronos.opengles.GL10;

import android.view.Menu;
import android.view.MenuItem;
import com.badlogic.gdx.backends.android.AndroidGL20;
import com.badlogic.gdx.backends.android.surfaceview.GLSurfaceView;
import com.badlogic.gdx.backends.android.surfaceview.GLSurfaceView20;
import
com.badlogic.gdx.backends.android.surfaceview.GLSurfaceView.Renderer;
import com.badlogic.gdx.graphics.GL20;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;

public class GL2Test extends Activity
{
   GLSurfaceView view;
   int appCutoff1, appCutoff2;
   long startTime;
   int equationIndex = 0;

   /**
* Called when the activity is first created.
*/
   @Override
   public void onCreate(Bundle savedInstanceState)
   {
  super.onCreate(savedInstanceState);

  if (checkGL20Support(this))
 view = new GLSurfaceView20(this);
  else
 view = new GLSurfaceView(this);

  view.setRenderer(new TestRenderer());
  setContentView(view);
   }

   public boolean onCreateOptionsMenu(Menu menu)
   {
  Menu menuEquations = menu.addSubMenu(10, 10, 0, "Kill Frag
Equations (t == time)");
  menuEquations.add(10, 0, 0, "x: .5 y: cos(t)");
  menuEquations.add(10, 1, 1, "x: sin(t) y: .2");
  menuEquations.add(10, 2, 2, "x: sin(t) y: cos(t)");
  menuEquations.add(10, 3, 3, "x: sin(t)/2 y: cos(t)/2");
  menuEquations.add(10, 4, 4, "x: .5*sin(3*t+4) y: .5*sin(t)");
  menuEquations.add(10, 5, 5, "all killed; x&y: -1");
  menuEquations.add(10, 6, 6, "none killed; x&y: 1");
  return true;
   }

   public boolean onOptionsItemSelected(MenuItem item)
   {
  if (item.getItemId() <= 6)
 equationIndex = item.getItemId();
  return true;
   }

   protected void onPause()
   {
  super.onPause();
  view.onPause();
   }

   protected void onResume()
   {
  super.onResume();
  view.onResume();
   }

   private boolean checkGL20Support(Context context)
   {
  EGL10 egl = (EGL10) EGLContext.getEGL();
  EGLDisplay display =
egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

  int[] version = new int[2];
  egl.eglInitialize(display, version);

  int EGL_OPENGL_ES2_BIT = 4;
  int[] configAttribs =
  {
  EGL10.EGL_RED_SIZE, 4,
  EGL10.EGL_GREEN_SIZE, 4,
  EGL10.EGL_BLUE_SIZE, 4,
  EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
  EGL10.EGL_NONE
  };

  EGLConfig[] configs = new EGLConfig[10];
  int[] num_config = new int[1];
  egl.eglChooseConfig(display, configAttribs, configs, 10,
num_config);
  egl.eglTerminate(display);
  return num_config[0] > 0;
   }

   class TestRenderer implements Renderer
   {
  AndroidGL20 gl2 = new AndroidGL20();
  FloatBuffer vertices;
  int program;
  int viewportWidth, viewportHeight;

  private float calculate(int cutoff, int equation, float time)
  {
 switch (equation)
 {
default:
case 0:
   return cutoff == 0 ? 0.5f : (float) Math.cos(time);
case 1:
   return cutoff == 0 ? (float) Math.sin(time) : 0.2f;
case 2:
   return cutoff == 0 ? (float) Math.sin(time) : (float)
Math.cos(time);
case 3:
   retu

Re: [android-developers] Re: AlarmManager on droids

2010-03-13 Thread Mark Murphy
mot12 wrote:
> No customer could give me a definitive guide to reproduce the problem.
> But doing the following should give you good chance to make it happen
> on your device:
> - turn on airplane mode to cancel much of the background activity
> - turn off any services, apps running in the background
> - let the device sit with the screen off for several hours (no alarms
> during this time)

You do realize that this isn't possible. The operating system has
services. Built-in Android apps have services.

Besides, what's the point of a phone that is permanently in airplane mode?

I don't have a problem with doing bits of research here and there, but
this has spiraled into "it's never going to affect enough people" status.

If you come up with probable steps to reproduce the issue that would
suggest that the problem might affect a substantial number of users,
drop me a line.

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

Android Training in NYC: 10-11 April 2010: http://guruloft.com

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


[android-developers] Re: OpenGL ES 2.0 on Eclair

2010-03-13 Thread MichaelEGR
On Mar 13, 2:43 am, Mario Zechner  wrote:
> Sorry for the double post, just had to add one more thing.
> I understand that many of your are a bit angry for there being no java
> bindings at this time. But from an architectural point of view i
> totally understand Romain's comment that they want to get it right.

Indeed.. Getting it right for the consumer and official release is one
thing, but developers don't need a perfect design to build their next
gen GL 2.x engine. We just needed that 4 hour developer interim fix or
thereabout (maybe there is a little more to clean up / fix?).

There are a lot of great things about Android and I'm glad appropriate
time may be spent to get GL 2.x support done right. I've always
wondered if the Android dev team is understaffed / stretched thin at
times, but overall Android is great and I look forward to the final
release of GL2.x Java API.. Until then we can develop our next gen
titles _now_.. :)

Thanks again Mario.. This had me staying up way late... Goodness.. 7am
here.. ;)

Let me know if there is any way I can help or any additional cleanup
work required. I'll test things out more soon, but it's back GL 1.x
for at least a month or so more for me...

Regards...

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


[android-developers] Re: OpenGL ES 2.0 on Eclair

2010-03-13 Thread MichaelEGR
Awesome! Got it up and running here. You are my Android dev hero for
the month if not longer! Where I can I paypal you $50; I'd send more
if I could right now.. You also got a life long purchaser of all your
games on the market. Folks... Support Mario and buy his games! I like
your Newton game by the way! :)

I knew this was a trivial, but perhaps tedious exercise, so thanks for
stepping up _and_ sharing your work / effort.

I'm also rabble rousing now on the LWJGL community forums to get an ES
version of LWJGL ported to Android. That would be absolutely fantastic
as Slick2D plus many other LWJGL games could make it to Android sooner
rather than later with few changes from their desktop counterparts.

I'm not sure what license you may want to attribute to your work, but
perhaps MIT or a completely open license that doesn't conflict with
anything.

If you need any further assistance I have a bunch of Android devices I
can test on, but things work fine on the Droid / N1!

Again you rock!!! This is fantastic..

The following is a slightly modified test that has a variable time
kill fragment shader:
-
package com.badlogic.gdx;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;

import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLContext;
import javax.microedition.khronos.egl.EGLDisplay;
import javax.microedition.khronos.opengles.GL10;

import android.view.Menu;
import android.view.MenuItem;
import com.badlogic.gdx.backends.android.AndroidGL20;
import com.badlogic.gdx.backends.android.surfaceview.GLSurfaceView;
import com.badlogic.gdx.backends.android.surfaceview.GLSurfaceView20;
import
com.badlogic.gdx.backends.android.surfaceview.GLSurfaceView.Renderer;
import com.badlogic.gdx.graphics.GL20;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;

public class GL2Test extends Activity
{
   GLSurfaceView view;
   int appCutoff1, appCutoff2;
   long startTime;
   int equationIndex = 0;

   /**
* Called when the activity is first created.
*/
   @Override
   public void onCreate(Bundle savedInstanceState)
   {
  super.onCreate(savedInstanceState);

  if (checkGL20Support(this))
 view = new GLSurfaceView20(this);
  else
 view = new GLSurfaceView(this);

  view.setRenderer(new TestRenderer());
  setContentView(view);
   }

   public boolean onCreateOptionsMenu(Menu menu)
   {
  Menu menuEquations = menu.addSubMenu(10, 10, 0, "Kill Frag
Equations (t == time)");
  menuEquations.add(10, 0, 0, "x: .5 y: cos(t)");
  menuEquations.add(10, 1, 1, "x: sin(t) y: .2");
  menuEquations.add(10, 2, 2, "x: sin(t) y: cos(t)");
  menuEquations.add(10, 3, 3, "x: sin(t)/2 y: cos(t)/2");
  menuEquations.add(10, 4, 4, "x: .5*sin(3*t+4) y: .5*sin(t)");
  menuEquations.add(10, 5, 5, "all killed; x&y: -1");
  menuEquations.add(10, 6, 6, "none killed; x&y: 1");
  return true;
   }

   public boolean onOptionsItemSelected(MenuItem item)
   {
  if (item.getItemId() <= 6)
 equationIndex = item.getItemId();
  return true;
   }

   protected void onPause()
   {
  super.onPause();
  view.onPause();
   }

   protected void onResume()
   {
  super.onResume();
  view.onResume();
   }

   private boolean checkGL20Support(Context context)
   {
  EGL10 egl = (EGL10) EGLContext.getEGL();
  EGLDisplay display =
egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

  int[] version = new int[2];
  egl.eglInitialize(display, version);

  int EGL_OPENGL_ES2_BIT = 4;
  int[] configAttribs =
  {
  EGL10.EGL_RED_SIZE, 4,
  EGL10.EGL_GREEN_SIZE, 4,
  EGL10.EGL_BLUE_SIZE, 4,
  EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
  EGL10.EGL_NONE
  };

  EGLConfig[] configs = new EGLConfig[10];
  int[] num_config = new int[1];
  egl.eglChooseConfig(display, configAttribs, configs, 10,
num_config);
  egl.eglTerminate(display);
  return num_config[0] > 0;
   }

   class TestRenderer implements Renderer
   {
  AndroidGL20 gl2 = new AndroidGL20();
  FloatBuffer vertices;
  int program;
  int viewportWidth, viewportHeight;

  private float calculate(int cutoff, int equation, float time)
  {
 switch (equation)
 {
default:
case 0:
   return cutoff == 0 ? 0.5f : (float) Math.cos(time);
case 1:
   return cutoff == 0 ? (float) Math.sin(time) : 0.2f;
case 2:
   return cutoff == 0 ? (float) Math.sin(time) : (float)
Math.cos(time);
case 3:
   return cutoff == 0 ? (float) Math.sin(time) / 2f :
(float) Math.cos(time) / 2f;
   

Re: [android-developers] Re: TextView before ListView

2010-03-13 Thread Mark Murphy
Brion Emde wrote:
> RelativeLayout makes only a single pass through your XML to
> determine the Ids and collect the layout information.

That is not true, as of Android 1.6.

It didn't get much publicity, but RelativeLayout now supports forward
references. The key is you need to use the + sign on the *first
occurrence* of the ID:


http://schemas.android.com/apk/res/android";
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="5px">






Here, the first reference to the ID of "entry" is in:

android:layout_alignBaseline="@+id/entry"

That means we can skip the + sign in the corresponding android:id attribute:

http://commonsware.com | http://twitter.com/commonsguy

Android Training in NYC: 10-11 April 2010: http://guruloft.com

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


Re: [android-developers] Re: Photoshop.com Mobile editor now available as an Intent

2010-03-13 Thread nayana urs
can we test this feature in emulator
with regards
   Nayana


On Fri, Mar 12, 2010 at 6:18 PM, Nivek  wrote:

> > They could have added the result to the MediaStore and returned that
> > uri... I'll have to do it myself or my edit button disappears after
> > editing a picture...
>
> Actually, this is what I will have to do as a workaround, but I can't
> see any reason why they shouldn't accept a file:// uri as an input !
>
> Kevin
>
>
> On 13 mar, 03:10, Nivek  wrote:
> > There is an inconsistency in their Uri handling... The app accepts
> > only content:// Uris but provides the result as a file:// Uri... so it
> > can't edit it's own result again without us having to work this
> > around...
> >
> > They could have added the result to the MediaStore and returned that
> > uri... I'll have to do it myself or my edit button disappears after
> > editing a picture...
> >
> > I think Adobe should fix this.
> >
> > Kevin
> >
> > On 11 mar, 16:43, webmonkey  wrote:
> >
> >
> >
> > > The document provided by Adobe does not mention how you should read
> > > the returned Uri. For compatibility with future versions and other
> > > image editors, you should not assume that it is a 'file:' scheme Uri,
> > > it could also be a 'content:' scheme Uri. The ContentResolver will
> > > handle it. here is the code:
> >
> > > @Override
> > > public void onActivityResult(int requestCode, int resultCode, Intent
> > > data)
> > > {
> > > super.onActivityResult(requestCode, resultCode, data);
> > > if (requestCode == LAUNCH_EDITOR)
> > > {
> > > if (resultCode == Activity.RESULT_OK)
> > > {
> > > Uri savedImage = data.getData();
> > > // savedImage is the Uri for the newly created
> > > // edited version of the original image.
> >
> > > ContentResolver cr = getContentResolver();
> >
> > > InputStream in = null;
> > > try {
> > >  in = cr.openInputStream(savedImage);
> > >  // you now have an InputStream to the saved image
> > >  // you can copy it by saving to an OutputStream
> > >  // or you can load it as a Bitmap
> > >  Bitmap bitmap = BitmapFactory.decodeStream(in);
> >
> > > } catch (IOException e)
> > > {
> > > }
> > > }
> > > else
> > > {
> > > // Edit Operation canceled by user
> > > }
> > > }
> >
> > > }
> >
> > > On Mar 5, 9:10 pm, Adobe DI Mobile  wrote:
> >
> > > > ThePhotoshop.com Mobile editor is now available to the Android
> > > > developer community as an activity that handles actions of type
> > > > Intent.ACTION_EDIT, for image content that has data of mime-type
> image/
> > > > *.
> >
> > > > For more information on incorporating the editor into your Android
> > > > application, please visit:
> http://mobile.photoshop.com/android/developers.html
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

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

[android-developers] Re: how to crop an image in android 2.x

2010-03-13 Thread Sydney
I got cropping to work on captured images a Motorola Droid using the
built-in CropImage activity, but I first save the image to the SD card
before calling the CropImage activity. However, like SOB said this
does not work on all devices, such as the Nexus One.

I haven't tried this, but you might want to grab the CropImage method
from the Android repository and include it in your application's
source files - ensuring that whatever device runs our application will
have this activity available.

CropImage:
http://android.git.kernel.org/?p=platform/packages/apps/Camera.git;a=blob;f=src/com/android/camera/CropImage.java;h=6a52d72c533f4b9bbcb01db833681ec39aaca987;hb=HEAD



On Mar 11, 10:15 pm, Vaibhav Goel  wrote:
> No. I am searching for it.
>
> On Mar 1, 1:56 am, Damian  wrote:
>
>
>
> > I have encountered this problem also. Did you find a solution?
>
> > On Feb 16, 11:50 am,VaibhavGoel  wrote:
>
> > > By removing class-name and private restrictions, it works for the
> > > images picked from gallery but when i pass Uri ofimageafter
> > > capturing it from camera, it gives Activity not found exception as
> > > shown below.
>
> > > Code used:
>
> > >                                 Intent i = new 
> > > Intent(MediaStore.ACTION_IMAGE_CAPTURE);
> > >                                  ContentValues values = new 
> > > ContentValues();
> > >                                  values.put(Media.TITLE, "User" + 
> > > "_Image");
> > >                                  values.put(Media.BUCKET_ID, "User");
> > >                                  values.put(Media.BUCKET_DISPLAY_NAME, 
> > > "image");
> > >                                  userImageUri =
> > > getContentResolver().insert(Media.EXTERNAL_CONTENT_URI, values);
> > >                                  i.putExtra(MediaStore.EXTRA_OUTPUT, 
> > > userImageUri);
>
> > >                                  startActivityForResult(i, Get_IMAGE);
>
> > > and in OnActivityResult :
>
> > > Intent i = new Intent("com.android.camera.action.CROP");
>
> > >                    i.setData(userImageUri);    // userImageUri is created
> > > above
>
> > >                 i.putExtra("noFaceDetection", false);
> > >                 i.putExtra("outputX", iconWidth);
> > >                 i.putExtra("outputY", iconHeight);
> > >                 i.putExtra("aspectX", iconWidth);
> > >                 i.putExtra("aspectY", iconHeight);
> > >                 i.putExtra("scale", true);
>
> > >                     ContentValues values = new ContentValues();
> > >                     values.put(Media.TITLE, "1_" + " Icon");
> > >                     values.put(Media.BUCKET_ID, "User-T");
> > >                     values.put(Media.BUCKET_DISPLAY_NAME, "image_t");
> > >                     iconUri =
> > > getContentResolver().insert(Media.EXTERNAL_CONTENT_URI, values);
> > >                     i.putExtra("output", iconUri);
>
> > >                      startActivityForResult(i, CROP_IMAGE);
>
> > > After callingcropactivity after camera, it gives NoActivityFound
> > > error as shown below:
>
> > > 02-16 16:26:47.306: ERROR/AndroidRuntime(684): Uncaught handler:
> > > thread main exiting due to uncaught exception
> > > 02-16 16:26:47.467: ERROR/AndroidRuntime(684):
> > > java.lang.RuntimeException: Failure delivering result
> > > ResultInfo{who=null, request=1, result=-1, data=null} to activity
> > > {com.nagarro/com.nagarro.CameraActivity}:
> > > android.content.ActivityNotFoundException: No Activity found to handle
> > > Intent { act=com.android.camera.action.CROPdat=content://media/
> > > external/images/media/17 (has extras) }
> > > 02-16 16:26:47.467: ERROR/AndroidRuntime(684):     at
> > > android.app.ActivityThread.deliverResults(ActivityThread.java:3314)
> > > 02-16 16:26:47.467: ERROR/AndroidRuntime(684):     at
> > > android.app.ActivityThread.handleSendResult(ActivityThread.java:3356)
> > > 02-16 16:26:47.467: ERROR/AndroidRuntime(684):     at
> > > android.app.ActivityThread.access$2700(ActivityThread.java:119)
> > > 02-16 16:26:47.467: ERROR/AndroidRuntime(684):     at
> > > android.app.ActivityThread$H.handleMessage(ActivityThread.java:1878)
> > > 02-16 16:26:47.467: ERROR/AndroidRuntime(684):     at
> > > android.os.Handler.dispatchMessage(Handler.java:99)
> > > 02-16 16:26:47.467: ERROR/AndroidRuntime(684):     at
> > > android.os.Looper.loop(Looper.java:123)
> > > 02-16 16:26:47.467: ERROR/AndroidRuntime(684):     at
> > > android.app.ActivityThread.main(ActivityThread.java:4338)
> > > 02-16 16:26:47.467: ERROR/AndroidRuntime(684):     at
> > > java.lang.reflect.Method.invokeNative(Native Method)
> > > 02-16 16:26:47.467: ERROR/AndroidRuntime(684):     at
> > > java.lang.reflect.Method.invoke(Method.java:521)
> > > 02-16 16:26:47.467: ERROR/AndroidRuntime(684):     at
> > > com.android.internal.os.ZygoteInit
> > > $MethodAndArgsCaller.run(ZygoteInit.java:860)
> > > 02-16 16:26:47.467: ERROR/AndroidRuntime(684):     at
> > > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618

[android-developers] Re: TextView before ListView

2010-03-13 Thread Brion Emde
Bob,

Forgive me if this is obvious to you, but I have to remind myself over
and over. RelativeLayout makes only a single pass through your XML to
determine the Ids and collect the layout information. So it is
essential that you order the elements correctly to make sure you have
no forward references. RelativeLayout does not complain if you do and
it will appear that the elements are not obeying your layout
parameters.

Just a thought that came to me this morning...

Brion


On Mar 11, 4:21 pm, Bob Kerns  wrote:
> Are you sure? This sounds like exactly what I was asking earlier
> today, based on my experience with Spinner. I speculated that ListView
> might exhibit the same behavior.
>
> You describe the behavior I was expecting. Instead, the Spinner
> ignored all constraints. If I put it first in the layout, it would
> overlay or squeeze out the text. (I forget what distinguished the two
> behaviors).
>
> If I put it second, the text would fail to wrap and the Spinner would
> get squeezed out. I just could not get the Adapter-supplied views to
> participate in the sizing process.
>
> I expect that I could have given it a fixed size, but that would be a
> bug itself.
>
> I don't have time to try it again with ListViews at the moment, but if
> anyone can confirm this working, especially with RelativeLayout, I'd
> appreciate it.
>
> On Mar 11, 10:35 am,BrionEmde  wrote:
>
>
>
> > You can totally do this.
>
> > Make sure that your TextView is set to
> > android:layout_height="wrap_content" and not to "fill_parent". That
> > will surely do what you are describing.
>
> > ---
>
> > On Mar 11, 5:35 am, Pipen  wrote:
>
> > > Dear All,
>
> > > I've tried to add a TextView before a ListView in a LinearLayout. The
> > > result is that the ListView wont show at all. The same thing happens
> > > if I put the TextView after the ListView, but then I will only see the
> > > ListView.
>
> > > Is there a way to get a text view above the ListView without to much
> > > of a hassle?
>
> > > Kind regards

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


[android-developers] Re: how to implement progress bar as same as windows loader bar

2010-03-13 Thread Paul Turchenko
Well, the buttom is just the same as a View except is has different
look (it defines in via the constructor). As you can see, onClick
event is defined on the View class, and all that button does is
defining the way it should look when View is focused/selected/pressed/
etc. Hope this helps

On Mar 12, 10:01 am, mike  wrote:
> hai,
>
> i struck in implementing progress bar functionality of my splash
> screen.
>
> i know horizontal progress bar implementation that fills yellow from
> left to right but the requirement is progress bar should be loader bar
> that appears when windows is loading in the system. more detailly,
>
> "The loader bar or progress bar is same as Microsoft Windows loader
> bar -> the yellow bar continually move from left to right. Appear on
> left, move in the right direction and disappear on the right side than
> appear on the left again immadiately and process start again. This is
> not filling bar which fill the space from left to right."
>
> how to do this. please suggest me.

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


[android-developers] Re: Programmatically Create/Destroy AppWidgets

2010-03-13 Thread Paul Turchenko
App widgets (home screen widgets) live in separate process and you
have no control on adding/removing them. All you can do is tell in
your AndroidManifest.xml that you have a new appwidget and user will
seen it when he decides to place something to his homescreen.

On Mar 5, 9:04 am, Tanay Shah  wrote:
> Hey,
>
> Is it possible to programmatically create and/or destroy AppWidgets?

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


[android-developers] Re: WTA: Change default keyboard when inserting password how to?

2010-03-13 Thread Paul Turchenko
Just set inputType to "number|password" of the EditText that will
receive password input. This should work.

On Mar 13, 8:48 am, Monica Chrismawati 
wrote:
> Hi everyone, i am currently developing an application and i need a
> login menu. In login menu there is a password textfield, but i don't
> know how to change the default keyboard.
> I want the keyboard changes only appear only number ( not complete
> keyboard as the default)  when user at login menu.
> What should i do? Is there any class that handle the behavior of on
> screen keyboard??
>
> Thx :))

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


[android-developers] Re: write/read log files in res folder

2010-03-13 Thread Farproc
What is the res folder? /sdcard/res?

On Mar 13, 3:07 pm, aswani kumar tholeti 
wrote:
> Hi all,
>
> how to write/read log data into txt file in res folder
>
> Thanks in advance
>
> Aswan

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


[android-developers] Re: Getting from a Uri to a byte array...?

2010-03-13 Thread Anna PS
There's another problem too, which is that if the byte array is very
large (100MB+), which could easily happen with video files, Android is
going to throw an OutOfMemoryError. So there's a broader question: how
can I get from a URI to a byte array to add to a multipart message,
without crashing Android?

On Mar 13, 11:23 am, Anna PS  wrote:
> Hi all
>
> I want to get from an Android Uri (of the kind returned by
> onActivityResult) to a simple byte array, in order to upload a file as
> part of a multipart message. Can anyone provide an example of how to
> get from a Uri to a byte[] array?
>
> My current code (below) is almost there, but falls down because I
> can't work out the LENGTH_OF_FILE from an InputStream. I'd have the
> same problem using ByteArrayOutputStream.
>
> I've been looking at the docs on Content 
> Providershttp://developer.android.com/guide/topics/providers/content-providers...
> and wondering if getBlob() is the method I need, but it says it only
> applies to small amounts of data (<50KB) and I need to handle larger
> files.
>
> thanks!
>
> Current code (doesn't work):
>
>         public static byte[] getBytesFromFile(ContentResolver cR, String
> fileUriString) throws IOException {
>                 Uri tempuri = Uri.parse(fileUriString);
>                 InputStream is = cR.openInputStream(tempuri);
>                 byte[] b3 = new byte[LENGTH_OF_FILE];
>                 is.read(b3);

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


[android-developers] Getting from a Uri to a byte array...?

2010-03-13 Thread Anna PS
Hi all

I want to get from an Android Uri (of the kind returned by
onActivityResult) to a simple byte array, in order to upload a file as
part of a multipart message. Can anyone provide an example of how to
get from a Uri to a byte[] array?

My current code (below) is almost there, but falls down because I
can't work out the LENGTH_OF_FILE from an InputStream. I'd have the
same problem using ByteArrayOutputStream.

I've been looking at the docs on Content Providers
http://developer.android.com/guide/topics/providers/content-providers.html
and wondering if getBlob() is the method I need, but it says it only
applies to small amounts of data (<50KB) and I need to handle larger
files.

thanks!

Current code (doesn't work):

public static byte[] getBytesFromFile(ContentResolver cR, String
fileUriString) throws IOException {
Uri tempuri = Uri.parse(fileUriString);
InputStream is = cR.openInputStream(tempuri);
byte[] b3 = new byte[LENGTH_OF_FILE];
is.read(b3);

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


[android-developers] Re: using KeyguardManager for presenting unlock screen

2010-03-13 Thread devi prasad
By any chance, Is this fixed in Android 2.1r1 release? I notice that
there are many commits that mention Keyguard related fixes. I'm
currently building the AOSP sources to verify the behavior in the
emulator.

Some kind of confirmation will be appreciated :)

On Thu, Mar 11, 2010 at 7:34 PM, devi prasad  wrote:
> Hi,
> In my application I want to use KeyguardManager to present the unlock
> screen at required places. I wrote the following code and tested it on
> Google IO phone (Android 1.6) and a Nexus One phone. Although this
> works decently on Nexus one, its behavior is odd at times. Sometimes
> the unlock screen doesn't appear for consecutive runs. It also has
> serious issues with configuration changes. And surprisingly, if I turn
> off the screen and turn it back on, the unlock screen disappears! Of
> course, this happens only in my program, and not in general in the
> phone.
>
> Can someone explain what's wrong with my code? Just FYI, I have tried
> various combinations of disableKeyguard() and reenableKeyguard()
> without much gain.
>
> public class UnlockActivity extends Activity {
>    KeyguardManager mKgm;
>    KeyguardLock mKgl;
>
>   �...@override
>    public void onCreate(Bundle savedInstanceState) {
>        ...
>        mKgm = (KeyguardManager) getSystemService(KEYGUARD_SERVICE);
>        mKgl = mKgm.newKeyguardLock("me");
>   }
>
>    class HandlerCallback implements Handler.Callback {
>        public boolean handleMessage(Message msg) {
>                mKgl.disableKeyguard();
>                mKgm.exitKeyguardSecurely(new OnKeyguardExitResult() {
>                                public void onKeyguardExitResult(boolean 
> success) {
>                                        Log.d("UnlockActivity", "status: " + 
> success);
>                                        mKgl.reenableKeyguard();
>                                }
>                        });
>                return true;
>        }
>    }
>   ...
> }
>
>
> thanks
>

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


[android-developers] Passing a Uri to the video camera - causes Retake and Play buttons to crash

2010-03-13 Thread Anna PS
[I thought I posted this yesterday, but it hasn't shown up in the
group, so apologies if it posts twice.]

I'm trying to pass a Uri to the video camera as EXTRA_OUTPUT. The file
shoots and saves OK at the Uri I give it, but unfortunately pressing
the 'Retake' or 'Play' buttons crashes the application.

Does anyone know how I can supply a Uri in a way that won't crash the
camera?

Here's my code:

video = new File(

Environment.getExternalStorageDirectory(),
"my_video.3gp");
if (video.exists()) {
Log.d(LOG_TAG, "Video exists, 
deleting");
video.delete();
}
Intent videoCaptureIntent = new
Intent(MediaStore.ACTION_VIDEO_CAPTURE);

videoCaptureIntent.putExtra(MediaStore.EXTRA_OUTPUT,
Uri.fromFile(video));
startActivityForResult(videoCaptureIntent,1);

And traceback when I press the 'Play' button:

03-12 19:25:57.948: INFO/ActivityManager(936): Starting activity:
Intent { act=android.intent.action.VIEW dat=file:///sdcard/my_video.
3gp }
03-12 19:25:57.968: ERROR/videocamera(5482): Couldn't view video
file:///sdcard/my_video.3gp
03-12 19:25:57.968: ERROR/videocamera(5482):
android.content.ActivityNotFoundException: No Activity found to handle
Intent { act=android.intent.action.VIEW dat=file:///sdcard/
election_video.3gp }
03-12 19:25:57.968: ERROR/videocamera(5482): at
android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:
1408)
03-12 19:25:57.968: ERROR/videocamera(5482): at
android.app.Instrumentation.execStartActivity(Instrumentation.java:
1378)
03-12 19:25:57.968: ERROR/videocamera(5482): at
android.app.Activity.startActivityForResult(Activity.java:2749)
03-12 19:25:57.968: ERROR/videocamera(5482): at
android.app.Activity.startActivity(Activity.java:2855)
03-12 19:25:57.968: ERROR/videocamera(5482): at
com.android.camera.VideoCamera.startPlayVideoActivity(VideoCamera.java:
362)
03-12 19:25:57.968: ERROR/videocamera(5482): at
com.android.camera.VideoCamera.onClick(VideoCamera.java:375)
03-12 19:25:57.968: ERROR/videocamera(5482): at
android.view.View.performClick(View.java:2364)
03-12 19:25:57.968: ERROR/videocamera(5482): at
android.view.View.onTouchEvent(View.java:4179)
03-12 19:25:57.968: ERROR/videocamera(5482): at
android.view.View.dispatchTouchEvent(View.java:3709)
03-12 19:25:57.968: ERROR/videocamera(5482): at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
03-12 19:25:57.968: ERROR/videocamera(5482): at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
03-12 19:25:57.968: ERROR/videocamera(5482): at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
03-12 19:25:57.968: ERROR/videocamera(5482): at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
03-12 19:25:57.968: ERROR/videocamera(5482): at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
03-12 19:25:57.968: ERROR/videocamera(5482): at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
03-12 19:25:57.968: ERROR/videocamera(5482): at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
03-12 19:25:57.968: ERROR/videocamera(5482): at
com.android.internal.policy.impl.PhoneWindow
$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659)
03-12 19:25:57.968: ERROR/videocamera(5482): at
com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:
1107)
03-12 19:25:57.968: ERROR/videocamera(5482): at
android.app.Activity.dispatchTouchEvent(Activity.java:2061)
03-12 19:25:57.968: ERROR/videocamera(5482): at
com.android.internal.policy.impl.PhoneWindow
$DecorView.dispatchTouchEvent(PhoneWindow.java:1643)
03-12 19:25:57.968: ERROR/videocamera(5482): at
android.view.ViewRoot.handleMessage(ViewRoot.java:1691)
03-12 19:25:57.968: ERROR/videocamera(5482): at
android.os.Handler.dispatchMessage(Handler.java:99)
03-12 19:25:57.968: ERROR/videocamera(5482): at
android.os.Looper.loop(Looper.java:123)
03-12 19:25:57.968: ERROR/videocamera(5482): at
android.app.ActivityThread.main(ActivityThread.java:4363)
03-12 19:25:57.968: ERROR/videocamera(5482): at
java.lang.reflect.Method.invokeNative(Native Method)
03-12 19:25:57.968: ERROR/videocamera(5482): at
java.lang.reflect.Method.invoke(Method.java:521)
03-12 19:25:57.968: ERROR/videocamera(5482): at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:860)
03-12 19:25:57.968: ERROR/videocamera(5482): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
03-12 19:25:57.968: ERROR/videocamera(5482): at
dalvik.system.NativeStart.main(Native Method)


-- 
You received this message because you are subscribed t

[android-developers] Re: OpenGL ES 2.0 on Eclair

2010-03-13 Thread Mario Zechner
Sorry for the double post, just had to add one more thing.

I understand that many of your are a bit angry for there being no java
bindings at this time. But from an architectural point of view i
totally understand Romain's comment that they want to get it right.
OpenGL ES 2.0 is not compatible to 1.x and the current bindings depend
on the compatibility between 1.0 and 1.1. As an example: You have the
GL10 interface which is the base GL instance that get's passed around
to for example the Renderer interface. If you want to use 1.1 features
you simply check wheter the GL10 instance is a GL11 instance and cast
the hell out of it. That wouldn't work so well with 2.0. Say you
create a GL20 interface having all the functions of OGL ES 2.0. You
can't simply derive that from GL11 as the methods in there are no
longer availble in 2.0 (for the most part). That would simply confuse
the user and be a nice source for a lot of bugs. Similar problems
occur with the GLSurfaceView a lot of us rely on to initialize OpenGL.
An OpenGL ES 2.0 context is setup a bit different and you have to
support a query mechanism before instantiating the GLSurfaceVIew to
check wheter 2.0 is available. Lots and lots of interface design
issues that have to be taken care of in a clean manner.

The native bindings are not the problem, they really can be done in a
couple of hours (see link above which took me about 4 hours
yesterday). A clean interface design on the Java side is and i
understand that this takes time.

On 13 Mrz., 11:29, Mario Zechner  wrote:
> Hey Michael,
>
> http://groups.google.com/group/android-developers/browse_thread/threa...
>
> hope that helps :)
>
> Ciao,
> Mario
>
> On 13 Mrz., 05:17, MichaelEGR  wrote:
>
> > Also I just want to point out that the community driven LWJGL desktop
> > Java binding has already added OpenGL 4.0 support immediately after
> > announcement / specification release. This seriously is the level of
> > support that Google and the Android team should extend to OpenGL ES
> > 2.x at the very least for all developers. It's not like the hardware
> > isn't available and released. It is available; give us what we need to
> > succeed and make Google & Android look good.. :)
>
> > If the LWJGL community can add the latest OpenGL 4.0 support in a
> > matter of hours to their binding. There is no reason Google can't
> > support a developer binding/wrapper separate of the OS. There simply
> > isn't a good excuse.. I'm afraid "we're just trying to get it right"
> > is just a diversion of sorts. And no condemnation here.. I really like
> > Android and have been working with GL since Android 1.0. Lets keep
> > things rolling and show what Android and 2nd gen devices really can
> > do...
>
> >http://lwjgl.org/forum/index.php/topic,3245.0.html
>
> > Support the developers otherwise Android is going to lag behind on
> > next gen titles.  Yes the NDK exists, but that primarily benefits
> > iPhone devs who are porting OpenGL 2.x titles from the iPhone and / or
> > commercial game companies and not the larger base of Java oriented
> > Android devs.
>
> > --Mike
>
> > On Mar 12, 7:54 pm, MichaelEGR  wrote:
>
> > > I'm glad others are concerned like I am on Java bindings to OpenGL ES
> > > 2.x. As things go it would be nice to hear from Google that they will

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


[android-developers] Re: Localization of Plurals using Context and resources strings.xml

2010-03-13 Thread Makas Tzavellas
Hey Greg,

Can't say that I am aware of "few" and "many" as values in "quantity".
I have only used "one" and "other" so far...

Sorry that I can't be much of a help here.

Perhaps developers of the Android platform can shed some light for us?
Hello? haha.

Makas

On Mar 12, 7:57 am, Greg Giacovelli  wrote:
> Thanks :) Sadly I just read through tons of source code and got this
> Pretty interesting :) Ok so since you seem to know that, would you
> know what the quantity="few", quantity="many"  do?
>
> The src code doesn't seem to define them in the PluralRules
> implemented, or at least nothing that is really concrete. Is there a
> formal definition somewhere?
>
> -Greg
>
> On Mar 11, 1:57 pm, Makas Tzavellas  wrote:
>
> > Hi Greg,
>
> > To use plurals. You declare it like this in your strings.xml.
>
> >   
> >     %s thing
> >     @s things
> >   
>
> > Hope this helps.
>
> > On Mar 11, 10:26 am, Greg  wrote:
>
> > > Hi,
> > > I am used to just using a choice format for doing something deciding
> > > between "{0} thing" and "{0} things".
>
> > > However Context and Resources have a lot of utitilities it seems for
> > > dealing with String and loading them with native replacement. One
> > > method of such is Resources.getQuantityText(int id, int quantity) ...
> > > problem is the way to declare the string is not declared anywhere and
> > > upon using this method I am greeted with
>
> > >  android.content.res.Resources$NotFoundException:Pluralresource ID
> > > #0x7f080050 quantity=450 item=other
>
> > > Looking at the source it does use a native method to load the
> > > pluralized resource so I can't look at the code. Would anyone know how
> > > to use this may-be pretty nifty utility?
>
> > > I was thinking it might be something like:
>
> > > %1$d thing
> > > %1$d things
>
> > > since they don't use the xml id element but I am just guessing and am
> > > completely stumped.
>
>

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


[android-developers] force ContentProvider to synchronize with database

2010-03-13 Thread Olivier
Hi!
I'm sharing informations with a content provider. But whent something
change, the provider seems to ignore it untill I close my program. Or
do not write data on the database until I close it. So is there a
commend or a method to force ContentProvider to synchronize with his
respective database and set a listner with coold make it automatic?
Someting like ContentProvider().update(uri)... or
ContentProvider().synchronize(uri)...
thank you

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


[android-developers] Re: OpenGL ES 2.0 on Eclair

2010-03-13 Thread Mario Zechner
Hey Michael,

http://groups.google.com/group/android-developers/browse_thread/thread/064ebeaa6401#

hope that helps :)

Ciao,
Mario

On 13 Mrz., 05:17, MichaelEGR  wrote:
> Also I just want to point out that the community driven LWJGL desktop
> Java binding has already added OpenGL 4.0 support immediately after
> announcement / specification release. This seriously is the level of
> support that Google and the Android team should extend to OpenGL ES
> 2.x at the very least for all developers. It's not like the hardware
> isn't available and released. It is available; give us what we need to
> succeed and make Google & Android look good.. :)
>
> If the LWJGL community can add the latest OpenGL 4.0 support in a
> matter of hours to their binding. There is no reason Google can't
> support a developer binding/wrapper separate of the OS. There simply
> isn't a good excuse.. I'm afraid "we're just trying to get it right"
> is just a diversion of sorts. And no condemnation here.. I really like
> Android and have been working with GL since Android 1.0. Lets keep
> things rolling and show what Android and 2nd gen devices really can
> do...
>
> http://lwjgl.org/forum/index.php/topic,3245.0.html
>
> Support the developers otherwise Android is going to lag behind on
> next gen titles.  Yes the NDK exists, but that primarily benefits
> iPhone devs who are porting OpenGL 2.x titles from the iPhone and / or
> commercial game companies and not the larger base of Java oriented
> Android devs.
>
> --Mike
>
> On Mar 12, 7:54 pm, MichaelEGR  wrote:
>
> > I'm glad others are concerned like I am on Java bindings to OpenGL ES
> > 2.x. As things go it would be nice to hear from Google that they will

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


[android-developers] Re: How to use PathClassLoader for files that are not installed.

2010-03-13 Thread Makas Tzavellas
Hi Craig,

Yes, it is indeed possible, although not directly from the asset
folder (I think, been a while since I did it). If my memory serves me
right, you will need to write the file (apk) into the phone memory or
sdcard (not sure about sdcard though) before you can use
PathClassLoader on it.

Makas

On Mar 12, 8:04 pm, Craig O Connor  wrote:
> Hi guys,
>
> I am using PathClassLoader in my application and can get it to load
> files that are already installe.d But how do I get it to load an apk
> file that is stored in say the assets folder of my app. IS this even
> possible?
>
> Thanks in advance,
> Craig

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


[android-developers] pause mediaplayer when incoming call

2010-03-13 Thread kavitha
Hi All,

How to pause music when user recieves incoming call in android?

Can i know i am getting incoming call from any API's?

Please help,Its urgent.

Thanks
Kavitha

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

[android-developers] Re: Sending huge files with HttpsUrlConnection???

2010-03-13 Thread Makas Tzavellas
Hi,

There is no guarantee that this will work, but try placing
"os.flush()" in your loop. Which in theory tells the outputstream
implementation to write out the buffered data.

E.g

while ((len = is.read(buffer)) != -1){
os.write(buffer, 0, len);
os.flush();
}

I haven't looked at the underlying implementation of org.apache.http
package in Android. But perhaps it is worth investigating if you
continue to have problems.

Makas
On Mar 13, 8:17 am, AuxOne  wrote:
> I have some Android code that can send files to my webserver using an
> HttpsUrlConnection, but when it tries to send larger files I get an
> OutOfMemory exception when opening the OutputStream. Can anyone offer
> some assistance?
>
> It looks something like this:
>
> httpConn = (HttpsURLConnection) new URL(uri).openConnection();
> httpConn.setDoInput(true);
> httpConn.setDoOutput(true);
> httpConn.setUseCaches(false);
> httpConn.setRequestMethod("POST");
>
> This is where I try different things. The closes solution has been:
> httpConn.setChunkedStreamingMode(1024);
> In this case, I don't get the OutOfMemory immediately when opening the
> OutputStream, but I see the heap growing as I os.write() and it
> eventually runs out.
>
> httpConn.connect();
> OutputStream os = httpConn.getOutputStream();
> byte[] buffer = new byte[4096];
> int len;
> while ((len = is.read(buffer)) != -1){
> os.write(buffer, 0, len);}
>
> os.flush();
>
> Each time I open the .getOutputStream() the contents of the file I am
> trying to send is loaded into memory, per the discussion here (http://
> bugs.sun.com/bugdatabase/view_bug.do?bug_id=4212479) -- so I go out of
> memory.
>
> My server supports HTTP 1.1. I've tried the following code.
> 1. httpConn.setRequestProperty("Transfer-Encoding","chunked");
> 2. httpConn.setChunkedStreamingMode(1024);
> 3. httpConn.setRequestProperty("Content-Length", length);
> 4. httpConn.setFixedLengthStreamingMode(1024)
> 5. Combo of 1+2.
> 6. Combo of 3+4
>
> Can anyone offer any assistance?! It seems like no matter what, the
> data going to the OutputStream is being buffered. ChunkedStreamMode
> seems to just buffer it in pieces, whereas it would otherwise buffer
> it all at once. Both go out of memory.
>
> Thanks in advance.
>
> PS> I have similar code for J2ME and memory has not been a problem.
> Also, if I try to send two medium sized files in a row, the first one
> makes it, but then the heap doesn't seem to compact and the second one
> fails.

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


Re: [android-developers] Re: How to Upgrade Application without losing data.

2010-03-13 Thread TreKing
On Sat, Mar 13, 2010 at 1:36 AM, Caeser  wrote:

> D:\android-sdk-windows\tools>adb install TEST_V2.apk
>

Include the -r flag to indicate it's a re-install. Ex:  "adb install -r
TEST_V2.apk"

TIp: type "adb" with no argument in the command line to see a list of
available commands and flags.

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

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

[android-developers] showing media volume controller

2010-03-13 Thread kavitha
Hi All,

how to show media volume controller on my screen in android?

Thanks
kavitha

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

  1   2   >