[android-developers] Re: nested testcase

2009-06-27 Thread dev

thanks for the respose ;)

On Jun 20, 8:35 am, Brett Chabot  wrote:
> My guess is its not possible to do this. An InstrTestNested instance
> can only exist inside an instance of InstrTestCase, thus pretty sure
> the InstrumentationTestRunner cannot instantiate the nested class.
> Maybe if you made the nested class static it might work, but then I
> don't see the point.
>
> Brett.
>
> On Thu, Jun 18, 2009 at 1:46 AM, dev wrote:
>
> > Hi all,
>
> > Can I have a nested testcase ? Like
>
> > *
> > public class InstrTestCase extends InstrumentationTestCase
> > {
>
> > public class InstrTestNested extends InstrumentationTestCase
>
> >        public void testMyTest2()
> >        {
>
> >                Log.d(MY_TAG,"test My test2");
>
> >        }
> > }
> > *
>
> > And execute the test by
> > adb shell am instrument -w -e class
> > com.InstrTest.InstrTestCase.InstrTestNested  com.InstrTest/
> > android.test.InstrumentationTestRunner
>
> > I am getting class not found error
>
> > INSTRUMENTATION_RESULT: shortMsg=Exception thrown in onCreate() of
> > ComponentInfo{com.InstrTest/android.test.InstrumentationTestRunner}:
> > java.lang.RuntimeException: Could not find test class. Class:
> > com.InstrTest.InstrTestCase.InstrTestNested
> > INSTRUMENTATION_RESULT: longMsg=java.lang.RuntimeException: Exception
> > thrown in onCreate() of ComponentInfo{com.InstrTest/
> > android.test.InstrumentationTestRunner}: java.lang.RuntimeException:
> > Could not find test class. Class:
> > com.InstrTest.InstrTestCase.InstrTestNested
> > INSTRUMENTATION_CODE: 0
>
> > I am using android.test.InstrumentationTestRunner itself.
> > Am I missing something or default runner does not support the above.
>
> > Regards,
> > dev
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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] gp_initSearch problem

2009-06-27 Thread Joe Petruchi
Hi All

While using browser recently in my phone I found the following error
gp_initSearch not found !!!

Can any body help me by telling why this happens ?

Please help !!!

Regards
Joe

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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] Instrumentaion - running multiple istrumentation simultaneously

2009-06-27 Thread dev

Hello All,

This is what I have,say:

TestCases : TestCase 1 to TestCase10 , all have several test methods
in it (all extends base class InstrumentationTestCase)

TestSuite:
TestSuite 1 - Adds 'TestCase 1 to TestCase10' in
its suite


All of the above is in single APK.

Instrumentation Runer used is - android.test.InstrumenationTestRunner
itself.

--
This is what I am trying:

- I launched Emulator having above apk

- I opened three terminals , two to run instrumentation and third one
to log results i.e.

Terminal 1 : adb shell am instrument -w -e class
com.InstrTest.TestSuite1 com.InstrTest/
android.test.InstrumentationTestRunner

com.InstrTest.TestCase1:
com.InstrTest.TestCase2:
com.InstrTest.TestCase3:
com.InstrTest.TestCase4:
com.InstrTest.TestCase5:
com.InstrTest.TestCase6:...INSTRUMENTATION_RESULT:
shortMsg=Process crashed.
INSTRUMENTATION_CODE: 0


Terminal 2:

terminal 1 : adb shell am instrument -w -e class
com.MyInstr.TestSuite1 com.MyInstr/
android.test.InstrumentationTestRunner


DDM dispatch reg wait timeout
Can't dispatch DDM chunk 52454151: no handler defined
Can't dispatch DDM chunk 48454c4f: no handler defined

com.InstrTest.TestCase1:
com.InstrTest.TestCase2:
com.InstrTest.TestCase3:
com.InstrTest.TestCase4:
com.InstrTest.TestCase5:
com.InstrTest.TestCase6:
com.InstrTest.TestCase7:
com.InstrTest.TestCase8:
com.InstrTest.TestCase9:
com.InstrTest.TestCase10:
Test results for
InstrumentationTestRunner=.
...
Time: 11.191

OK (10 tests)



Terminal 3: This is what I saw in the middle of logcat dump:

..
..
..
D/ActivityManager(  564): Uninstalling process com.InstrTest

D/ActivityManager(  564): Force removing process ProcessRecord
{4379dad0 785:tr.nth/10041} (tr.nth/10041)

W/ActivityManager(  564): Crash of app com.InstrTest running
instrumentation ComponentInfo{com.InstrTest/
android.test.InstrumentationTestRunner}

D/ActivityManager(  564): Uninstalling process com.InstrTest

D/AndroidRuntime(  776): Shutting down VM
..
..
..


Queries:
1. Is not it possible to run instrumentation in above manner?
2. I tried another TestSuite2 in terminal 2 instead of TestSuite1 ,
this also gave same results.

My aim is to run 2 testsuites parallel, using same apk. Is it
possible?
Or I have to use two different apks? Is there any way that this is
possible?

Any input would be appreciated.

Regards,
Dev










--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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] Rotating image using setImageMatrix()

2009-06-27 Thread sagar.indianic

Hi all,

I rotate image using setImageMatrix() function. I first use
getImageMatrix() function to get matrix then i use matrix.postRotate
(90). Rotation works fine. But it rotates around top/left corner of
image.  i want to change that pivot point to center of the image. how
can I do that
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Instrumentaion - running multiple istrumentation simultaneously

2009-06-27 Thread dev

More to add on the same:

I tried 2 different apk's with test suites I want to run.

i.e.

apk1 has testsuite1
and apk2 has testsuite2

tried running them in two terminals simultaneously.

What I saw was, though I did not get any crash, they don't run
simultaneously.
Execution was one followed by other, I continued getting "DDM dispatch
reg wait timeout
Can't dispatch DDM chunk 52454151: no handler defined " messages too.

So Is not it possible to run two instrumentation tests together?

Regards,
dev



