Re: [android-beginners] Re: Application still consumes battery even tough it is closed

2010-07-04 Thread Mark Murphy
On Sat, Jul 3, 2010 at 7:42 PM, Indicator Veritatis mej1...@yahoo.com wrote:
 That may be true, but if so, there is a serious problem with the
 online Android documentation. For as I have already shown, the
 documentation clearly states that there is a possible transition
 direct from the started state to the stopped state, one that does not
 call onPause() first.

That would occur in fairly rare cases, when something occurs on the
device after onStart() and before onResume(). Since those methods are
invoked in rapid succession, something else taking over the screen
(e.g., phone call comes in) during that window is rather unlikely.
Developers should not be worrying about that particular scenario very
much, if at all.

 So other than your own authority, on what grounds do you say that the
 docs are wrong?

The docs are not wrong. However, my previous post was covering the
99.999% case, not every possible scenario.

On Sat, Jul 3, 2010 at 7:50 PM, Indicator Veritatis mej1...@yahoo.com wrote:
 This is certainly wrong.

No, it is certainly correct.

 Pressing the Back key does NOT cause
 onDestroy() to be called.

Yes, it does.

 It causes onPause() to be called.

And onStop(), and onDestroy().

 I have run
 this in the emulator too many times myself to believe that it does.

I even had to run my own test, just to confirm I hadn't slid into some
parallel dimension, before writing my previous post. onDestroy() is
called after the BACK button is pressed, just like it is supposed to.
It has behaved this way for over two years.

If you are unable to replicate this, there is a problem in your
development environment.

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

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

-- 
You received this message because you are subscribed to the Google
Groups Android Beginners group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Application Lifecycle Questions.

2010-07-04 Thread Ubuntu Explorer
Hi,
I have the following questions about application lifecycle.

1. Activity 1 of Task 1 (affinity 1) starts Activity 2 (affinity 1,
allowTaskReparenting ) of Task 2 (affinity 2) using Intent with
FLAG_ACTIVITY_NEW_TASK. But, Activity 2 is already part of task 2 stack.
Will activity2 move from task2 to task1?

2. While retaining task state, the developer doc says that the default
behaviour is to remove everything from the task stack except the  root
activity, after a certain time has elapsed. Is there a way to configure this
time?

3. How are task and its activities related to process/threads? It looks like
all activities of a task are part of the same main thread of a single
process. However, when an activity moves from one task to another, what
moves?

Kindly clarify.

Regards,
UE.

-- 
You received this message because you are subscribed to the Google
Groups Android Beginners group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Re: Having trouble with setDataSource() for MediaPlayer

2010-07-04 Thread appsgrrl
Hi --

I sorted out my problem.  I found the answer in someone's blog.
it turns out that I have to pass the startOffset and the length to the
setDataSource(), and those are obtained via
the AssetFileDescriptor:

AssetFileDescriptor afd = getAssets().openFd(fileName);
mp.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(),
afd.getLength());

That does the trick


On Jun 30, 11:15 pm, appsgrrl bettyoch...@gmail.com wrote:
 I've gotten the MediaPlayer to work with the create() on a resource.
 I'm trying to get it to work with a file in the assets folder.  I've
 tried all sorts of combinations with the setDataSource() method, but I
 keep getting errors.

 Here's one of my error traces:

 E/PlayerDriver(   31): Command PLAYER_SET_DATA_SOURCE completed with
 an error or info PVMFErrNotSupported
 E/MediaPlayer( 1550): error (1, -4)
 E/com.appsgrl.xxx.playerserv...@43d251f0( 1550): IOException on
 setDataSource:Prepare failed.: status=0x1
 W/PlayerDriver(   31): PVMFInfoErrorHandlingComplete
 E/MediaPlayer( 1550): start called in state 0
 E/MediaPlayer( 1550): error (-38, 0)

 I was trying to do the following:  (I did not show the try/catch
 stuff)

          MediaPlayer mp = new MediaPlayer();
          FileDescriptor sfd =
 getAssets().openFd(abc.wav).getFileDescriptor();

          mp.setDataSource(sfd);
          mp.prepare();
          mp.start()

 Does anyone have a simple example of how to play something from the
 asses folder?

 Thanks