On Jun 27, 12:56 pm, dev  wrote:
> Hello All,
>
> This is what I have,say:
>
> TestCases : TestCase 1 to TestCase10 , all have several test methods
> in it (all extends base class InstrumentationTestCase)
>
> TestSuite:
>                     TestSuite 1 - Adds 'TestCase 1 to TestCase10' in
> its suite
>
> All of the above is in single APK.
>
> Instrumentation Runer used is - android.test.InstrumenationTestRunner
> itself.
>
> --
> This is what I am trying:
>
> - I launched Emulator having above apk
>
> - I opened three terminals , two to run instrumentation and third one
> to log results i.e.
>
> Terminal 1 : adb shell am instrument -w -e class
> com.InstrTest.TestSuite1 com.InstrTest/
> android.test.InstrumentationTestRunner
>
> com.InstrTest.TestCase1:
> com.InstrTest.TestCase2:
> com.InstrTest.TestCase3:
> com.InstrTest.TestCase4:
> com.InstrTest.TestCase5:
> com.InstrTest.TestCase6:...INSTRUMENTATION_RESULT:
> shortMsg=Process crashed.
> INSTRUMENTATION_CODE: 0
>
> Terminal 2:
>
> terminal 1 : adb shell am instrument -w -e class
> com.MyInstr.TestSuite1 com.MyInstr/
> android.test.InstrumentationTestRunner
>
> DDM dispatch reg wait timeout
> Can't dispatch DDM chunk 52454151: no handler defined
> Can't dispatch DDM chunk 48454c4f: no handler defined
>
> com.InstrTest.TestCase1:
> com.InstrTest.TestCase2:
> com.InstrTest.TestCase3:
> com.InstrTest.TestCase4:
> com.InstrTest.TestCase5:
> com.InstrTest.TestCase6:
> com.InstrTest.TestCase7:
> com.InstrTest.TestCase8:
> com.InstrTest.TestCase9:
> com.InstrTest.TestCase10:
> Test results for
> InstrumentationTestRunner=.
> ...
> Time: 11.191
>
> OK (10 tests)
>
> Terminal 3: This is what I saw in the middle of logcat dump:
>
> ..
> ..
> ..
> D/ActivityManager(  564): Uninstalling process com.InstrTest
>
> D/ActivityManager(  564): Force removing process ProcessRecord
> {4379dad0 785:tr.nth/10041} (tr.nth/10041)
>
> W/ActivityManager(  564): Crash of app com.InstrTest running
> instrumentation ComponentInfo{com.InstrTest/
> android.test.InstrumentationTestRunner}
>
> D/ActivityManager(  564): Uninstalling process com.InstrTest
>
> D/AndroidRuntime(  776): Shutting down VM
> ..
> ..
> ..
>
> Queries:
> 1. Is not it possible to run instrumentation in above manner?
> 2. I tried another TestSuite2 in terminal 2 instead of TestSuite1 ,
> this also gave same results.
>
> My aim is to run 2 testsuites parallel, using same apk. Is it
> possible?
> Or I have to use two different apks? Is there any way that this is
> possible?
>
> Any input would be appreciated.
>
> Regards,
> Dev
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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: concurrency of AsyncTasks

2009-06-27 Thread joshv

Interesting issue.  I can see the need to make this configurable
though.  In some cases it would be nice to make sure that these
background tasks do not run concurrently as concurrency issues can
result.

For example, I might have a URL fetch tied to a user interface
button.  When the URL returns, I update an internal model with new
data.  If the fetch is slow to load, the user will keep mashing the
button, resulting in multiple requests.  It would be nice to have
those requests single threaded, rather than having to worry about 5
requests returning asychronously, and having to synchronize my model
update code.

Also, as it appears that the default is currently single threading,  a
change to make the pool larger could break any apps that depend on the
single threading behavior.

On Jun 26, 12:24 pm, Romain Guy  wrote:
> Hi,
>
> It's a bug and your workaround is correct. I'll fix this right away.
>
>
>
>
>
> On Fri, Jun 26, 2009 at 9:27 AM, Jayesh Salvi wrote:
> > Hi,
>
> > I am replacing the multithreaded code in my app with the AsyncTask from 1.5.
> > I found that two AsyncTasks do not work concurrently. I investigated a bit
> > and found a workaround; I would like second opinion if my solution is right.
> > OR if there is a better solution.
>
> > AsyncTask allows the app to do a task on a thread other than the UI thread.
> > But IIUC, it only provides a single thread on which a queue of tasks is
> > performed. Therefore, if one of the task is to wait on some event (n/w or
> > sleep) then all other tasks will wait for it to finish.
>
> > To elaborate with the coding example:
> > 
>
> > public class MyTask extends AsyncTask<...>
> > { ... }
>
> > // On the UI thread execute two tasks
> > MyTask mt1 = new MyTask().execute(args);
>
> > MyTask mt2 = new MyTask().execute(args);
>
> > 
>
> > In the above code both the execute calls will return immediately and free up
> > the UI thread; however mt1 will be executed first and mt2 will have to wait
> > until mt1 finishes.
>
> > Thanks to the android's open source, we can see implementation of AsyncTask.
> >http://google.com/codesearch/p?hl=en&sa=N&cd=2&ct=rc#uX1GffpyOZk/core...
>
> > I copied AsyncTask.java as UserTask.java in my project and changed the value
> > of CORE_POOL_SIZE to 5. This makes the thread pool to use 5 threads to
> > multiplex the queued AsyncTasks. This indeed solved my problem. Now if mt1
> > blocks on a sleep; mt2 goes ahead and finishes its job.
>
> > Here are some questions for those who know more about AsyncTask
> > implementation:
>
> > Is this work-around right?
> > If yes, can the CORE_POOL_SIZE be made configurable in future, via an API
> > call?
> > Is there a solution by which multiple thread pools can be used?
>
> > Let me add that, I am aware that this is a phone and not a web server - I am
> > not using 10s of threads to do network I/O. However a single thread is not
> > sufficient for my app either.
>
> > Please let me know. Thanks in advance.
>
> > Jayesh
>
> --
> Romain Guy
> Android framework engineer
> romain...@android.com
>
> Note: please don't send private questions to me, as I don't have time
> to provide private support.  All such questions should be posted on
> public forums, where I and others can see and answer them
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---




[android-developers] LiveFolder

2009-06-27 Thread glory

Hi all,

Is there is any way we can customerize the list show in the Live
Folder.

Regards,
Glory
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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: Intent.ACTION_SEND and Email

2009-06-27 Thread Nmix

That's great. Thanks. Unfortunately this tells me I have to live with
what I have since it's beyond my control. I don't mind if other email
clients (gmail or whatever) pick up the intent - it's the user's
choice - I'd just rather not pick up apps that are not especially
suited to my purpose. So it goes.

On Jun 26, 10:09 pm, Doug  wrote:
> For Email/MMS app:
> (from packages/apps/Email/AndroidManifest.xml and packages/apps/Mms/
> AndroidManifest.xml)
>
>                 
>                 
>                 
>
> Of course, these are just the mimeType's mentioned in the manifest
> files distributed as part of the 1.5 source - any additional apps
> installed on the phone (like the GMail client) will undoubtedly
> provide their own.  And anything could happen in the next release :)
>
> Doug
>
> On Jun 26, 1:05 pm, Nmix  wrote:
>
> > I am experimenting with sending email from within my app by launching
> > an email app with startActivity(Intent.ACTION_SEND) or
> > (Intent.createChooser(i, title) with various extras.  I have it
> > working, although not completely to my liking.
>
> > ACTION_SEND is fairly generic so the chooser pulls up email apps and
> > also messaging apps. If there's just the one email app, this means one
> > extra step for the user that would be nice to avoid.  Is this
> > possible?
>
> > Another question is with the mime type set with intent.setType(). The
> > doc on setType suggests "text/plain" when EXTRA_TEXT is used. This
> > works ok. However when I had first tried setting the mime type to
> > "message/rfc822", the chooser failed to find any app that could handle
> > it. (I found this from an example posted by Mark Murphy on Dec 12/08.)
> > This makes me wonder just how I can latch onto the email apps more
> > effectively. Is there a list of mime types that are handled by the
> > Google-supplied messaging apps? Maybe some choice will help me to
> > avoid having the chooser pull up unwanted choices.
>
> > 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] How to draw tracks on gmaps in apps

2009-06-27 Thread Delta Foxtrot
I've been struggling to efficently draw tracks over the top of maps embedded
in my app.

I've been redrawing the track with the ondraw method however as the number
of points the app and eventually the phone crawls to a halt and I get a
bunch of force close/wait messages as a result.

I've been toying with the idea to some how draw the track on a bitmap or
canvas and every time GPS updates, update the canvas/bitmap and display it
as an overlay but I don't really know how I would or should go about this.

Does anyone have any tips on 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] How to save a Bitmap instance to a *.bmp file.

2009-06-27 Thread 楊健

Hey everybody !
 How can i save a Bitmap instance to a *.bmp file?Anyone knows?
Is it strange that we can only save a bitmap instance to a png or jpg
file?
Best 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: Rotating image using setImageMatrix()

2009-06-27 Thread deepdr...@googlemail.com

you should be able to do that with something like

matrix.preTranslate(-centerX, -centerY);
matrix.postTranslate(centerX, centerY);

--
http://www.deepdroid.com


On Jun 27, 10:32 am, "sagar.indianic" 
wrote:
> Hi all,
>
> I rotate image using setImageMatrix() function. I first use
> getImageMatrix() function to get matrix then i use matrix.postRotate
> (90). Rotation works fine. But it rotates around top/left corner of
> image.  i want to change that pivot point to center of the image. how
> can I do that
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Instrumentaion - running multiple istrumentation simultaneously

2009-06-27 Thread Dianne Hackborn
Sorry you can only run one instrumentation at a time.

On Sat, Jun 27, 2009 at 2:26 AM, dev  wrote:

>
> More to add on the same:
>
> I tried 2 different apk's with test suites I want to run.
>
> i.e.
>
> apk1 has testsuite1
> and apk2 has testsuite2
>
> tried running them in two terminals simultaneously.
>
> What I saw was, though I did not get any crash, they don't run
> simultaneously.
> Execution was one followed by other, I continued getting "DDM dispatch
> reg wait timeout
> Can't dispatch DDM chunk 52454151: no handler defined " messages too.
>
> So Is not it possible to run two instrumentation tests together?
>
> Regards,
> dev
>
>
>
> On Jun 27, 12:56 pm, dev  wrote:
> > Hello All,
> >
> > This is what I have,say:
> >
> > TestCases : TestCase 1 to TestCase10 , all have several test methods
> > in it (all extends base class InstrumentationTestCase)
> >
> > TestSuite:
> > TestSuite 1 - Adds 'TestCase 1 to TestCase10' in
> > its suite
> >
> > All of the above is in single APK.
> >
> > Instrumentation Runer used is - android.test.InstrumenationTestRunner
> > itself.
> >
> > --
> > This is what I am trying:
> >
> > - I launched Emulator having above apk
> >
> > - I opened three terminals , two to run instrumentation and third one
> > to log results i.e.
> >
> > Terminal 1 : adb shell am instrument -w -e class
> > com.InstrTest.TestSuite1 com.InstrTest/
> > android.test.InstrumentationTestRunner
> >
> > com.InstrTest.TestCase1:
> > com.InstrTest.TestCase2:
> > com.InstrTest.TestCase3:
> > com.InstrTest.TestCase4:
> > com.InstrTest.TestCase5:
> > com.InstrTest.TestCase6:...INSTRUMENTATION_RESULT:
> > shortMsg=Process crashed.
> > INSTRUMENTATION_CODE: 0
> >
> > Terminal 2:
> >
> > terminal 1 : adb shell am instrument -w -e class
> > com.MyInstr.TestSuite1 com.MyInstr/
> > android.test.InstrumentationTestRunner
> >
> > DDM dispatch reg wait timeout
> > Can't dispatch DDM chunk 52454151: no handler defined
> > Can't dispatch DDM chunk 48454c4f: no handler defined
> >
> > com.InstrTest.TestCase1:
> > com.InstrTest.TestCase2:
> > com.InstrTest.TestCase3:
> > com.InstrTest.TestCase4:
> > com.InstrTest.TestCase5:
> > com.InstrTest.TestCase6:
> > com.InstrTest.TestCase7:
> > com.InstrTest.TestCase8:
> > com.InstrTest.TestCase9:
> > com.InstrTest.TestCase10:
> > Test results for
> > InstrumentationTestRunner=.
> > ...
> > Time: 11.191
> >
> > OK (10 tests)
> >
> > Terminal 3: This is what I saw in the middle of logcat dump:
> >
> > ..
> > ..
> > ..
> > D/ActivityManager(  564): Uninstalling process com.InstrTest
> >
> > D/ActivityManager(  564): Force removing process ProcessRecord
> > {4379dad0 785:tr.nth/10041} (tr.nth/10041)
> >
> > W/ActivityManager(  564): Crash of app com.InstrTest running
> > instrumentation ComponentInfo{com.InstrTest/
> > android.test.InstrumentationTestRunner}
> >
> > D/ActivityManager(  564): Uninstalling process com.InstrTest
> >
> > D/AndroidRuntime(  776): Shutting down VM
> > ..
> > ..
> > ..
> >
> > Queries:
> > 1. Is not it possible to run instrumentation in above manner?
> > 2. I tried another TestSuite2 in terminal 2 instead of TestSuite1 ,
> > this also gave same results.
> >
> > My aim is to run 2 testsuites parallel, using same apk. Is it
> > possible?
> > Or I have to use two different apks? Is there any way that this is
> > possible?
> >
> > Any input would be appreciated.
> >
> > Regards,
> > Dev
> >
>


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

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

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