-- 
You received this message because you are subscribed to the Google
Groups Android Beginners group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] is here the right place for my question ?

2010-07-04 Thread jean francois pion




because I can't find elsewhere

my question is about the google maps application on android 2.1 (or
more)

the pb is with an proprietary web application to send the adress of the
mdical intervention for SOS Mdecins

sometime when I clic on the adress in the web page the system ask if i
want to open map with the search on a part of the text (with airport in
it for example) 

I would like to know if there is a simple syntax/tag to define some
text as an adress to trigger the use of google maps ?

is here the right forum and if not is somebody kind enough to give me
some clue where to ask ?

thank you a lot


-- 






JF Pion

"If a cluttered desk is sign of a cluttered mind, of what, then, is an empty desk a sign ? " 
 Albert Einstein
Errare
humanum est, perseverare politicum









-- 
You received this message because you are subscribed to the Google
Groups Android Beginners group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Eclipse and shell have separate avd dirs - how to fix?

2010-07-04 Thread Michael Portuesi
On Mac OS 10.6.4, I've installed Android SDK, plus Eclipse 3.5 and
Android plugins.

- My SDK is installed at ~/android-sdk-mac_86
- The tools folder of the SDK is added to my bash PATH env var.
- I've set up the SDK/AVD manager within Eclipse, pointing it to my ~/
android-sdk-mac_86 folder.

Everything is working properly, except for one thing.  Eclipse and the
command-line SDK tools cannot agree on where to store my AVD files.

The SDK/AVD manager within Eclipse places my avds under ~/.android/
avd, which is the expected location according to the SDK docs.  But
when I run the 'android' AVD manager from the shell, it looks for AVDs
under ~/android-sdk-mac_86/.android/avd.

The 'emulator' command, when run from Eclipse, uses the AVDs in
~/.android/avd, as expected.  Emulator when run from the shell, sees
only AVDs created in the ~/android-sdk-mac_86/.android/avd folder.

Can someone tell me how to reconfigure the shell-based tools to use
the ~/.android/avd folder, so I can get everything in one place?

Thanks.

-- 
You received this message because you are subscribed to the Google
Groups Android Beginners group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Re: Application still consumes battery even tough it is closed

2010-07-04 Thread Indicator Veritatis
Hi, Mark-

As I should have expected for someone who did write a good book on
Android, I see your knowledge of the Android life-cycle really is
better than mine. But I am seeing something else that vitiates this
superior knowledge, your habit of stating unconditionally, in a very
general form, things that are only sometimes true.

For that is what you have done in both issues: 1) the issue of whether
or not there is a direct transition to the stopped state and 2) the
issue of whether it is true that Back always caused onDestroy() to be
called.

In neither case is your sweeping generalization justifiable, in both
cases you are misleading readers rather than helping them. Do you
really want to encourage, for example, Android programmers to fail to
handle correctly the case where onStop() is called without a
preceding, corresponding call to onPause()? Such programming sounds
very careless to me.

Even if most of the time (even your 99.999% is an overstatement), the
programmer can ignore this scenario, he should be aware that it
exists, so then when he needs to take care of it, he knows that he
needs to do so.

Similarly with the second issue: even Google violates the rule [that
onBackPressed() should cause onDestroy() to be called] often enough
that your readers are going to be confused if they forget that some
apps really do override onBackPressed(), they don't all call
onDestroy().

Finally, yes the docs are wrong. I already showed how they contradict
each other. And others have found other similar contradictions in the
docs. Take a look at my previous posts on this and see for yourself: I
provided the direct quotations.