[android-developers] Re: concurrency of AsyncTasks

2009-06-27 Thread Streets Of Boston

As long as you have the default pool-size set to 1, there should be no
issues what-so-ever.

On Jun 27, 8:00 am, joshv  wrote:
> Interesting issue.  I can see the need to make this configurable
> though.  In some cases it would be nice to make sure that these
> background tasks do not run concurrently as concurrency issues can
> result.
>
> For example, I might have a URL fetch tied to a user interface
> button.  When the URL returns, I update an internal model with new
> data.  If the fetch is slow to load, the user will keep mashing the
> button, resulting in multiple requests.  It would be nice to have
> those requests single threaded, rather than having to worry about 5
> requests returning asychronously, and having to synchronize my model
> update code.
>
> Also, as it appears that the default is currently single threading,  a
> change to make the pool larger could break any apps that depend on the
> single threading behavior.
>
> On Jun 26, 12:24 pm, Romain Guy  wrote:
>
>
>
> > Hi,
>
> > It's a bug and your workaround is correct. I'll fix this right away.
>
> > On Fri, Jun 26, 2009 at 9:27 AM, Jayesh Salvi wrote:
> > > Hi,
>
> > > I am replacing the multithreaded code in my app with the AsyncTask from 
> > > 1.5.
> > > I found that two AsyncTasks do not work concurrently. I investigated a bit
> > > and found a workaround; I would like second opinion if my solution is 
> > > right.
> > > OR if there is a better solution.
>
> > > AsyncTask allows the app to do a task on a thread other than the UI 
> > > thread.
> > > But IIUC, it only provides a single thread on which a queue of tasks is
> > > performed. Therefore, if one of the task is to wait on some event (n/w or
> > > sleep) then all other tasks will wait for it to finish.
>
> > > To elaborate with the coding example:
> > > 
>
> > > public class MyTask extends AsyncTask<...>
> > > { ... }
>
> > > // On the UI thread execute two tasks
> > > MyTask mt1 = new MyTask().execute(args);
>
> > > MyTask mt2 = new MyTask().execute(args);
>
> > > 
>
> > > In the above code both the execute calls will return immediately and free 
> > > up
> > > the UI thread; however mt1 will be executed first and mt2 will have to 
> > > wait
> > > until mt1 finishes.
>
> > > Thanks to the android's open source, we can see implementation of 
> > > AsyncTask.
> > >http://google.com/codesearch/p?hl=en&sa=N&cd=2&ct=rc#uX1GffpyOZk/core...
>
> > > I copied AsyncTask.java as UserTask.java in my project and changed the 
> > > value
> > > of CORE_POOL_SIZE to 5. This makes the thread pool to use 5 threads to
> > > multiplex the queued AsyncTasks. This indeed solved my problem. Now if mt1
> > > blocks on a sleep; mt2 goes ahead and finishes its job.
>
> > > Here are some questions for those who know more about AsyncTask
> > > implementation:
>
> > > Is this work-around right?
> > > If yes, can the CORE_POOL_SIZE be made configurable in future, via an API
> > > call?
> > > Is there a solution by which multiple thread pools can be used?
>
> > > Let me add that, I am aware that this is a phone and not a web server - I 
> > > am
> > > not using 10s of threads to do network I/O. However a single thread is not
> > > sufficient for my app either.
>
> > > Please let me know. Thanks in advance.
>
> > > Jayesh
>
> > --
> > Romain Guy
> > Android framework engineer
> > romain...@android.com
>
> > Note: please don't send private questions to me, as I don't have time
> > to provide private support.  All such questions should be posted on
> > public forums, where I and others can see and answer them- Hide quoted text 
> > -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: How to save a Bitmap instance to a *.bmp file.

2009-06-27 Thread Romain Guy

BMP is not supported on Android. And why is it strange? PNG and JPG
are widely used formats across platforms.

On Sat, Jun 27, 2009 at 7:32 AM, 楊健 wrote:
>
> Hey everybody !
>  How can i save a Bitmap instance to a *.bmp file?Anyone knows?
> Is it strange that we can only save a bitmap instance to a png or jpg
> file?
> Best regards!
> >
>



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

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

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



[android-developers] Re: LiveFolder

2009-06-27 Thread Mark Murphy

glory wrote:
> Is there is any way we can customerize the list show in the Live
> Folder.

For a live folder for your own content provider, yes, IIRC.

For a live folder for somebody else's content provider, no, IIRC.

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

_Android Programming Tutorials_ Version 1.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: How to save a Bitmap instance to a *.bmp file.

2009-06-27 Thread Mark Murphy

楊健 wrote:
>  How can i save a Bitmap instance to a *.bmp file?Anyone knows?

Option #1: Don't do it. So, for example, if this is a question of
uploading data to some server, let the server do the conversion from PNG.

Option #2: See if there is a way, through the implementation of Bitmap
in the open source code, for C/C++ code to get its hands on the raw byte
array that is the image. Then, use the newly-released NDK to write
yourself a utility method somewhere that works like compress(), but
writes out BMP files, perhaps using some existing BMP-encoding C code
you find somewhere.

> Is it strange that we can only save a bitmap instance to a png or jpg
> file?

No. BMP files are huge (compared to a PNG edition of the same image),
and huge is not something you typically want on a mobile phone.

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

_Android Programming Tutorials_ Version 1.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: Delete assets at runtime

2009-06-27 Thread nEx.Software

Alternatively, you could download the file at first run, do whatever
it is that you need to do with it then delete it.

On Jun 25, 5:44 am, nuno  wrote:
> Thanks Mark,
> I though that was the answer. I'll have to live with the file.
> Cheers,
>
> Nuno
>
> On Jun 25, 1:39 pm, Mark Murphy  wrote:
>
>
>
> > nuno wrote:
> > > I have a large (900kb) asset in the assets directory which is only
> > > used once by the app at initialization time. Is there way for me to
> > > delete this file at runtime?
>
> > No.
>
> > > If not delete change it's contents to "0" and effectively reduce its
> > > size to almost nothing.
>
> > No.
>
> > > There isn't really any point of having this take space on the phone's
> > > limited memory.
>
> > That may be true, but the APK is signed and cannot be modified at runtime.
>
> > --
> > Mark Murphy (a Commons 
> > Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> > _Beginning Android_ from Apress Now 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: Default number of Views constructed for a BaseAdapter?

2009-06-27 Thread Doug
Have you tried *not* caching the component views in your ViewHolder
object - instead looking them up whenever you get a redraw request?
You may find that the list is re-using objects, and your image issue
is simply an artifact of that.

Doug

On Jun 26, 10:56 pm, Peter  wrote:
> > There's not a default number of views created for an adapter. A list
> > creates as many views as it needs to fill the screen. Views get reused
> > only when you start scrolling or when the adapter send a
> > notifyDatasetChanged(). You say you have a thread updating the data,
> > what is exactly that thread doing? Please show code.
>
> Here is some code. Perhaps it will help.
>
> ** the worker thread ***
> --
>
>         class IconLoaderThread extends Thread {
>                 List appList;
>                 void loadAllResources(List appList) {
>                         this.appList = appList;
>                         start();
>                 }
>
>                 public void run() {
>                         int maxSize;
>
>                         for (int i = 0; i < maxSize; i++) {
>                                 ObjectToShow appInfo = appList.get(i);
> // network access occurs here
>                                 Bitmap icon = appQuery.lookupAppIcon(appInfo);
>                                 Message msg = 
> handler.obtainMessage(MSG_REFRESH_APP_ICON);
>                                 Bundle data = new Bundle();
>                                 data.putString("s3ObjectKey", 
> appInfo.getS3ObjectKey());
>                                 msg.obj = icon;
>                                 msg.setData(data);
>                                 handler.sendMessage(msg);
>                         }
>                         Message doneMsg = 
> handler.obtainMessage(MSG_ICONS_DONE);
>                         handler.sendMessage(doneMsg);
>                 }
>         }
>
> ** the handler ***
> --
>
>         private Handler handler = new Handler() {
>                 public void handleMessage(Message msg) {
>                         ObjectToShow appInfo;
>                         switch (msg.what) {
>                         case MSG_INIT_APP_LIST:
>                                 initProgressBar();
>                                 handler.sendEmptyMessage(MSG_NEXT_LOAD_STEP);
>                                 break;
>                         case MSG_REFRESH_APP_ICON:
>                                 Bitmap icon = (Bitmap)msg.obj;
>                                 String s3ObjectKey = 
> msg.getData().getString("s3ObjectKey");
>                                 if(icon == null || s3ObjectKey == null) {
>                                         Log.w(TAG, "Error loading icon");
>                                 } else {
>                                         
> efficientAdapter.updateAppInfoIcon(s3ObjectKey, icon);
>                                 }
>                                 break;
>                         case MSG_REFRESH_APP_METADATA:
>                                 appInfo = (ObjectToShow)msg.obj;
>                                 if(appInfo == null) {
>                                         Log.w(TAG, "Error loading icon");
>                                 } else {
>                                         
> efficientAdapter.updateAppInfoMetadata(appInfo);
>                                 }
>                                 break;
>                         case MSG_METADATA_DONE:
>                                 metadataLoaded = true;
>                                 handler.sendEmptyMessage(MSG_NEXT_LOAD_STEP);
>                                 break;
>                         case MSG_ICONS_DONE:
>                                 iconsLoaded = true;
>                                 handler.sendEmptyMessage(MSG_NEXT_LOAD_STEP);
>                                 break;
>                         case MSG_NEXT_LOAD_STEP:
>                                 if (metadataLoaded && iconsLoaded) {
>                                         doneLoadingMetadata();
>                                 }
>                                 else if (metadataLoaded || iconsLoaded) {
>                                         if (firstRun) {
>                                                 // Set the adapter here.
>                                                 firstRun = false;
>                                                 
> appListView.setAdapter(efficientAdapter);
>                                                 dismissLoadingMessage();
>                                         }
>                                         initIconThread();
>                                 }
>                                 else {
>                                         initMetadataThread();
>                                 }
>                                 break;
>                         default:
>     

[android-developers] Re: Any Insight on this crash?

2009-06-27 Thread MrChaz

What are you doing in your onCreate and onResume methods?
If you're getting a crash on start up like that I'd wager that you're
doing something that take a long time and so times out.

On Jun 27, 12:13 am, Carl Minden  wrote:
> I am getting a crash intermittently when my Activity starts up either
> initially or when the screen gets rotated I get several log messages
> which I have been unable to get any insight from:
>
> timeout expired mFreezeDisplay=1 mFreezeCount=0
> App freeze timeout expired
> Force clearing freeze
> then lots of: Lock_layer timed out (is the CPU pegged?)
> Key dispatching timed out
>
> then I get ANR annotation: keyDispatchingTimedOut
>
> the trace has alot of
>
> sending signal 3 to alot of PIDs
>
> anyone have any idea what my problem might be, or for that matter what
> any of these things might mean or be indicating?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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: Keeping an application running in the background

2009-06-27 Thread MrChaz

Just to add a note,
Services are stopped when the phone goes to sleep e.g. the screen goes
off.
You can prevent this via WakeLock's but they impact battery life so be
careful

On Jun 27, 4:55 am, Delta Foxtrot  wrote:
> 2009/6/27 Dennis 
>
>
>
> > Yet another question -- we have an application that connects to a
> > device and therefore needs to keep running in the background even when
> > there are no Activities active.  What is the recommended way to
> > indicate that our application is still active and for it not to be
> > killed automatically?
>
> You extend Service instead of Activity, services have no UI and run in the
> background. They can interact with activities.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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] DDMS won't load (or doesn't parse?) KML file

2009-06-27 Thread nderraugh

I can't get DDMS to load any KML files.

I have a KML file for example with the following in it:


http://www.opengis.net/kml/2.2";>
  
Simple placemark
Attached to the ground. Intelligently places itself
   at the height of the underlying terrain.

  -122.0822035425683,37.42228990140251,0

  


The docs at http://developer.android.com/guide/developing/tools/ddms.html
seem to indicate that I only need to launch my app and fire up DDMS
and load the KML.  That doesn't work.

I even tried the Google Earth solution suggested at the same link.

I'm using SDK 1.5_r2.  I am doing something wrong or missing something?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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] Camera in portrait mode

2009-06-27 Thread indra

Hi guys at android,

Can you plase fix http://code.google.com/p/android/issues/detail?id=1193
When do you expect it to get fixed? I am a developer working on
http://layar.eu and I had to go through lot of trouble to get the app
working in portrait mode with camera preview, using a LOT of
rotations. I have managed to get everything rotated to portrait except
for the on screen inputmethod which still shows up in landscape. Do
you have any suggestions for rotating that?

Thanks,
Indraneel
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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 pass a file created in my activity to another activity

2009-06-27 Thread silverburgh

On Fri, Jun 26, 2009 at 5:29 PM, Mark Murphy wrote:
>
> silverburgh wrote:
>> I create a local file in my activity like this:
>>
>> File f = getFileStreamPath("mypicture");
>>
>> How can I pass the URI of this file to another Activity?
>
> If the other activity is one in your application, just tell it the path
> from the File object, or the relative path you started with.
>
> If the other activity is outside your application, you can use
> File#getAbsolutePath() to get the fully-qualified path.
>
>> And do I need to set any permission (file permission, manifest
>> permission) to allow other Activity to use that file?
>
> You can try MODE_WORLD_READABLE and MODE_WORLD_WRITEABLE with
> openFileOutput() when you create the file, but I have not tried these.
> By default, other applications cannot access your file in your app-local
> file storage area.


Thanks. But I need help in combine your 2 ideas together.

In creating file using MODE_WORLD_READABLE , it returns a reference of
FileOutputStream, not File, how can i get call the getAbsolutePath?

File#getAbsolutePath() to get the fully-qualified path.

try {
FileOutputStream fos = openFileOutput 
("temp-picture",
MODE_WORLD_WRITEABLE);


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



>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://twitter.com/commonsguy
>
> Need help for your Android OSS project? http://wiki.andmob.org/hado
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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: IMAGE_CAPTURE Intent never returns to onActivityResult(int, int, Intent);

2009-06-27 Thread hanged_man

are you sure you have overriden onActivityResult method correctly ?
something like this:
@Override
protected void onActivityResult(int requestCode, int resultCode,
Intent data)

Also, is the "Image Capture" intent working for you ? it's not exactly
working for me, i keep getting a black screen, and if i try to start
the camera application manually (in the emulator ofcourse) i get the
same problem, no idea why. Please let me know if you have any solution
for 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] calling setBackgroundColor in getView of custom ArrayAdapter causes orange background of listitem to disappear

2009-06-27 Thread pawpaw17

Hi,

I have a listview with a custom ArrayAdapter. I've implemented getView
so I can do different things
in different list items based on the contents. For example I call
setBackgroundColor based on
the contents of the list.

Problem now is that when the listItem is selected, it doesn't get the
orange background. How
do I tell when NOT to call setBackGround color?

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: How can I pass a file created in my activity to another activity

2009-06-27 Thread Mark Murphy

silverburgh wrote:
> On Fri, Jun 26, 2009 at 5:29 PM, Mark Murphy wrote:
>> silverburgh wrote:
>>> I create a local file in my activity like this:
>>>
>>> File f = getFileStreamPath("mypicture");
>>>
>>> How can I pass the URI of this file to another Activity?
>> If the other activity is one in your application, just tell it the path
>> from the File object, or the relative path you started with.
>>
>> If the other activity is outside your application, you can use
>> File#getAbsolutePath() to get the fully-qualified path.
>>
>>> And do I need to set any permission (file permission, manifest
>>> permission) to allow other Activity to use that file?
>> You can try MODE_WORLD_READABLE and MODE_WORLD_WRITEABLE with
>> openFileOutput() when you create the file, but I have not tried these.
>> By default, other applications cannot access your file in your app-local
>> file storage area.
> 
> 
> Thanks. But I need help in combine your 2 ideas together.
> 
> In creating file using MODE_WORLD_READABLE , it returns a reference of
> FileOutputStream, not File, how can i get call the getAbsolutePath?

File f = getFileStreamPath("mypicture");

Just because you use openFileOutput() does not mean you are forevermore
blocked from calling getFileStreamPath(). Just call getFileStreamPath()
on the file you just created.

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

Android App Developer Books: http://commonsware.com/books.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
-~--~~~~--~~--~--~---



[android-developers] Spinner style?

2009-06-27 Thread Kent Loobey

Is there a way to set a Spinner's style so that each entry has the but no 
radio 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: How can I pass a file created in my activity to another activity

2009-06-27 Thread silverburgh

On Sat, Jun 27, 2009 at 3:58 PM, Mark Murphy wrote:
>
> silverburgh wrote:
>> On Fri, Jun 26, 2009 at 5:29 PM, Mark Murphy wrote:
>>> silverburgh wrote:
 I create a local file in my activity like this:

 File f = getFileStreamPath("mypicture");

 How can I pass the URI of this file to another Activity?
>>> If the other activity is one in your application, just tell it the path
>>> from the File object, or the relative path you started with.
>>>
>>> If the other activity is outside your application, you can use
>>> File#getAbsolutePath() to get the fully-qualified path.
>>>
 And do I need to set any permission (file permission, manifest
 permission) to allow other Activity to use that file?
>>> You can try MODE_WORLD_READABLE and MODE_WORLD_WRITEABLE with
>>> openFileOutput() when you create the file, but I have not tried these.
>>> By default, other applications cannot access your file in your app-local
>>> file storage area.
>>
>>
>> Thanks. But I need help in combine your 2 ideas together.
>>
>> In creating file using MODE_WORLD_READABLE , it returns a reference of
>> FileOutputStream, not File, how can i get call the getAbsolutePath?
>
> File f = getFileStreamPath("mypicture");
>
> Just because you use openFileOutput() does not mean you are forevermore
> blocked from calling getFileStreamPath(). Just call getFileStreamPath()
> on the file you just created.
>


Thank you.  I appreciate your help.  I tried your suggestions. But I
still cant' get it to work.

I am trying to launch ACTION_IMAGE_CAPTURE activity using the
MediaStore.EXTRA_OUTPUT parameter to specify the URL of the captured
image.

Here is my code, but my activity's protected void onActivityResult()
never get called.
Can you please tell me what am I doing wrong?

Intent i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE, null);

File f = getFileStreamPath("temp-picture");
(new File(f.getParent())).mkdirs();
String mTempFilePath = f.getAbsolutePath();
f.delete();

FileOutputStream fos =null;

try {
   fos = openFileOutput ("temp-picture", MODE_WORLD_WRITEABLE);
} catch (FileNotFoundException e) {
} finally {
  if (fos != null) {
try {
fos.close();
  } catch (IOException e) {
}
}
}

i.putExtra(MediaStore.EXTRA_OUTPUT, Uri.parse("file:/" + mTempFilePath));
i.putExtra("outputFormat",Bitmap.CompressFormat.PNG.name());
System.out.println (" catpure 
picture 4");
// i.putExtra("crop", "circle");
//i.putExtra("return-data", true);

startActivityForResult(i, PICK_ICON_FROM_CAMERA_ID);



> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://twitter.com/commonsguy
>
> Android App Developer Books: http://commonsware.com/books.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
-~--~~~~--~~--~--~---



[android-developers] Re: Spinner style?

2009-06-27 Thread Kent Loobey

On Saturday 27 June 2009 16:38:20 Kent Loobey wrote:
> Is there a way to set a Spinner's style so that each entry has the but no
> radio button?

Is there a way to set a Spinner's style so that each entry has text but no
radio 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] how to call intent_view

2009-06-27 Thread cindy

I want to call INTENT_VIEW to play a local video:
 private void doPlayCurrentVideo() {
mCurrentVideoUri=Uri.parse(mCurrentVideoFilename);
Intent intent = new Intent(Intent.ACTION_VIEW,
mCurrentVideoUri);
try {
startActivity(intent);
} catch (android.content.ActivityNotFoundException ex) {
Log.e(TAG, "Couldn't view video " + mCurrentVideoUri, ex);
}
}

but I got exception "ActivityNotFoundException", How can I fix it?

Thanks!

Cindy
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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 call intent_view

2009-06-27 Thread Mark Murphy

cindy wrote:
> I want to call INTENT_VIEW to play a local video:
>  private void doPlayCurrentVideo() {
> mCurrentVideoUri=Uri.parse(mCurrentVideoFilename);
> Intent intent = new Intent(Intent.ACTION_VIEW,
> mCurrentVideoUri);
> try {
> startActivity(intent);
> } catch (android.content.ActivityNotFoundException ex) {
> Log.e(TAG, "Couldn't view video " + mCurrentVideoUri, ex);
> }
> }
> 
> but I got exception "ActivityNotFoundException", How can I fix it?

Install an application that responds to that Intent.

There is no video player on Android by default, AFAIK. However, there
may be third party video players that will honor your request, depending
on what mCurrentVideoFilename is.

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

Need Android talent? Ask on HADO! http://wiki.andmob.org/hado

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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 call intent_view

2009-06-27 Thread cindy

Thanks!

I found there is no API to generate a image thumbnail for video. How
the camcorder of G1 phonedo that ?

Thanks!

Cindy

On Jun 27, 5:30 pm, Mark Murphy  wrote:
> cindy wrote:
> > I want to call INTENT_VIEW to play a local video:
> >  private void doPlayCurrentVideo() {
> >         mCurrentVideoUri=Uri.parse(mCurrentVideoFilename);
> >         Intent intent = new Intent(Intent.ACTION_VIEW,
> > mCurrentVideoUri);
> >         try {
> >             startActivity(intent);
> >         } catch (android.content.ActivityNotFoundException ex) {
> >             Log.e(TAG, "Couldn't view video " + mCurrentVideoUri, ex);
> >         }
> >     }
>
> > but I got exception "ActivityNotFoundException", How can I fix it?
>
> Install an application that responds to that Intent.
>
> There is no video player on Android by default, AFAIK. However, there
> may be third party video players that will honor your request, depending
> on what mCurrentVideoFilename is.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Need Android talent? Ask on HADO!http://wiki.andmob.org/hado
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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 the SaveRestoreState in ApiDemo bugged?

2009-06-27 Thread biAji

I can't understand what it want to do...Is it a bug?


SaveRestoreState.java

The file containing the source code shown below is located in the
corresponding directory in /platforms/android-/
samples/...

/*
 * Copyright (C) 2007 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.example.android.apis.app;

// Need the following import to get access to the app resources, since
this
// class is in a sub-package.
import com.example.android.apis.R;

import android.app.Activity;
import android.os.Bundle;
import android.widget.EditText;
import android.widget.TextView;

/**
 * Demonstrates required behavior of saving and restoring dynamic
activity
 * state, so that an activity will restart with the correct state if
it is
 * stopped by the system.
 *
 * In general, any activity that has been paused may be stopped by
the system
 * at any time if it needs more resources for the currently running
activity.
 * To handle this, before being paused the
 * {...@link android.app.Activity#onSaveInstanceState onSaveInstanceState
()} method is called before
 * an activity is paused, allowing it to supply its current state.  If
that
 * activity then needs to be stopped, upon restarting it will receive
its
 * last saved state in
 * {...@link android.app.Activity#onCreate}.
 * In this example we are currently saving and restoring the state
of the
 * top text editor, but not of the bottom text editor.  You can see
the difference
 * by editing the two text fields, then going to a couple different
 * applications while the demo is running and then returning back to
it.  The
 * system takes care of saving a view's state as long as an id has
been
 * assigned to the view, so we assign an ID to the view being saved
but not
 * one to the view that isn't being saved.
 * Demo
 * App/Activity/Save & Restore State
 * Source files
 * 

src/com.example.android.apis/app/
SaveRestoreState.java
The Save/Restore Screen
implementation


/res/any/layout/
save_restore_state.xml
Defines contents of the screen


 */
public class SaveRestoreState extends Activity
{
/**
 * Initialization of the Activity after it is first created.  Here
we use
 * {...@link android.app.Activity#setContentView setContentView()} to
set up
 * the Activity's content, and retrieve the EditText widget whose
state we
 * will save/restore.
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
// Be sure to call the super class.
super.onCreate(savedInstanceState);

// See assets/res/any/layout/save_restore_state.xml for this
// view layout definition, which is being set here as
// the content of our screen.
setContentView(R.layout.save_restore_state);

// Set message to be appropriate for this screen.
((TextView)findViewById(R.id.msg)).setText
(R.string.save_restore_msg);
}

/**
 * Retrieve the text that is currently in the "saved" editor.
 */
CharSequence getSavedText() {
return ((EditText)findViewById(R.id.saved)).getText();
}

/**
 * Change the text that is currently in the "saved" editor.
 */
void setSavedText(CharSequence text) {
((EditText)findViewById(R.id.saved)).setText(text);
}
}
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: How to save a Bitmap instance to a *.bmp file.

2009-06-27 Thread 楊健

Thank you very much!
I think i have to convert the file by myself!

On 6月27日, 午後11:52, Mark Murphy  wrote:
> 楊健 wrote:
> >  How can i save a Bitmap instance to a *.bmp file?Anyone knows?
>
> Option #1: Don't do it. So, for example, if this is a question of
> uploading data to some server, let the server do the conversion from PNG.
>
> Option #2: See if there is a way, through the implementation of Bitmap
> in the open source code, for C/C++ code to get its hands on the raw byte
> array that is the image. Then, use the newly-released NDK to write
> yourself a utility method somewhere that works like compress(), but
> writes out BMP files, perhaps using some existing BMP-encoding C code
> you find somewhere.
>
> > Is it strange that we can only save a bitmap instance to a png or jpg
> > file?
>
> No. BMP files are huge (compared to a PNG edition of the same image),
> and huge is not something you typically want on a mobile phone.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> _Android Programming Tutorials_ Version 1.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: How to save a Bitmap instance to a *.bmp file.

2009-06-27 Thread 楊健

But the images we use in application are instances of Bitmap : (

On 6月28日, 午前2:43, Romain Guy  wrote:
> BMP is not supported on Android. And why is it strange? PNG and JPG
> are widely used formats across platforms.
>
> On Sat, Jun 27, 2009 at 7:32 AM, 楊健 wrote:
>
> > Hey everybody !
> >  How can i save a Bitmap instance to a *.bmp file?Anyone knows?
> > Is it strange that we can only save a bitmap instance to a png or jpg
> > file?
> > Best regards!
>
> --
> Romain Guy
> Android framework engineer
> romain...@android.com
>
> Note: please don't send private questions to me, as I don't have time
> to provide private support.  All such questions should be posted on
> public forums, where I and others can see and answer them
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: How to save a Bitmap instance to a *.bmp file.

2009-06-27 Thread Romain Guy

JPG and PNG are also bitmaps.

2009/6/27 楊健 :
>
> But the images we use in application are instances of Bitmap : (
>
> On 6月28日, 午前2:43, Romain Guy  wrote:
>> BMP is not supported on Android. And why is it strange? PNG and JPG
>> are widely used formats across platforms.
>>
>> On Sat, Jun 27, 2009 at 7:32 AM, 楊健 wrote:
>>
>> > Hey everybody !
>> >  How can i save a Bitmap instance to a *.bmp file?Anyone knows?
>> > Is it strange that we can only save a bitmap instance to a png or jpg
>> > file?
>> > Best regards!
>>
>> --
>> Romain Guy
>> Android framework engineer
>> romain...@android.com
>>
>> Note: please don't send private questions to me, as I don't have time
>> to provide private support.  All such questions should be posted on
>> public forums, where I and others can see and answer them
> >
>



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

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

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



[android-developers] mapview overlay with button like googlemap

2009-06-27 Thread chouman82

i am having a hard time figuring out how in the google map
application, it is able to have buttons on the mapview.  I am talking
about the textbox and the two arrow buttons that show up after you do
a search.  The textbox and the two arrows also does not stay on screen
when you pan the map.  anyone has any idea or know where to look for
info please shed some light.

i have spent a few days looking around for answers and end up with
nothing still.

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