On Jul 4, 2:14 am, Mark Murphy mmur...@commonsware.com wrote:
 On Sat, Jul 3, 2010 at 7:42 PM, Indicator Veritatis mej1...@yahoo.com wrote:
  That may be true, but if so, there is a serious problem with the
  online Android documentation. For as I have already shown, the
  documentation clearly states that there is a possible transition
  direct from the started state to the stopped state, one that does not
  call onPause() first.

 That would occur in fairly rare cases, when something occurs on the
 device after onStart() and before onResume(). Since those methods are
 invoked in rapid succession, something else taking over the screen
 (e.g., phone call comes in) during that window is rather unlikely.
 Developers should not be worrying about that particular scenario very
 much, if at all.

  So other than your own authority, on what grounds do you say that the
  docs are wrong?

 The docs are not wrong. However, my previous post was covering the
 99.999% case, not every possible scenario.

 On Sat, Jul 3, 2010 at 7:50 PM, Indicator Veritatis mej1...@yahoo.com wrote:
  This is certainly wrong.

 No, it is certainly correct.

  Pressing the Back key does NOT cause
  onDestroy() to be called.

 Yes, it does.

  It causes onPause() to be called.

 And onStop(), and onDestroy().

  I have run
  this in the emulator too many times myself to believe that it does.

 I even had to run my own test, just to confirm I hadn't slid into some
 parallel dimension, before writing my previous post. onDestroy() is
 called after the BACK button is pressed, just like it is supposed to.
 It has behaved this way for over two years.

 If you are unable to replicate this, there is a problem in your
 development environment.

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

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

-- 
You received this message because you are subscribed to the Google
Groups Android Beginners group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners]

2010-07-04 Thread A A
http://vecteurhabitat.phpnet.org/home.php

-- 
You received this message because you are subscribed to the Google
Groups Android Beginners group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


Re: [android-beginners] Re: Application still consumes battery even tough it is closed

2010-07-04 Thread Mark Murphy
On Sun, Jul 4, 2010 at 7:21 PM, Indicator Veritatis mej1...@yahoo.com wrote:
 Do you
 really want to encourage, for example, Android programmers to fail to
 handle correctly the case where onStop() is called without a
 preceding, corresponding call to onPause()? Such programming sounds
 very careless to me.

Generally, I'd recommend the implementations be independent. Wherever
possible, onStop() should not care whether or not onPause() preceded
it, even though most of the time, it will. That's pretty basic state
machine design.

 Even if most of the time (even your 99.999% is an overstatement), the
 programmer can ignore this scenario, he should be aware that it
 exists, so then when he needs to take care of it, he knows that he
 needs to do so.

I'm not arguing that it'd be nice if the docs explained the
circumstances of all of these corner cases better.

 Similarly with the second issue: even Google violates the rule [that
 onBackPressed() should cause onDestroy() to be called] often enough
 that your readers are going to be confused if they forget that some
 apps really do override onBackPressed(), they don't all call
 onDestroy().

I am sincerely hoping that somebody who overrides onBackPressed() will
notice that their fingers typed those keystrokes and will therefore
consider that, gee, maybe onBackPressed() might have something to do
with what happens when BACK is pressed. I am not aware of any supplied
Activity implementation (e.g., ListActivity) that overrides
onBackPressed(), so such behavior will not be hidden too often.

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

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

-- 
You received this message because you are subscribed to the Google
Groups Android Beginners group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Difference Between Two Times

2010-07-04 Thread Jake Colman

I have a Date variable which, according to the Javadoc, represents a
specific moment in time.  I need to compare that time with the current
time so that I can do something if the current time is within X minutes
of the time represented by the Date.  How the heck can I figure this
out?  I know this is almost more of a Java question then it is an
Android question but I'd appreciate any instance.

Thanks.

-- 
Jake Colman -- Android Tinkerer

-- 
You received this message because you are subscribed to the Google
Groups Android Beginners group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en