[android-developers] Re: Home Screen Detection

2009-08-28 Thread GodsMoon

I was looking at the Package Manager api, but it looks like the
Process api might be more useful.
http://developer.android.com/reference/android/os/Process.html
Has anybody used this before or have an example?

On Aug 27, 6:24 pm, GodsMoon godsm...@gmail.com wrote:
 That might be enough info for my app.
 Which api are you looking at?

 On Aug 27, 6:06 pm, Chris Stratton cs07...@gmail.com wrote:

  On Aug 27, 5:40 pm, GodsMoon godsm...@gmail.com wrote:

   I'm writing a back ground app and would like to be able to tell which
   app is currently running (actually has focus).
   I'm particularly interested in if the Home screen is being shown.
   Can anyone help with this?

  I got stumped on that too.

  There is a call that will get a list of what is running and tell if it
  has user-interactive level of priority, but that's not unique enough -
  a few things (in call screen for example) keep this even when their
  window is not visible.  Another problem is that latin input method can
  show up in the list interactive priority, but you don't know what
  application it is accepting input on behalf of.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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 i can pass my String to Another page

2009-08-28 Thread Lutz Schönemann


Am 28.08.2009 um 13:42 schrieb Sasi Kumar:


 public static String username;


 s2.java

 private String df;

 df=s1.username;

Bad idea. So you have to hardcode the username because it's static and  
you can't change it at runtime
Use intents for this


 thats all!.

 On Aug 28, 2:22 pm, ragavendran s sraghav.ra...@gmail.com wrote:
 Hi ,

   I am new to Android development.I want to transfer transfer my
 String(username) to another page.
 i m having some problems on it...so wil u please tel me the  
 answer.

 with regards
 S.Raghav
 



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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: Home Screen Detection

2009-08-28 Thread GodsMoon

What's the difference between a Task and a Process for
ActivityManager?

On Aug 28, 1:46 pm, Hong lordh...@gmail.com wrote:
 ActivityManager : getRunningTasks(int)

 On Thu, Aug 27, 2009 at 6:24 PM, GodsMoon godsm...@gmail.com wrote:

  That might be enough info for my app.
  Which api are you looking at?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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: ADC 2 Submission Site -- Now live

2009-08-28 Thread RS

Dan, thanks for the confirmation. And anyway the submission process
has been very smooth so far.
Hope our updates (if any) don't get stuck on the last day.

Regards,
RS

On Aug 27, 6:23 pm, Dan Morrill morri...@google.com wrote:
 We are not planning to extend the submission deadline.
 - Dan

 On Tue, Aug 25, 2009 at 2:22 PM, patrick android.com...@gmail.com wrote:

  Hi,

  i'm asking wher can we ask google to extend the deadline?

  thks

  On 25 août, 17:05, Dan Sherman impact...@gmail.com wrote:
   There's no reason that they would change the deadline.  The deadline has
   been set at the 31st since late May (as stated before).  With that
  deadline
   posted, your app should be ready to hit the submit button on the 31st or
   sooner.  Nothing changed, they're giving you a full week to hit the
  Submit
   button.

   - Dan

   On Tue, Aug 25, 2009 at 12:06 PM, Maps.Huge.Info (Maps API Guru) 

   cor...@gmail.com wrote:

I see no need to extend the deadline, it's been public since May 27th,
if you're not ready by now, you'll probably never be ready. People
have to learn that a deadline means something, extending it would only
punish those who are ready and reward those who can't meet project
goals on time.

-John Coryat
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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] onTap start Dialog

2009-08-28 Thread Wouter

Hey,

I have a mapactivity with multiple ItemizedOverlays and a onTap method
when the user clicks on the marker. I can show a toast message but i
want to display a Dialog when the user clicks on the marker (so in
onTap method). How can i do that?

Greetz,

Wouter
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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 build adb.exe for windows.

2009-08-28 Thread Tejas

Not sure. What usb analyzer are you using ?

On Aug 27, 11:37 pm, Kyo Yin kyo@gmail.com wrote:
 old framework of adb in target === means i don`t use the composite
 driver in target if the host is ubuntu.you know, before composite
 gadget driver, the adb is a single gadget driver(kernel 2.6.25).
 kernel 2.6.29 add a composite gadget driver, mass storage and adb are
 the functions of this composite gadget driver.

  Are you saying that the usb transfer seen when using windows is same
 as linux, except the 0 length packet ?=== yse, in ubuntu, host will
 send 0 length packet after a packet which size is 4096 or the multiple
 of 64 and our usb protocol analyzer can catch this 0 length packet. In
 windows, our analyzer cannot catch this 0 length packet. But i have
 checked the usb_windows.c, it will send a 0 length packet.So i guess
 the usb driver in windows block this 0 length packet?

 2009/8/28 Tejas tejas.path...@gmail.com





  I am assuming you meant 4096 bytes.. What do you mean by.. BTW, For
  linux host, i use old framework of adb in target ? Are you saying
  that the usb transfer seen when using windows is same as linux, except
  the 0 length packet ?

  On Aug 27, 12:21 am, Kyo Yin kyo@gmail.com wrote:
   thank you for help.i have built the adb.exe

   and i have a question:
   In my opinion, adb will send a 0 length packet after a packet if thie 
   packet
   length is multiple of the max length of endpoint.
   For example, our endpoint is 64 bytes. So after every 4096 packets, 
   adb.exe
   should send a 0 length packet.

   I found the adb.exe has already try to send a 0 length packet.but
   1.in linux host, our usb analyzer can catch the 0 length packet.
   2.in windows host, our usb analyzer can not catch this 0 length packet.

   Did the widows driver block this 0 length packet?

   BTW, For linux host, i use old framework of adb in target, The composite
   driver can not run in ubuntu 8.04.
   For windows host, i use composite driver which has mass storage and adb in
   target.

   2009/8/19 Roman ( T-Mobile USA) roman.baumgaert...@t-mobile.com

For being able to compile an exe file on Ubuntu you would have to
cross compile on Ubuntu which means you have to have a Windows cross
compiler on it. Do you?

If not then install Cygwin on your windows environment and try it
again. Make sure that you read the related topics about Android/Cygwin
compilation to be aware of any possible provlems.

--
Roman Baumgaertner
Sr. SW Engineer-OSDC
·T· · ·Mobile· stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.

On Aug 18, 9:38 pm, Kyo Yin kyo@gmail.com wrote:
 hi roman    1.How do you try to compile?
     i just use make HOST_OS=windows in ubuntu.
     2.Are you doing this on Cygwin?
     no.i use ubuntu.

     do you mean i should use cygwin to build adb.exe for windows?

 kyo
 3273

 2009/8/19 Roman ( T-Mobile USA) roman.baumgaert...@t-mobile.com

  How do you try to compile? Are you doing this on Cygwin?

  --
  Roman Baumgaertner
  Sr. SW Engineer-OSDC
  ·T· · ·Mobile· stick together
  The views, opinions and statements in this email are those of the
  author solely in their individual capacity, and do not necessarily
  represent those of T-Mobile USA, Inc.

  On Aug 18, 5:41 am, Kyo kyo@gmail.com wrote:
   hi,everyone.
       i want to modify the usb_windows.c in /system/core/adb and
   recompile a new adb.exe to test our platform.
       but, when i use make HOST_OS=windows, it failed.
       i use ubuntu 8.04 and i can build with make HOST_OS=linux.
       does anyone know how to build my adb.exe?

       thanks

   kyo
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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: Recorded sound file not getting listed in Music menu

2009-08-28 Thread elcadar

Use this:

http://developer.android.com/reference/android/media/MediaScannerConnection.html

Force it to scan the new file. Then your audio file will show up when
using the Music app.

On Aug 20, 2:49 am, kk_Kiran simplyurki...@gmail.com wrote:
 Thx for your reply Marco.
 WhilerecordingtheaudioI need to specify output file path. So I
 have already added the title and path for the recorded file. That file
 is being created with correct name and correct path in sdcard. The
 only problem is emulator is not able to scan the file and thus that
 file is not getting listed in music menu until emulator is closed and
 relaunched.

 On Aug 20, 12:15 am, Marco Nelissen marc...@android.com wrote:



  If you create a media file, it is your responsibility to add it to the
  database with a proper title, artist, album, etc.

  On Wed, Aug 19, 2009 at 8:23 AM,kk_Kiransimplyurki...@gmail.com wrote:

   Hi friends,

   I have created an basic sound recorder application using MediaRecorder
   class. It has 3 buttons i.e.

   1.Record : Startrecording
   2.Stop     : Stoprecording
   3.Play      : Play recorded file ( 3gp format)

   I can record any number of files using this. Each files gets name as
   audio1,audio2 ..etc.

   The problem is afterrecordingthe file I can play it using play
   button. But if I exit my application I am not able to see that file
   listed in music menu in emulator. But at the same time when i browse
   my sdcard using eclipse I can see the recordedaudiofile. ( I have
   aleady mounted sdcard image and can see other sdcard content in
   emulator)

   Now if I close the emulator and relaunch it I can see that file in
   emulator music menu. Now suppose that file name is audio1.3gp. If I
   record a sound using my app it will record it using name audio1.3gp on
   same location. This time if I goto music menu I can see audio1.3gp
   file with latest recordedaudio.

   Can anybody help me on why this is happening?

   Thanks in advance and sorry for long description :).
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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] Touch Listener

2009-08-28 Thread human android

I am trying to use touch listener on 2 View objects.
I made both objects focussable but it works for one object and does
not for the other.
Any idea how to solve 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: Home Screen Detection

2009-08-28 Thread Dianne Hackborn
They are described here:
http://developer.android.com/guide/topics/fundamentals.html

On Fri, Aug 28, 2009 at 10:53 AM, GodsMoon godsm...@gmail.com wrote:


 What's the difference between a Task and a Process for
 ActivityManager?

 On Aug 28, 1:46 pm, Hong lordh...@gmail.com wrote:
  ActivityManager : getRunningTasks(int)
 
  On Thu, Aug 27, 2009 at 6:24 PM, GodsMoon godsm...@gmail.com wrote:
 
   That might be enough info for my app.
   Which api are you looking at?
 



-- 
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: programatically detect foreground application/ screen?

2009-08-28 Thread Chris Stratton

On Aug 28, 1:45 pm, Hong lordh...@gmail.com wrote:
 You can use ActivityManager to query list of running tasks
 (getRunningTasks(int))

Hi Hong.  Yes, I found I could do this, but it was not usefully
specific.  Even when I looked at the priority to select only those
with the priority that means they are interactive, I found that for
example the in call screen keeps this while on a call, even when it's
not the displayed window.  And I also found that the input method
(latin, etc) would show up as  interactive priority, but couldn't
determine who it was working for in order to find out what window was
showing.

It may be possible to look at the total list of what has interactive
priority and figure out what is showing most of the time by comparing
its habits to the rest of the items on the list, but it's going to be
complicated and to some degree guesswork that may fail when new
applications that behave in new ways are added to the system.




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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 sort items in the ListView?

2009-08-28 Thread gnugu

Hi Roman,

Here is what I do in more detail:
- Query encrypted data from SQL, this gives me a Cursor
- Create SimpleCursorAdapter with that cursor and give it to ListView
- I have my own ViewBinder that decrypts data as the ListView is
populated.

I'm not sure if I want to reap data from the cursor, pass it over to
the collection, sort it and give it to the ListView for performance
reasons. So I was kind of hoping that it would be possible to sort the
list view items when they are already in the list.

On Aug 27, 4:28 pm, Roman ( T-Mobile USA) roman.baumgaert...@t-
mobile.com wrote:
 I am assuming that you are able to successfully  query your data. Tosortyour 
 result is independent from using theListView. After sorting
 your query result with for example Collections.sort() you can create a
 ListAdapter instance and calllistView.setAdapter(your adapter).

 --
 Roman Baumgaertner
 Sr. SW Engineer-OSDC
 ·T· · ·Mobile· stick together
 The views, opinions and statements in this email are those of the
 author solely in their individual capacity, and do not necessarily
 represent those of T-Mobile USA, Inc.

 On Aug 27, 3:31 pm, gnugu rho...@gmail.com wrote:

  Hi,
  I cannot get the data from SqLite using ORDER BY because the data is
  encrypted, so thesortwouldn't work there.

  Is it possible tosorttheitemsin theListView?

  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: Android REST XML implementation

2009-08-28 Thread smnirven

You are correct - All you would change is the content headers, and
replace the xml content with json content.



On Aug 26, 2:40 pm, nEx.Software email.nex.softw...@gmail.com
wrote:
 The process is incredibly similar with JSON Web Services too.

 On Aug 26, 8:55 am, Mike Wolfson mwolf...@gmail.com wrote:

  Excellent, concise example.  This is something lots of people will
  use.  Thanks.

  On Aug 25, 8:31 pm, smnirven smnir...@gmail.com wrote:

   Hey folks,

   I're recently implemented REST XML communication using apache's http
   libraries in my android app.  During the process I found examples on
   the web to be quite lacking, so I put together a post on blog with
   some example code - check it out if you want

  http://www.smnirven.com/?p=15
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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: some way to check available activities

2009-08-28 Thread Roman ( T-Mobile USA)

You might want to look in the PackageManager class with which you can
retrieve installed packages/applications information.


Look at 
http://developer.android.com/reference/android/content/pm/PackageInfo.html#activities
(flag GET_ACTIVITIES).

--
Roman Baumgaertner
Sr. SW Engineer-OSDC
·T· · ·Mobile· stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.




On Aug 27, 7:10 pm, tansaku tans...@gmail.com wrote:
 Is there some way to check the set of available activities?  I want to
 check for the presence of android.speech.action.RECOGNIZE_SPEECH in
 order to disable buttons that will take the user to that function on
 phones that don't have the voice recognition support.

 At the moment all I can tell is that I get the following exception:

 android.content.ActivityNotFoundException: No Activity found to handle
 Intent { action=android.speech.action.RECOGNIZE_SPEECH (has extras) }

 Other posts on this list seem to suggest this exception can't be
 caught.  Perhaps there is a base level Java way to determine if the
 library is available.

 Any help greatly appreciated.

 CHEERS SAM
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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: programatically detect foreground application/ screen?

2009-08-28 Thread Hong
In each RunningTaskInfo, you can find its respective top activity by:
ComponentName top = task.topActivity;

But you are right, in Android system, there are multiple tasks/processes
running at any given time.
And telephony related tasks/services/processes will be given the highest
priority.

If you can find the launch date/time info. of a particular task/activity,
that might help.
But I guess you can only find that by adb shell sysdump activity.

You might be able to build a native .so lib to call this and dump into a txt
file and JNI hook back to your Java codes to analyze the contents later, but
seems it's pretty hairy :)

On Fri, Aug 28, 2009 at 2:43 PM, Chris Stratton cs07...@gmail.com wrote:


 On Aug 28, 1:45 pm, Hong lordh...@gmail.com wrote:
  You can use ActivityManager to query list of running tasks
  (getRunningTasks(int))

 Hi Hong.  Yes, I found I could do this, but it was not usefully
 specific.  Even when I looked at the priority to select only those
 with the priority that means they are interactive, I found that for
 example the in call screen keeps this while on a call, even when it's
 not the displayed window.  And I also found that the input method
 (latin, etc) would show up as  interactive priority, but couldn't
 determine who it was working for in order to find out what window was
 showing.

 It may be possible to look at the total list of what has interactive
 priority and figure out what is showing most of the time by comparing
 its habits to the rest of the items on the list, but it's going to be
 complicated and to some degree guesswork that may fail when new
 applications that behave in new ways are added to the system.




 


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

2009-08-28 Thread Balwinder Kaur (T-Mobile USA)

Use just \n.

Balwinder Kaur
Open Source Development Center
·T· · ·Mobile· stick together

The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.


On Aug 28, 10:29 am, Rud rudmerr...@gmail.com wrote:
 I am trying to insert line breaks into a string resource so they
 appear in a TextView. I put in \\n but all I get is \n appearing.
 Is there a setting I'm missing?

 Rud
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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: onTap start Dialog

2009-08-28 Thread Balwinder Kaur (T-Mobile USA)

Pass in the Context object from the MapActivity to your class and use
that to create a Dialog.

Balwinder Kaur
Open Source Development Center
·T· · ·Mobile· stick together

The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.



On Aug 28, 9:59 am, Wouter wouterg...@gmail.com wrote:
 Hey,

 I have a mapactivity with multiple ItemizedOverlays and a onTap method
 when the user clicks on the marker. I can show a toast message but i
 want to display a Dialog when the user clicks on the marker (so in
 onTap method). How can i do that?

 Greetz,

 Wouter
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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 pass an Object from one activity to another.

2009-08-28 Thread sdphil

answering my own question - ack!  RTFM --
http://developer.android.com/guide/appendix/faq/framework.html#3

On Aug 28, 9:24 am, sdphil phil.pellouch...@gmail.com wrote:
 I have an activity which implements an OnItemClickListener.

 in onItemClick() i start another activity --

                 Intent intent = new Intent();
                 intent.setClass(MyActivity1.this, MyActivity2.class);
                 startActivity(intent);

 However, I need to pass some objects from MyActivity1 to MyActivity2
 --

 I see there is an Intent.putExtra() for all the basic types, and I
 even see a Bundle which is a collection of basic types, but how can I
 pass a generic Object to MyActivity2 ?

 tia.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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 sort items in the ListView?

2009-08-28 Thread Mark Murphy

 Here is what I do in more detail:
 - Query encrypted data from SQL, this gives me a Cursor
 - Create SimpleCursorAdapter with that cursor and give it to ListView
 - I have my own ViewBinder that decrypts data as the ListView is
 populated.

 I'm not sure if I want to reap data from the cursor, pass it over to
 the collection, sort it and give it to the ListView for performance
 reasons. So I was kind of hoping that it would be possible to sort the
 list view items when they are already in the list.

Once they are already in the list, sorting them will be massively
slower. Orders of magnitude slower. A glacier might move faster.

For a list of N rows:

-- You would be forcing Android to inflate N rows, rather than only the
rows presently visible, costing CPU time to create them and lotsa RAM to
hold them

-- You will need to get the strings back out of their TextViews (or
whatever you are putting them in) for sorting purposes

-- For N bigger than a couple dozen, you may blow out your available stack
space due to processing all of the row Views as actual Views, crashing
your application and making the whole issue of sorting rather moot

-- You would have to do the sort on the UI thread, which means you will
likely get an ANR dialog and have your activity force-closed, if N is
anything large, due to the time all of this takes

Better options for how to do that sort include:

1. Skip the encryption outright, and use an ORDER BY clause in the
database query

2. Choose an encryption algorithm that will maintain proper collation (not
sure if this is practical), and use an ORDER BY clause in the database
query

3. Store, in an unencrypted column, a column that contains a sequence
number for sorting purposes (think line renumbering schemes from 1980's
TRS-80 Basic), and use an ORDER BY clause on that column in the database
query

4. Pour the Cursor contents into an ArrayList and sort that, as Roman
suggested

#4 is probably the simplest, though perhaps not the quickest. All of those
can be done in a background thread, such as an AsyncTask, to keep the UI
from freezing.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
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] Detecting sensor manager left and right shakes

2009-08-28 Thread karthikr


Hi Guys,

My application requires to identify if the user has done a shake
towards the left or if he has done a shake towards the right.

How do i go about implementing this?

I have tried the sensor manager listener where in i am able to
identify a general shake event, but im not able to identify if its a
left or a right shake..

Regards,
R.Karthik
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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 pass an Object from one activity to another.

2009-08-28 Thread sdphil

I have an activity which implements an OnItemClickListener.

in onItemClick() i start another activity --

Intent intent = new Intent();
intent.setClass(MyActivity1.this, MyActivity2.class);
startActivity(intent);

However, I need to pass some objects from MyActivity1 to MyActivity2
--

I see there is an Intent.putExtra() for all the basic types, and I
even see a Bundle which is a collection of basic types, but how can I
pass a generic Object to MyActivity2 ?

tia.

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

2009-08-28 Thread tinyang

Hi Pavel, and thanks for the reply.  I'm happy to share the snippet of
code I have for picture taking, but I have not tried it out yet
because in order to see and use the picture-taking button in my
activity view, I need to get the camera preview in the correct place
first.

I still really need someone to help me on this please!! :)

Here is the code I was looking at trying, but I've done extensive
research on the subject trying to fix my placement of the camera
preview, so here are also some links that may help you with taking the
picture and storing it properly: (HTH!)

http://www.devx.com/SpecialReports/Article/37721/1763?supportItem=5

http://www.devx.com/SpecialReports/Article/37721/1763?

http://www.anddev.org/viewtopic.php?p=704#704

http://www.androidph.com/2008/11/camera-capture.html

http://www.devx.com/SpecialReports/Article/37721/1954

http://www.cs.trincoll.edu/hfoss/wiki/Using_the_Android_camera

Code:
public class ImageCaptureCallback implements PictureCallback  {

private OutputStream filoutputStream;
public ImageCaptureCallback(OutputStream filoutputStream) {
this.filoutputStream = filoutputStream;
}
@Override
public void onPictureTaken(byte[] data, Camera camera) {
try {
Log.v(getClass().getSimpleName(), onPictureTaken= + 
data + 
length =  + data.length);
filoutputStream.write(data);
filoutputStream.flush();
filoutputStream.close();
} catch(Exception ex) {
ex.printStackTrace();
}
}
}
}


On Aug 28, 1:02 am, Pavel pavli...@gmail.com wrote:
 Hey tinyang,

 Could you please share the code you use for picture taking? I am
 working on the same thing and having weird issues with it - it does
 not take full sized pictures for unknown reason...

 And yeah, sorry, no answer to your question from my side at the moment.

 Pavlo

 On Thu, Aug 27, 2009 at 9:14 PM, tinyanggnay...@gmail.com wrote:

  Hello.

  I just got my camera preview working for my app, but it is not
  appearing
  where I want it to appear, and I'm not sure how to get it there.
  Instead of
  using the entire screen for the preview, I would like to put it inside
  a
  surfaceview in an activity xml gui.  What do I need to change?  Here
  is my
  code:

  public class TakePic extends Activity {

  SurfaceView camSurface;

  Preview camPreview;

  @Override

  protected void onCreate(Bundle savedInstanceState) {

  super.onCreate(savedInstanceState);

  requestWindowFeature(Window.FEATURE_NO_TITLE);//hide window title

  camPreview = new Preview(this); //create preview

  setContentView(R.layout.takepic);

  setContentView(camPreview); //set preview as activity content

  camSurface = (SurfaceView) findViewById(R.id.camsurface);

  }
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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: Can not access my own service

2009-08-28 Thread Balwinder Kaur (T-Mobile USA)

It seems like if you declare a uses-permission in your
AndroidManifest.xml file and you call checkCallingOrSelfPermission
method, it returns PERMISSION_GRANTED. I would be curious though to
know if there is a more elegant way of doing this, or if this is the
expected way.

Balwinder Kaur
Open Source Development Center
·T· · ·Mobile· stick together

The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.


On Aug 28, 8:35 am, Roman ( T-Mobile USA) roman.baumgaert...@t-
mobile.com wrote:
 Only for testing purpose, instead of using your own created
 permission, use an already defined system permission and check whether
 your code works fine. If yes, you know that there are some problems
 with how you define and expose your own permission.

 --
 Roman Baumgaertner
 Sr. SW Engineer-OSDC
 ·T· · ·Mobile· stick together
 The views, opinions and statements in this email are those of the
 author solely in their individual capacity, and do not necessarily
 represent those of T-Mobile USA, Inc.

 On Aug 28, 3:29 am, Lutz Schönemann

 lutz.schoenem...@sit.fraunhofer.de wrote:
  Hi, my current problem is to access my own service. The thing is I  
  have 2 interfaces for my service and want to restrict one of them to  
  applications that have a special permission.

  I have a service and an activity in one package. The application has  
  that special permission but I always get a security exception:

  I've tried the to following things:

  1) put the check inside the onBind() method:

          @Override
          public IBinder onBind(Intent intent) {
                  if(intent.getAction() != null 
                                  
  intent.getAction().equals(ACTION_SERVICE_MANAGEMENT)) {
                          // check permission
                          if(checkCallingPermission(PERMISSION_MANAGEMENT) == 
   
  PackageManager.PERMISSION_DENIED) {
                                  Log.d(TAG, Checked for permission:  + 
  PERMISSION_MANAGEMENT +  
  \nresult:  + checkCallingPermission(PERMISSION_MANAGEMENT));
                                  throw new SecurityException();
                          }

                          // return management binder
                          return mManagementBinder;
                  }

                  if(_DEBUG) Log.d(TAG, onBind finished);
                  // call was not local so return public binder
                  return mBinder;
          }

  2) ptu the check inside a method of the binder it self:

          private IServiceManagement.Stub mManagementBinder = new  
  IServiceManagement.Stub() {

                  public String[] getRoles() throws RemoteException {
                          return PDPService.this.getRoles();
                  }

                  public void updatePolicy(String policyuri) {
                          // check permission
                          if(checkCallingPermission(PERMISSION_MANAGEMENT) == 
   
  PackageManager.PERMISSION_DENIED) {
                                  Log.d(TAG, Checked for permission:  + 
  PERMISSION_MANAGEMENT +  
  \nresult:  + checkCallingPermission(PERMISSION_MANAGEMENT));
                                  throw new SecurityException();
                          }
                          Uri uri = Uri.parse(policyuri);
                          Service.this.updateFile(uri, Service.POLICY_FILE);
                  }
          }

  both cases end with a security exception (the one I throw). The result  
  of checkCallingPermission is always -1  
  (PackageManager.PERMISSION_DENIED). I have doublechecked that the name  
  of the permission in code is the same as the one specified in the  
  manifest file.

  What am I doing wrong?

  Thanks for 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] problem animating view objects

2009-08-28 Thread Andy Droid

Having trouble animating some view objects.

My main activity creates a DrawView class, which extends View.  The
DrawView class creates three ColorBalls, each of which which extend
View.  The onDraw function in DrawView calls drawBitmap on each of the
ColorBalls.  This seems to be required, if I don't do this, they don't
show up.  (I re-purposed some code I found).

The ColorBalls keep track of their own x,y position, so that DrawView
knows where to draw them.  DrawView can of course, reposition them, by
simply resetting their x, y pos.  Then, of course, they jump to the
next place.  So far, so good.

But now I want to animate the balls using TranslateAnimation.  But
when I try, nothing happens.  I think that the onDraw in DrawView is
fighting with the Translate Animation, keeping it from doing
anything.  I think, anyway.  But if I don't call the draw bitmap in
onDraw, nothing gets drawn ever.

So how can I make the ColorBalls draw every frame, but also animate?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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] Location object bad results

2009-08-28 Thread Alexander Davis

Does anyone else get lat/lons off by a multiplier of 10^-1 when they
use the getLatitude() and getLongitude() methods of the Location
object?
I do.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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 launch VideoCamera Activity and then read tge file created?

2009-08-28 Thread Jason Proctor

ok so i tried this approach too, and got it to work.

call getData() off the incoming intent and that's the URI to the recorded file.

hth



Hi,

I am launching the VideoCamera activity from my main activity but not
able to get a callback to read the file created. Does anyone have an
example on how to do this?

This is what I have:

public class Video extends Activity {

   private static final int VIDEO = 1;

   @Override
   public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);

   // Fill view from resource
   setContentView(R.layout.main);
   VideoView video = (VideoView) findViewById(R.id.video);

   // Start camera or video recorder
   Intent intent = new Intent();
   intent.setClassName(com.android.camera,
com.android.camera.VideoCamera);
   intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
   startActivityForResult(intent, VIDEO );
   }

   @Override
   public void onActivityResult (int requestCode, int resultCode, Intent
data) {
   super.onActivityResult(requestCode, resultCode, data);
   if (resultCode == Activity.RESULT_OK) {
   Uri uri = 
data.getParcelableExtra(android.intent.extra.STREAM);
   Log.i(ReturnedFromVideo, uri.toString());
   }
   }
}

In the manifest I had:

manifest xmlns:android=http://schemas.android.com/apk/res/android;
 package=org.example.video
 android:versionCode=1
 android:versionName=1.0
   application android:icon=@drawable/icon
android:label=@string/app_name
 activity android:name=.Video
 android:label=@string/app_name
 android:theme=@android:style/Theme.NoTitleBar.Fullscreen
   intent-filter
  action android:name=android.intent.action.MAIN /
  category android:name=android.intent.category.LAUNCHER /
   /intent-filter
  intent-filter
action android:name=android.intent.action.SEND /
category android:name=android.intent.category.DEFAULT /
data android:mimeType=video/* /
  /intent-filter
 /activity
   /application
 uses-sdk android:minSdkVersion=3 /
/manifest


-- 
jason.vp.engineering.particle

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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: programatically detect foreground application/ screen?

2009-08-28 Thread Chris Stratton

On Aug 28, 3:02 pm, Hong lordh...@gmail.com wrote:

 But you are right, in Android system, there are multiple tasks/processes
 running at any given time.
 And telephony related tasks/services/processes will be given the highest
 priority.

And this that is my problem... I've been trying to find out when the
in-call screen is actually showing, vs being in a call but the user
has brought some other activity to the foreground.  I have a phone
state listener that when it finds out a call is active every few
seconds polls the task list, but it can't tell what's actually on top
given the non-specificity of the priority codes.

If you can find the launch date/time info. of a particular task/activity,
that might help.
But I guess you can only find that by adb shell sysdump activity.

This doesn't seem to be available on the retail phone?   Even if it
were, would it show the original  start time, or the time when the
task last gained the foreground?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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: Detecting sensor manager left and right shakes

2009-08-28 Thread Mike Collins

There was a discussion recently about getting the phone orientation
converted to earth-relative orientation, that might help.

Maybe just monitor phone relative acceleration for -x followed by +x
for a left
and +x followed by -x for a right shake?


On Aug 28, 12:41 pm, karthikr karthik.scintill...@gmail.com wrote:
 Hi Guys,

 My application requires to identify if the user has done a shake
 towards the left or if he has done a shake towards the right.

 How do i go about implementing this?

 I have tried the sensor manager listener where in i am able to
 identify a general shake event, but im not able to identify if its a
 left or a right shake..

 Regards,
 R.Karthik
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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 i get the Selected item from the list Adapter.

2009-08-28 Thread Yusuf Saib (T-Mobile USA)

You can't figure out which item is selected from the adapter. It is
the ListView or ListActivity (depending on which you used) that will
tell you which is selected.



Yusuf Saib
Android
·T· · ·Mobile· stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.



On Aug 28, 7:23 am, Martin Obreshkov manig...@gmail.com wrote:
 Thanks a lot it's really very simple and clear using ContextMenu





 On Fri, Aug 28, 2009 at 3:45 PM, Sasi Kumarsasikumar.it1...@gmail.com wrote:

  join the below group to discuss more

 http://groups.google.com/group/mobile-application-developers

  use like this

                 lv=(ListView)findViewById(R.id.ListView01);
                 lv.setChoiceMode(lv.CHOICE_MODE_SINGLE);
         lv.setAdapter(new ArrayAdapterString(this,
                 android.R.layout.simple_list_item_1 , airport_list));
         lv.setTextFilterEnabled(true);
         lv.setOnItemClickListener(new OnItemClickListener() {
             public void onItemClick(AdapterView parent, View v, int
  position, long id) {
                 System.out.println(selected item position is =
  +position );
                 System.out.println(selected item is
  =+lv.getItemAtPosition(position));
                 if(list_selected == arrival)
                         arrival_list_selected=(String) lv.getItemAtPosition
  (position);
                 else if(list_selected == depature)
                         depature_list_selected=(String) lv.getItemAtPosition
  (position);
                 if(airport_selectedby.equals(flightschedule))
                         flight_schedule();
                 else if(airport_selectedby.equals(flightstatus))
                 flight_status();
             }
         });

  here lv is a listview.

  On Aug 28, 5:35 pm, ragavendran s sraghav.ra...@gmail.com wrote:
  i m a beginner for Android development

    How i get the Selected item from the list Adapter.

    for example i m having the code:

    Code:

   final Spinner spinner = (Spinner) findViewById(R.id.testSpinner);
      ArrayAdapterString adapter = new ArrayAdapterString(this,
      android.R.layout.simple_spinner_item, Months);

  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_it
   em);
      spinner.setAdapter(adapter);

         /---some code/

    static final String[] Months = new String[]{
      January,February,March,April,May,June,July,August,
      September,October,November,December
      };

    public void changeOption(Spinner spinner){
      if (spinner.isEnabled()){
      spinner.setEnabled(false);

      }
      else{
      spinner.setEnabled(true);
      }
      }

  Question:

  In this above code if i selected March from the Dropdown Adapter means then
  how can i retrieve the Manth March to show in a textview.

  Please tell me the ANswer...

  with Regard,
  Raghav.S

 --
 When I raise my flashing sword, and my hand takes hold on judgment, I
 will take vengeance upon mine enemies, and I will repay those who haze
 me. Oh, Lord, raise me to Thy right hand and count me among Thy
 saints.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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: Additional fonts for use with Webkit

2009-08-28 Thread Yoav

In case someone is interested, here is what I figured out:

Adding fonts to the SDK allows them to be viewed in the browser.
Also, applications can use them directly without having to load the
font from an asset.


1) Add the font file

android_1.5r2/frameworks/base/data/fonts/Comic.ttf

2) Add the font file to the build

android_1.5r2/frameworks/base/data/fonts/Android.mk

copy_from := \
...
DroidSansMono.ttf \
Comic.ttf

3) Let the font engine know the font exists.  Each font file needs its
own family.

android_1.5r2/external/skia/src/ports/SkFontHost_android.cpp

static const char* gMonoNames[] = {
monospace, courier, courier new, monaco, NULL
};

static const char *gComicNames[] = {
comic sans ms, NULL
};

note: comic san ms for when the font is referenced by it's real
name, e.g. browsing the web

{ DroidSansMono.ttf, gMonoNames },
{ Comic.ttf, gComicNames },

At this point the font is available to the browser, as it will try to
reference it by it's name.
Additional steps are needed to make the font availble to your new
android applications

4) Add an entry in the Typeface class, this creates Typeface.COMIC

android_1.52/frameworks/base/graphics/java/android/graphics/
Typeface.java

public static final Typeface MONOSPACE;
public static final Typeface COMIC;

MONOSPACE = create(monospace, 0);
COMIC=create(comic sans ms, 0);

At this point, you can set the font with java code:

TextView tv = (TextView) findViewById(R.id.text);
tv.setTypeface(Typeface.COMIC);

5) Add an entry for the xml parser

android_1.5r2/frameworks/base/core/res/res/values/attrs.xml

attr name=typeface
..
  enum name=monospace value=3 /
  enum name=comic value=4 /
/attr

6) Link the xml value to the Typeface class

android_1.5r2/frameworks/base/core/java/android/widget/TextView.java

private static final int MONOSPACE = 3;
private static final int COMIC = 4;

private void setTypeFaceByIndex(int typefaceIndex, int styleIndex)
...
case MONOSPACE:
tf = Typeface.MONOSPACE;
break;

case COMIC:
tf = Typeface.COMIC;
break;
}

At this point, you can set the font using xml attributes:

TextView
android:typeface=comic
android:text=Hi Mom!
/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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] Custom list adapter using SQL and line-specific icons

2009-08-28 Thread Christian S.

I have been twisting my head around this issue for quite some time
now. Couldnt find anything close on the web. That's why I am coming
back to you now.

This is what I already have:

- Simple list adapter bound to an SQL database (TextView only) -
WORKS!
- And in a separate app: An imageloader that load images nicely from
my website into an ImageView - WORKS AS WELL!

This is what I like to have as an expansion / enhancement from the
above - all nicely integrated into one app:

- a custom list adapter that shows an icon + corresponding text (e.g.
apple icon and text Apple)
- The web URL to the corresponding icon would be pulled from the SQL
database through the Cursor
- Based on the web URL the custom list adapter would load the correct
image (the image apple) using the xml layout (ImageView + TextView)
- And it would pull the corresponding TextView (the word Apple)
elements from the SQL database

If anyone of you has sample code or a tutorial that shows how to make
this all work ... I would be really grateful. (almost needless to say
that I am an Android novice ... but fanatic about it :-)).

Best regards christian
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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: playing sound on active call

2009-08-28 Thread Chris Stratton

On Aug 28, 4:21 am, Honest honestsucc...@gmail.com wrote:
 I am playing one audio file when call arrives so the  caller can
 receive it at other side but the issue is  yet the opposite caller is
 not able to listen it what could be wrong in it. Can some one tell me
 what can be the issue in it ?

I don't think the platform is designed to give applications access to
the in-call audio.

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

2009-08-28 Thread Balwinder Kaur (T-Mobile USA)

A sample of your code and logcat output if there are errors in it
would be helpful.

Balwinder Kaur
Open Source Development Center
·T· · ·Mobile· stick together

The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.

On Aug 28, 11:39 am, human android vanquisher.sin...@gmail.com
wrote:
 I am trying to use touch listener on 2 View objects.
 I made both objects focussable but it works for one object and does
 not for the other.
 Any idea how to solve 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: Force screen orientation and avoid destroy call

2009-08-28 Thread Derek

It seems that constants returned and expected are not the same between
ActivityInfo and Configuration.
Translating Configuration constants to ActivityInfo seems to solve the
problem:

 int orientation = getResources().getConfiguration().orientation;
 if (orientation == Configuration.ORIENTATION_PORTRAIT)
initialOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
 else if (orientation == Configuration.ORIENTATION_LANDSCAPE)
initialOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;

Mark, do you think it's OK ?

Cheers.


On Aug 28, 7:06 pm, Derek cram.de...@gmail.com wrote:
 Another question:
 android:screenOrientation=portrait locks the screen orientation,
 that's fine.
 But it is possible to do the same in Activity source code ? (i.e.
 removing the screenOrientation in AndroidManifest.xml).

 I've tried the following code to keep the initial orientation but it
 fails.

     private int initialOrientation =
 Configuration.ORIENTATION_UNDEFINED;

     public void onCreate(Bundle savedInstanceState) {
         initialOrientation = getResources().getConfiguration
 ().orientation;
         ...
     }

     public void onConfigurationChanged(Configuration newConfig)
     {
         super.onConfigurationChanged(newConfig);
         setRequestedOrientation(initialOrientation);
     }

 I've also tried with:
 initialOrientation = getResources().getConfiguration().orientation;
 initialOrientation = getRequestedOrientation();
 initialOrientation = getWindow().getWindowManager().getDefaultDisplay
 ().getOrientation();

 Thanks for the help.

 On Aug 27, 9:54 pm, Mark Murphy mmur...@commonsware.com wrote:

   I want my Activity to be always in portrait mode and I do NOT want the
   onDestroy() method to be called.
   There are some interesting articles about that at:
  http://www.androidguys.com/2008/11/24/rotational-forces-part-four/

   The solution seems to be:
   In AndroidManifest.xml:
           activity android:name=.MyActivity
                        android:screenOrientation=portrait
                        android:configChanges=keyboardHidden|orientation

   In Activity code:
       public void onConfigurationChanged(Configuration newConfig)
       {
              super.onConfigurationChanged(newConfig);
       }

   I've tried it and it seems to work. Is there any other alternative or
   is it the correct solution?

  Well, I think it's the correct solution. But, then again, I'm biased in
  favor of the author of that fine, upstanding blog post.

  ;-)

  --
  Mark Murphy (a Commons Guy)http://commonsware.com
  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: JOIN Contacts.People and Contacts.People.Phones

2009-08-28 Thread eags

Actually I guess the table to use is Contacts.Phones but the question
still stands.

On Aug 28, 1:38 pm, eags eagsala...@gmail.com wrote:
 I have an app where I want to list all phone numbers and the
 associated contact name.  I see that there is the Contacts.People
 table for the purpose of getting all phone numbers and that there is a
 PERSON_ID to allow me to lookup the contact in Contacts.People.
 Great.

 The only problem is I can't figure out how to JOIN these tables.  What
 I roughly want to do is this (in SQL):

 SELECT People.Phones._ID, People.NAME, People.Phones.NUMBER
 FROM Contacts.People.Phones INNER JOIN Contacts.People
 ON Contacts.People._ID=Contacts.People.Phones.PERSON_ID

 **Now I see that all the columns I want are already joined to the
 Contacts.People.Phones table.  But that seems lucky in this case.  How
 could I do the equivalent of the above statement in general if the
 implementer of the content provider hadn't been so nice as to join for
 me?

 Thanks in advance for any 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] Full Screen in sub-Preference Screen

2009-08-28 Thread Rud

I am using a PreferenceScreen with some subPreference Screens. In the
Activity I programmatically set FULL_SCREEN. This works for the main
PreferenceScreen but not for the sub-PreferenceScreens.

Is there any way to set the FULL_SCREEN for the sub-
PreferenceScreens?

Rud

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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] Graceful handling of SD card removal while application writing to file...

2009-08-28 Thread AndyK

Hi,

I tried to search for a solution to a general problem I am having and
came up empty.  I'm posting the following question in hopes someone
else has come across this and might know the answer and can share it.

I have an application that contains an activity and a service.  The
activity through the GUI connects to the the service and starts a
background process to write data out to the SD card.  The scenario I'm
trying to handle is if the end-user pulls the SD card out during the
background process writes being performed.  I have a broadcast
receiver in my service which is registered and does receive the event
indicating the media has been unmounted.  When my receiver receives
this event, it attempts to interrupt the background writing in order
to stop and clean up.  I'm currently using buffered I/O (not sure if
this is the reason for my problem) and so when the service detects it
needs to stop writing and clean up, it attempts to do so after closing
the open file streams.  The calls to 'close' on my buffered output
streams are failing due to the SD card being removed.  After all the
attempts have failed, the Android runtime is killing any processes
that have open file streams to the SD card and so my process (Activity
+ Service) is going away.  I could place the Activity and Service in
to separate processes such that my activity should survive but service
still punted (restarted on an as-needed basis), but I would rather see
if there's a more graceful way to handle unflushed I/O such that the
process containing my activity and service does not get reaped.

Any thoughts, ideas would be greatly appreciated.

Andy
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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 shell command in Android app

2009-08-28 Thread Roman ( T-Mobile USA)

Try to use the Java class File for operations on the file system.

Some of the system commands are not executable using exec if you are
not root.

--
Roman Baumgaertner
Sr. SW Engineer-OSDC
·T· · ·Mobile· stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.

On Aug 28, 10:42 am, Dianne Hackborn hack...@android.com wrote:
 Keep in mind that shell commands are not part of the SDK.  These commands
 will and do change between releases, with no predictability (for example
 different output, etc).  And for all of the commands that are simple enough
 that they are less likely to change (such as mkdir), it is much more
 efficient to use the appropriate Java APIs to do the same thing.



 On Fri, Aug 28, 2009 at 2:54 AM, tstanly tsai.sta...@gmail.com wrote:

  hi all,

  I want to use command like ls,mkdir,cd,./..etc, in the app,
  somebody says use Runtime class,

  Runtime.getRuntime().exec(ls);

  but there is nothing happen..
  I also use logcat to observe, but have the same result.

  so could app use (linux) command?

  thanks!

 --
 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] Update view on worker thread

2009-08-28 Thread Tom

Hey Guys,

I am seeing some weird issues and looking to see if anyone knows what
is going on. I have a BroadcastReceiver which updates some views on
receiving an event. Some psudo code is shown below. What happens is
the function runs fine and the app seems to update the textviews BUT
when i then try to clear the textviews parent and add new textviews
the linearlayout(parent) blanks out and will now draw any of it's
children. Has anyone seen this before?

public class PMDynIntentReceiver extends BroadcastReceiver {

public void onReceive(final Context context, Intent intent) {

Thread th = new Thread() {

run() {
// Pull a view out of an array.
// Push the view into a update data as show below
//thats it
}
};

th.start();

}

}


public static void updateData(Hashtable data, View x)
{
textView text = (TextView)x.findViewById(R.id.sbTeamAStat1);
text.setText(data.get(something));
}

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: Update view on worker thread

2009-08-28 Thread Tom

Hmm ok it seems this is a updating from background issue it just
seems that the android OS doesn't catch it as such because I am
interacting with the object array rather than the screen object.

Tom

On Aug 28, 5:40 pm, Tom thomas.shepp...@polarmobile.com wrote:
 Hey Guys,

 I am seeing some weird issues and looking to see if anyone knows what
 is going on. I have a BroadcastReceiver which updates some views on
 receiving an event. Some psudo code is shown below. What happens is
 the function runs fine and the app seems to update the textviews BUT
 when i then try to clear the textviews parent and add new textviews
 the linearlayout(parent) blanks out and will now draw any of it's
 children. Has anyone seen this before?

 public class PMDynIntentReceiver extends BroadcastReceiver {

 public void onReceive(final Context context, Intent intent) {

 Thread th = new Thread() {

 run() {
 // Pull a view out of an array.
 // Push the view into a update data as show below
 //thats it

 }
 };

 th.start();

 }
 }

 public static void updateData(Hashtable data, View x)
 {
 textView text = (TextView)x.findViewById(R.id.sbTeamAStat1);
 text.setText(data.get(something));

 }

 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: Force screen orientation and avoid destroy call

2009-08-28 Thread Dianne Hackborn
Indeed they are not.  The documentation should explain which constants are
appropriate.  The configuration contains an actual orientation, the activity
has a particular orientation *mode* to apply to the activity.

On Fri, Aug 28, 2009 at 10:40 AM, Derek cram.de...@gmail.com wrote:


 It seems that constants returned and expected are not the same between
 ActivityInfo and Configuration.
 Translating Configuration constants to ActivityInfo seems to solve the
 problem:

  int orientation = getResources().getConfiguration().orientation;
  if (orientation == Configuration.ORIENTATION_PORTRAIT)
 initialOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
  else if (orientation == Configuration.ORIENTATION_LANDSCAPE)
 initialOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;

 Mark, do you think it's OK ?

 Cheers.


 On Aug 28, 7:06 pm, Derek cram.de...@gmail.com wrote:
  Another question:
  android:screenOrientation=portrait locks the screen orientation,
  that's fine.
  But it is possible to do the same in Activity source code ? (i.e.
  removing the screenOrientation in AndroidManifest.xml).
 
  I've tried the following code to keep the initial orientation but it
  fails.
 
  private int initialOrientation =
  Configuration.ORIENTATION_UNDEFINED;
 
  public void onCreate(Bundle savedInstanceState) {
  initialOrientation = getResources().getConfiguration
  ().orientation;
  ...
  }
 
  public void onConfigurationChanged(Configuration newConfig)
  {
  super.onConfigurationChanged(newConfig);
  setRequestedOrientation(initialOrientation);
  }
 
  I've also tried with:
  initialOrientation = getResources().getConfiguration().orientation;
  initialOrientation = getRequestedOrientation();
  initialOrientation = getWindow().getWindowManager().getDefaultDisplay
  ().getOrientation();
 
  Thanks for the help.
 
  On Aug 27, 9:54 pm, Mark Murphy mmur...@commonsware.com wrote:
 
I want my Activity to be always in portrait mode and I do NOT want
 the
onDestroy() method to be called.
There are some interesting articles about that at:
   http://www.androidguys.com/2008/11/24/rotational-forces-part-four/
 
The solution seems to be:
In AndroidManifest.xml:
activity android:name=.MyActivity
 android:screenOrientation=portrait
   
  android:configChanges=keyboardHidden|orientation
 
In Activity code:
public void onConfigurationChanged(Configuration newConfig)
{
   super.onConfigurationChanged(newConfig);
}
 
I've tried it and it seems to work. Is there any other alternative or
is it the correct solution?
 
   Well, I think it's the correct solution. But, then again, I'm biased in
   favor of the author of that fine, upstanding blog post.
 
   ;-)
 
   --
   Mark Murphy (a Commons Guy)http://commonsware.com
   Android App Developer Books:http://commonsware.com/books.html
 
 
 



-- 
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: How can I sort items in the ListView?

2009-08-28 Thread Dianne Hackborn
Especially if you want your list to scale to 1000 or more rows, you really
want to avoid loading all of it up-front and instead rely on being able to
construct a query the returns the results appropriately.  Fwiw.

On Fri, Aug 28, 2009 at 12:05 PM, Mark Murphy mmur...@commonsware.comwrote:


  Here is what I do in more detail:
  - Query encrypted data from SQL, this gives me a Cursor
  - Create SimpleCursorAdapter with that cursor and give it to ListView
  - I have my own ViewBinder that decrypts data as the ListView is
  populated.
 
  I'm not sure if I want to reap data from the cursor, pass it over to
  the collection, sort it and give it to the ListView for performance
  reasons. So I was kind of hoping that it would be possible to sort the
  list view items when they are already in the list.

 Once they are already in the list, sorting them will be massively
 slower. Orders of magnitude slower. A glacier might move faster.

 For a list of N rows:

 -- You would be forcing Android to inflate N rows, rather than only the
 rows presently visible, costing CPU time to create them and lotsa RAM to
 hold them

 -- You will need to get the strings back out of their TextViews (or
 whatever you are putting them in) for sorting purposes

 -- For N bigger than a couple dozen, you may blow out your available stack
 space due to processing all of the row Views as actual Views, crashing
 your application and making the whole issue of sorting rather moot

 -- You would have to do the sort on the UI thread, which means you will
 likely get an ANR dialog and have your activity force-closed, if N is
 anything large, due to the time all of this takes

 Better options for how to do that sort include:

 1. Skip the encryption outright, and use an ORDER BY clause in the
 database query

 2. Choose an encryption algorithm that will maintain proper collation (not
 sure if this is practical), and use an ORDER BY clause in the database
 query

 3. Store, in an unencrypted column, a column that contains a sequence
 number for sorting purposes (think line renumbering schemes from 1980's
 TRS-80 Basic), and use an ORDER BY clause on that column in the database
 query

 4. Pour the Cursor contents into an ArrayList and sort that, as Roman
 suggested

 #4 is probably the simplest, though perhaps not the quickest. All of those
 can be done in a background thread, such as an AsyncTask, to keep the UI
 from freezing.

 --
 Mark Murphy (a Commons Guy)
 http://commonsware.com
 Android App Developer Books: http://commonsware.com/books.html



 



-- 
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] No com.android.camera.CropImage on HTC Magic?

2009-08-28 Thread Klaus Kartou
Hi,

I have a pretty urgent issue. I am using the CropImage intent on my G1 Dev
phone to crop images.
However when starting this intent on a HTC Magic I get an error indicating
the activity cannot be found:

Unable to find explicit activity class
{com.android.camera/com.android.camera.CropImage}

Why is this activity not present on HTC Magic?
Any input is much appreciated.

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: Automatic launch of Virtual Keypad in first screen(launcher) of application

2009-08-28 Thread Muha

Hi Durg,
I'm facing an opposite problem when the app is installed in a real
device (a HTC G2). I want to open my screen with keypad hidden, but as
the activity has an EditText which automatically receives focus, it
triggers the opening of the keypad. As you did, I tried to put a
similar code (see below) in onCreate() and onResume(), and tried also
to send the focus to another view, but I didn't have success. On
emulator, everything runs fine.

InputMethodManager imm = (InputMethodManager) getSystemService
(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(meuEditText.getWindowToken(), 0);

Maybe my problem can solve your problem.

Regards,
Muha

On Jul 23, 10:09 am, Durg durga.n.pra...@gmail.com wrote:
 Automatic launch of VirtualKeypadin first screen(launcher) of
 application

 Hi All,

 I have created an application with a EditText in first screen
 (launcher). I want to launch this screen always with VirtualKeypad
 Open. I know how to launch thekeypadon focus change or click. I have
 tried the following code..

 InputMethodManager inputManager = (InputMethodManager) getSystemService
 (Context.INPUT_METHOD_SERVICE);
 inputManager.showSoftInput(objEditText,
 InputMethodManager.SHOW_FORCED);

 in onCreate(), onPostCreate(), onStart(), onResume() and onPostResume
 ().

 But still virtualkeypadis not coming up. Please help me if there is
 any API or Callback to call this function.

 Thanks in advance.

 Regards,
 Durg.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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] emulator to run iphone apps on android

2009-08-28 Thread mohangupta13

hello all,
i am very new to android and smartphones on a whole , as part of my
computer science engineering graduation i was thinking about making a
project to make an emulator (like wine for linux) that would allow
iphone apps to run on android platform unmodified or with at most a
minimal change .
can you please guide me if there is any other such project going or
what technical considerations or challenges i must deal with .
i am really sorry for being lazy and asking here instead of
researching myself actually i have a deadline to submit the project
proposal.

all help is appreciated
regards
Mohan Gupta

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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] ActivityGroup , onKeyDown and ListView

2009-08-28 Thread varis

HI,

I got some strange problem with combination ActvityGroup, some
external Activty with ListView .
Have an activity class A1 extends ActivtyGroup and class A2 extends
Activity.
An activity A1 overrides  onKeyDown.
if A2 has ListView on layout then A1 will not receive events in
onKeyDown function and vice versa.
Is it a bug or I miss 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] Andriod Market in China: Ouch! China Mobile’s (Messy) Mobile Market(App Store Clone) Stum bling Out of Gate

2009-08-28 Thread Kai

Hi,

I just wrote a blog post to shine some light on the newly launched
Mobile Market(app store for OPhone(China Mobile's customized Android),
windows mobile, symbian) from China Mobile:
http://blog.agilestorm.com/2009/08/26/ouch-china-mobiles-messy-mobile-market-app-store-clone-stumbling-out-of-gate/

In theory, you can easily port your apps to OPhone.  But right now,
it's just too easy to get your apps pirated there, and there are not
enough OPhones out there. so be really careful of dealing anyone
promosing to help you sell your apps in China.

Kai

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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] Problem loading widget

2009-08-28 Thread sany

I am new to android development.I created an app on homescreen.Though
it is getting added onto the homescreen widget list,if i select my
widget a black box appears on the homescreen saying Problem loading
widget.Please 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] Avoid relaunching Emulator when App runs from eclipse

2009-08-28 Thread Mimi

I have to relaunch the Emulator every single time when I run App from
within Eclipse. I could not power-off the AVD because it was in
Shutting down... mode forever/stucked and I had to close my Emulator
Window (Vista) in order to be able to run it subsequent times.

And, launching the Emulator takes me at least 3 min before my App
runs. It is painful.
Please HELP.

Note: I am using the latest Android SDK 1.5 release 3.

Many Thanks...Mimi

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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] Non-freeware apps on Swedish android market

2009-08-28 Thread fcaesar

Hi,

I am a swedish developer developing a commercial app for android that
I would like to make available for purchase on android market
(globally). What is the timeframe for this? Also, what is the
timeframe for releasing commercial android apps on the swedish android
market?

Fredrik


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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: MediaStore.EXTRA_OUTPUT

2009-08-28 Thread Bill

Bump - I have this exact same problem.. I can't get the full size
image,

Intent i = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

i.putExtra
(MediaStore.EXTRA_OUTPUT,MediaStore.Images.Media.EXTERNAL_CONTENT_URI.toString
());

The intent that comes back with onActivityResult only has the data
key and not the key for extra output...in fact I have to _save_ the
bitmap manually for it to even show up on my SdCard.


On Aug 21, 2:09 am, Friso friso.kl...@gmail.com wrote:
 I tried this, but I don't get the full size image back from the
 camera, just a 512x384 pixels. I am using the Developer Phone.

 My code
 final Intent imageCaptureIntent = new Intent
 (MediaStore.ACTION_IMAGE_CAPTURE);
 imageCaptureIntent.putExtra(MediaStore.EXTRA_OUTPUT,
         Uri.fromFile(new File(Environment.getExternalStorageDirectory(),
 test.jpg)));
 startActivityForResult(imageCaptureIntent, 1);

 On Jul 15, 8:53 pm, Christine christine.kar...@gmail.com wrote:

  I have seen a number of posts from people who had trouble retrieving a
  full size image from  MediaStore.EXTRA_OUTPUT with code like

                Intent i = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
                pictureUri = Uri.fromFile(new File(/sdcard/
  picturefile.jpg));
                intent.putExtra(MediaStore.EXTRA_OUTPUT, pictureUri);
                startActivityForResult(i, PICTURE_TAKEN);

  Should this code work? I mean, should this result in a file containing
  the picture?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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] Software Keyboard Strange Behaviour

2009-08-28 Thread gatza

Hello!

I have a listview, in which each rows have one relativelayout, and
each relativelayouts have two edittexts.
If I use the app in landscape mode and use the hardware keyboard
everything goes just fine.
But when I use it in portrait mode, and try to use the software
keyboard it does strange things.

When I try to edit an empty edittext, I start typeing a word, the
letter appears on the top of the softkey,
the pushed letter appears in the edittext and it loses focus and a
random edittext gets the focus.

it does the same behaviour in the emulator and on the G1.

does anybody else  have similar things happen?
is this an OS bug? or the software keyboard has to handle things
differently?

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] OpenGL and pause/resume

2009-08-28 Thread Cor

I am learning about OpenGL and managed to write a prototype game using
VBO buffers. If I start the application from Eclipse or adb,
everything works fine until I press the back or Home button.
If I restart the application either by a long press on HOME and
selecting my program or by restarting it from the applications, I
sometimes get a black screen and the LogCat shows this error:

 D/AIRDEFENDER(  966): onResume()
D/SurfaceFlinger(   64): pid 966 requesting gpu surface (current owner
= -1)
D/SurfaceFlinger(   64): gpu surface granted to pid 966
D/SurfaceFlinger(   64): pid 127 requesting gpu core (owner = 966)
D/SurfaceFlinger(   64): pid 966 requesting gpu surface (current owner
= 127)
D/EGL (  127): CONTEXT_LOST: Releasing GPU upon request from
SurfaceFlinger.
D/EGL.oem (  127): SMI  region at virtual=0x46e1, physical=0x0,
size=7340032 offset=0
D/EGL.oem (  127): EBI1 region at virtual=0x4751,
physical=0x2580, size=8388608 offset=1228800
D/EGL.oem (  127): REGS region at virtual=0x46d1,
physical=0xa000, size=1048576, offset=0
E/GLLogger(  127): 0: eglInitialize() failed (EGL_CONTEXT_LOST)
W/InputManagerService(   64): Window already focused, ignoring focus
gain of: com.android.internal.view.IInputMethodClient$Stub
$pr...@437e7108
D/SurfaceFlinger(   64): gpu surface granted to pid 966
E/SurfaceComposerClient(  966): using an invalid surface id=1,
identity=65 should be 70
E/GLLogger(  966): validate_display_surface:488 error 300d
(EGL_BAD_SURFACE)

I am aware that it is probably a wrong setting in my program's flow,
but I am not fluently enough with OpenGL. So if anybody has any idea
and could point me to the correct direction to look for the problem, I
would appreciate 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: IllegalArgumentException occur: parameter must be a descendant of this view in ViewGroup.java:2454

2009-08-28 Thread Steven Yi

Hello,

I am working on an application and have run into this problem when
switching views with the virtual keyboard up. I looked and found this
email that this a bug that is fixed in Donut, but is there any
workaround for earlier releases since our app is targetting what
everyone is currently using?

Thanks!
steven

On Aug 4, 4:52 pm, Romain Guy romain...@google.com wrote:
 Known bug it's been fixed in Donut



 On Tue, Aug 4, 2009 at 1:48 PM, Moxormaxcambi...@gmail.com wrote:

  Hi,
  Did you manage to solve it? I have a similar problem.
  Every time I change the focus to a button, and then touch another
  button (I call setContentView()), the application crash with this
  Logcat:

  08-04 17:12:00.251: ERROR/AndroidRuntime(880): Uncaught handler:
  thread main exiting due to uncaught exception
  08-04 17:12:00.292: ERROR/AndroidRuntime(880):
  java.lang.IllegalArgumentException: parameter must be a descendant of
  this view
  08-04 17:12:00.292: ERROR/AndroidRuntime(880):     at
  android.view.ViewGroup.offsetRectBetweenParentAndChild(ViewGroup.java:
  2454)
  08-04 17:12:00.292: ERROR/AndroidRuntime(880):     at
  android.view.ViewGroup.offsetDescendantRectToMyCoords(ViewGroup.java:
  2391)
  08-04 17:12:00.292: ERROR/AndroidRuntime(880):     at
  android.view.ViewRoot.scrollToRectOrFocus(ViewRoot.java:1301)
  08-04 17:12:00.292: ERROR/AndroidRuntime(880):     at
  android.view.ViewRoot.draw(ViewRoot.java:1107)
  08-04 17:12:00.292: ERROR/AndroidRuntime(880):     at
  android.view.ViewRoot.performTraversals(ViewRoot.java:1030)
  08-04 17:12:00.292: ERROR/AndroidRuntime(880):     at
  android.view.ViewRoot.handleMessage(ViewRoot.java:1482)
  08-04 17:12:00.292: ERROR/AndroidRuntime(880):     at
  android.os.Handler.dispatchMessage(Handler.java:99)
  08-04 17:12:00.292: ERROR/AndroidRuntime(880):     at
  android.os.Looper.loop(Looper.java:123)
  08-04 17:12:00.292: ERROR/AndroidRuntime(880):     at
  android.app.ActivityThread.main(ActivityThread.java:3948)
  08-04 17:12:00.292: ERROR/AndroidRuntime(880):     at
  java.lang.reflect.Method.invokeNative(Native Method)
  08-04 17:12:00.292: ERROR/AndroidRuntime(880):     at
  java.lang.reflect.Method.invoke(Method.java:521)
  08-04 17:12:00.292: ERROR/AndroidRuntime(880):     at
  com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
  (ZygoteInit.java:782)
  08-04 17:12:00.292: ERROR/AndroidRuntime(880):     at
  com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
  08-04 17:12:00.292: ERROR/AndroidRuntime(880):     at
  dalvik.system.NativeStart.main(Native Method)

  This happens outside my code, once the onClick event is finished.

  Thanks in advance.
  Max

 --
 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] Internet radio option and source code

2009-08-28 Thread Shakeel

Dear all,

I am writing a internet radio application. I have two options
1) first download the radio streams in to file and play from that.
2) directly play from only streams.

Help me in arriving a best option.

Also it would be of great help if I receive some reference code for direct
only internet radio play. I am using shoutcast.com

Regards
Shakeel 




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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] What permissions (if any) are needed for ...

2009-08-28 Thread x17y19

Hi,

Are any uses-permission clauses needed in the manifest for:

1. Writing to a file using the Activity.openFileOutput() mechanism;
2. Writing to the SD card using FileOutputStreams;
3. Sending email using the Activity.startActivity( Intent.createChooser
(...)) mechanism ?

I looked at:

http://developer.android.com/reference/android/Manifest.permission.html
http://developer.android.com/guide/topics/security/security.html

and didn't see anything that seemed relevant. My app works on my ADP1
without any
uses-permission clauses when installed with adb install xyz.apk
but I was worried
that it may have problems on a real consumer device.

Thanks for any clarification on 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: How to speed up the Android emulator.

2009-08-28 Thread Mimi Tam
I could not get the Emulator to run newly build Apps from within Eclipse
when emulator is already up and running and I had to relaunch the Emulator
every time. I tried different things but to no avail. Please help.


I am running Android SDK 1.5 r3, latest DDMS and Eclipse Galileo in Windows
Vista.

Any ideas will be greatly appreciated.

THANKS.





On Thu, Aug 27, 2009 at 6:49 PM, Dianne Hackborn hack...@android.comwrote:

 There is a simulator build for Linux that compiles everything to native
 code that (sometimes) works.  Trying to do this kind of thing for Android is
 pretty tricky, however, because the system relies heavily on basic operating
 system objects like processes, various mechanisms for communicating between
 them (such as sockets and binder), etc.

 Trying to get a somewhat realistic environment running natively on a
 desktop is thus tricky enough if that desktop is Linux; it has actually been
 a very long time since the simulator did anything besides run all of the
 applications as threads inside of a single process, which is extremely
 different than the real environment.  Someone could maybe cobble this
 together to work on Linux again (requiring you to install a desktop build of
 the binder driver etc), but it's really difficult to maintain even the
 single process version.  Trying to get this running on something like
 Windows would be a long long rough road.

 On Thu, Aug 27, 2009 at 9:49 AM, Chris Stratton cs07...@gmail.com wrote:


 On Aug 27, 10:24 am, Moma osm...@gmail.com wrote:

  It takes 35 seconds to cold start the emulator and acitivity from the
  Eclipse IDE.

 Likely faster than cold booting an actual phone

  It takes 12 seconds to reload the acitivity when emulator is already
  up  running.

 Not significantly different from a hardware device either

  Do you think these numbers are normal?
  Is there any possibility to speed up the emulation speed of QEMU?

 You could use an x86 build of android running in a hypervisor-type
 virtual machine (VirtualBox, etc) so that the processor itself doesn't
 have to be emulated except when doing privileged/system things...
 that's how the palm pre development kit handles things.  I think it's
 good that the android emulator is closer to current devices for
 accuracy in testing, but when just iterating over software issues
 having something that's faster (even unrealistically fast compared to
 any existing phone) would be handy.

 Actually, I keep thinking it should be possible to have a davlik
 environment running within an ordinary desktop linux, though you might
 have to do something like run everything under the current UID which
 would grossly break the security model...




 --
 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] can anyone explain liblights and the lights.h interface? are there examples?

2009-08-28 Thread eric van tassell

What I'd like do is understand what kernel mode driver or /sys
interface thereto is used to control lcd backlight. Thanks.

-evt

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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] Detecting hardware specs or phone model

2009-08-28 Thread Lurieh

Hi all,
I'm working on a game containing a 3D engine, and I would like to
change some parameters automatically depending on the hardware
capabilities.
For that I need a way to check the platform directly from the
software.
Does anyone know a way to achieve that?

Thanks for any information.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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] Where can I find adroid manual

2009-08-28 Thread li jiecong
Hi
  There is online manual on the developer.android.com. Is there any offline
document about this manual? CHM,PDF,HTML are all ok. 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] Dialog theme

2009-08-28 Thread adam.csordas

Helo!
I'm using a custom theme in my application, defined in the
Manifest.xml, but I want to usa an other them on my dialogs. 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] OpenGL and VBO buffers

2009-08-28 Thread Cor

I am using VBO buffers in my openGL based game to work around the
extra GC caused by using glDrawArrays() and I have a few questions
regarding this:

I know that VBO buffers are allocated in the GPU memory and it is good
practice to free them when the program is stopped. What I do not know
is if there is a way that the GPU will clean up old VBO buffers that
might have been staying around because of a program crash or another
reason.

Could this eventually fill the GPU's memory and cause errors ? Or is
there a mechanism that will automatically free the buffers if a
process dies ?
For the moment I do a complete shutdown and restart every so often,
but I know that this would not be acceptable for a game. ;-)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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] Controling a Servo Controller? For use with robotics and sensors

2009-08-28 Thread Kit

 I'm new to android and have found an interest in using an android
powered phone to control a Pololu robotics servo controller/uart
bridge (link to device below). I'm wondering if this is possible and
what the best way to go about doing it would be. The device uses a usb
port to send and receive data, it would also be valuable to be able to
integrate the accelerometers, digital compasses and gps chips within
the phone. For example the G1 or MyTouch seem to be likely candidates
for the phone portion because they also incorporate a mini usb port.
Please let me know what you think.

http://www.pololu.com/catalog/product/390



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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] OMG, this 325 character limit !

2009-08-28 Thread Ramani Arunachalam

Why does Google have to limit the description of ADC2 submissions
also? I can't even list all the features of the app..

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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: IllegalArgumentException occur: parameter must be a descendant of this view in ViewGroup.java:2454

2009-08-28 Thread Steven Yi

Hi All,

We are building an app and have run into this problem when the virtual
keypad is up and touch a button that ends up calling setContentView.
We are targetting Cupcake since that is the current OS deployed.  Are
there any workarounds available?

Thanks!
steven

On Aug 4, 4:52 pm, Romain Guy romain...@google.com wrote:
 Known bug it's been fixed in Donut





 On Tue, Aug 4, 2009 at 1:48 PM, Moxormaxcambi...@gmail.com wrote:

  Hi,
  Did you manage to solve it? I have a similar problem.
  Every time I change the focus to a button, and then touch another
  button (I call setContentView()), the application crash with this
  Logcat:

  08-04 17:12:00.251: ERROR/AndroidRuntime(880): Uncaught handler:
  thread main exiting due to uncaught exception
  08-04 17:12:00.292: ERROR/AndroidRuntime(880):
  java.lang.IllegalArgumentException:parametermustbe adescendantof
  thisview
  08-04 17:12:00.292: ERROR/AndroidRuntime(880):     at
  android.view.ViewGroup.offsetRectBetweenParentAndChild(ViewGroup.java:
  2454)
  08-04 17:12:00.292: ERROR/AndroidRuntime(880):     at
  android.view.ViewGroup.offsetDescendantRectToMyCoords(ViewGroup.java:
  2391)
  08-04 17:12:00.292: ERROR/AndroidRuntime(880):     at
  android.view.ViewRoot.scrollToRectOrFocus(ViewRoot.java:1301)
  08-04 17:12:00.292: ERROR/AndroidRuntime(880):     at
  android.view.ViewRoot.draw(ViewRoot.java:1107)
  08-04 17:12:00.292: ERROR/AndroidRuntime(880):     at
  android.view.ViewRoot.performTraversals(ViewRoot.java:1030)
  08-04 17:12:00.292: ERROR/AndroidRuntime(880):     at
  android.view.ViewRoot.handleMessage(ViewRoot.java:1482)
  08-04 17:12:00.292: ERROR/AndroidRuntime(880):     at
  android.os.Handler.dispatchMessage(Handler.java:99)
  08-04 17:12:00.292: ERROR/AndroidRuntime(880):     at
  android.os.Looper.loop(Looper.java:123)
  08-04 17:12:00.292: ERROR/AndroidRuntime(880):     at
  android.app.ActivityThread.main(ActivityThread.java:3948)
  08-04 17:12:00.292: ERROR/AndroidRuntime(880):     at
  java.lang.reflect.Method.invokeNative(Native Method)
  08-04 17:12:00.292: ERROR/AndroidRuntime(880):     at
  java.lang.reflect.Method.invoke(Method.java:521)
  08-04 17:12:00.292: ERROR/AndroidRuntime(880):     at
  com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
  (ZygoteInit.java:782)
  08-04 17:12:00.292: ERROR/AndroidRuntime(880):     at
  com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
  08-04 17:12:00.292: ERROR/AndroidRuntime(880):     at
  dalvik.system.NativeStart.main(Native Method)

  This happens outside my code, once the onClick event is finished.

  Thanks in advance.
  Max

 --
 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] Inserting a new contact is not working

2009-08-28 Thread Michel Albert

I am trying to insert a new contact, but, even though I get a valid
URI back, the Contacts do not appear in the Contacts application.

Code:

ContentValues values = new ContentValues();
values.put( People.NAME, contact.getString(name) );
Uri uri = getContentResolver().insert(People.CONTENT_URI, values);

Uri phoneUri = null;
phoneUri = Uri.withAppendedPath(uri,
People.Phones.CONTENT_DIRECTORY);
values.clear();
values.put(People.Phones.TYPE, People.Phones.TYPE_MOBILE);
values.put(People.Phones.NUMBER, phone.getString(number));
getContentResolver().insert(phoneUri, values);

My problem lies already in the first three lines. The contact does not
seem to be stored. However, consecutive runs of this show, that the
internal ID is increased nonetheless.

Is there something I am missing? Do you have to commit the changes?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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: emulator to run iphone apps on android

2009-08-28 Thread Dianne Hackborn
That would be really awesome.  You'd get an A for sure.

On Thu, Aug 27, 2009 at 11:25 AM, mohangupta13 mohangupt...@gmail.comwrote:


 hello all,
 i am very new to android and smartphones on a whole , as part of my
 computer science engineering graduation i was thinking about making a
 project to make an emulator (like wine for linux) that would allow
 iphone apps to run on android platform unmodified or with at most a
 minimal change .
 can you please guide me if there is any other such project going or
 what technical considerations or challenges i must deal with .
 i am really sorry for being lazy and asking here instead of
 researching myself actually i have a deadline to submit the project
 proposal.

 all help is appreciated
 regards
 Mohan Gupta

 



-- 
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] Posts not appearing in group

2009-08-28 Thread stanlick

Greetings --

Can you see tell me why my posts are not appearing in the group?
Also, should the button on a new post be titled Send to moderators?

Peace,
Scott

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



[android-developers] Dialog callback from withing callback?

2009-08-28 Thread eags

I'm trying to pop up an AlertDialog when someone long presses a list
item.  What I end up with is nested callback objects.  I'm not sure if
that is the problem but simple Alert dialog examples are not working
for me.  Here is what I want and is crashing:

smsContactsListView.setOnItemLongClickListener(new
OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView? parent, 
View view,
int position, final long id) {

new AlertDialog.Builder(getApplicationContext())
.setTitle(Alert)
.setMessage(Really Delete SMS Contact?)
.setPositiveButton(Ok, new 
DialogInterface.OnClickListener
() {
@Override
public void onClick(DialogInterface 
dialog, int which) {
dbAdapter.removeSmsContact(id);
smsContactsCursor.requery();
}
})
.setPositiveButton(Cancel, new
DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface 
dialog, int which) {
}
})
.show();

// return true to indicate we consumed the callback
return true;
}
});


Here is what works (no dialog at all):

smsContactsListView.setOnItemLongClickListener(new
OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView? parent, 
View view,
int position, final long id) {

// This works for now
dbAdapter.removeSmsContact(id);
smsContactsCursor.requery();

// return true to indicate we consumed the callback
return true;
}
});

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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] Preferred Activity-Service communication pattern

2009-08-28 Thread stanlick

I would suspect this Activity-Service communication pattern is being
implemented in a variety of ways with good reason.  Either the
developer is a newbie and found a way that works (probably from Mark's
book) or else they are strategically searching for a solution that
works specifically for their use case.  I am a newbie looking for the
specific case!

My application needs to have a daemon-like thread running to collect
statistics.  I chose the Service here because it looked like it has a
lesser chance of being killed-- especially when conditioned with the
setForeground(true).  Perhaps I could replace the service with a
Broadcast receiver and store my statistics in an Application static
structure as Mark suggests.  My UI Activity *does* depend on the
collected statistics for presentation and that Activity can be killed
and resurrected any number of times without causing a problem.
However, if the Service is stopped, the application will miss events
that statics are beg compiled over and the application will
effectively become useless!  Does the Android Application lifecycle
support the notion of a daemon thread that will not get booted out of
memory?  I have read about lifecycles and precious resources and my
service is as skinny as they come.


What strikes me as odd is how on the one hand Android touts being able
to run background tasks when all the while you are encouraged not to
do it!

I am currently updating the Activity UI from the Service via a stashed
Handler in the Application scope.  Generally my design is as follows:

AppStatistics extends Application and contains the current Activity
instance and stats
public class AppStatistics extends Application {
private PlanTrak planTrak;
// internal statistics here
PlanTrak is my UI
public class PlanTrak extends Activity {

Handler guiHandler;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
guiHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
  // blah, blah, UI updates
};
((AppStatistics) getApplication()).setPlanTrak(this);

}
}
PlanTrakService is my “daemon”
public class PlanTrakService extends Service {
 AppStatistics app;
@Override public void onCreate() {
  super.onCreate();
  // I read this is supposed to raise the priority of this Service
to minimize it being killed
  setForeground(true);
app = (AppStatistics) getApplication();

  // init the service here
  _startService();
}

@Override public void onDestroy() {
  super.onDestroy();
  _shutdownService();
}

private void _startService() {
  timer.scheduleAtFixedRate(
  new TimerTask() {
public void run() {
  _monitorStats();
}
  },
  0,
  UPDATE_INTERVAL);
  Log.i(getClass().getSimpleName(), Timer started!!!);
}

private void _monitorStats() {
  app.blahStatsUpdate();
  Message message = Message.obtain();
  message.arg1=app.getBlahStatsUpdate();
  app.getPlanTrak().getGuiHandler().sendMessage(message);
}

private void _shutdownService() {
  if (timer != null) timer.cancel();
}
}

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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] SMS Sent Listener

2009-08-28 Thread stanlick

Is there a workaround to wiring up a listener for SMS messages sent?
The android.provider.Telephony.SMS_RECEIVED works great, but I cannot
find it's partner!

Peace,
Scott

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



[android-developers] Re: out of memory error getWallpaper

2009-08-28 Thread Sables

Are we not able to reassign Bitmaps? I get OOM just by doing something
like

Bitmap a;

a = network.downloadimage();
a = network.downloadimage();
a = network.downloadimage();// -- crash

Do I have to :

a.recycle() ;
a= null;

everytime?


On Aug 25, 2:25 pm, freeanderson freeander...@gmail.com wrote:
 I guess nobody reported my case.
 I've solved like below. See my case.

 ...

 Bitmap dummy = Bitmap.createBitma(1, 1, Config.RGB_565);

 Bitmap a = Bitmap.createBitma(100, 100, Config.RGB_565);
 Canvas c = new Canvas(a);

 ...c.draw(..) ...

 a.recycle();
 c.setBitmap(dummy); // This is key point. Very important to remove
 reference of 'c'.

 a = null;
 c = null;

 .

 Good Luck.

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



[android-developers] Bluetooth Support (lack of it)

2009-08-28 Thread Usability Architect

Andriod doesn't support many profiles.  (ummm 1, the headset profile)

I just bought a MyTouch 3G as my first Android phone and to say the
least, disappointed.  I like the open aspect of the phone, but I've
bought phones 5+ years ago that supported more BT profiles than
this.

I came from a Blackjack (windows mobile 6.1) phone which had
multimedia connections, DUN, OBEX, keyboard, and the list goes on.
The new version of windows mobile has PAN and supports tethering out
of the box.

For GOD sakes, I can't even get a directory listing via USB
connection.  How does anyone load their own videos and music on this
device?
I can't listen to music via bluetooth in my car anymore.

Someone please tell me that there is a issue with my New MyTouch
Andriod device and that I that I just didn't take a 10 year jump in BT
functionality my making the jump to an open platform.

Yours truly,
Very frustrated

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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: What permissions (if any) are needed for ...

2009-08-28 Thread Dianne Hackborn
On Thu, Aug 27, 2009 at 3:44 PM, x17y19 amberar...@gmail.com wrote:

 1. Writing to a file using the Activity.openFileOutput() mechanism;


No.  You are free to write to your own private data area.


 2. Writing to the SD card using FileOutputStreams;


Not now, but yes in the next release.


 3. Sending email using the Activity.startActivity( Intent.createChooser
 (...)) mechanism ?


No.  This simply shows a UI for the user to be involved in what is going on
(and thus implicitly approving what the app is requesting).


 and didn't see anything that seemed relevant. My app works on my ADP1
 without any
 uses-permission clauses when installed with adb install xyz.apk
 but I was worried
 that it may have problems on a real consumer device.


Unless you have hacked something on it, the application model for the ADP1
is just the same as any other android device.

-- 
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] Accelerometer OnSensorChanged() no longer occur in standby

2009-08-28 Thread polymorph

Hi,
I have written an application (a service) that uses the accelerometer
to detect movement, and up until recently this has worked fine when
the device was in standby.   It has been regularly tested on HTC G1
and Magic and tested specifically to work under these conditions, but
it seems that a recent Firmware upgrade may have broken this (my Magic
stopped working in this scenario since the last firmware I think, a
few weeks ago).  I have recently acquired an HTC Hero and this also
fails to get the notifications.

What seems to occur now, is that the
SensorEventListener.OnSensorChanged() messages are not occuring at all
in standby, and they continue once the device is switched back on.

The application also checks for other changes such as GPS location
changes, and these continue to work in standby, so I would expect the
sensor messages to also continue to get through as they did
previously.

I have tried a wakelock, but only the full, screen-on wakelock allows
it to work, which is undesirable behaviour.

Can anyone help?  This has effectively broken my Android Market
application :(

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



[android-developers] Getting the contents of android.R.attr.listPreferredItemHeight ( other dimensional system resources?)

2009-08-28 Thread benjamin.soell...@googlemail.com

Hello all,

I have been trying and searching about this problem all evening. How
do I access the resource attribute
android.R.attr.listPreferredItemHeight from my code? I have been
trying this:

int preferredItemHeight = Resources.getSystem().getDimensionPixelSize
(android.R.attr.listPreferredItemHeight)

... and this:

int preferredItemHeight = context.getResources().getDimensionPixelSize
(android.R.attr.listPreferredItemHeight)

... and even this:

TypedValue value = new TypedValue();
context.getTheme().resolveAttribute
(android.R.attr.listPreferredItemHeight, value, true);
int preferredItemHeight = context.getResources().getDimensionPixelSize
(preferredItemHeightValue.resourceId);

In the first two cases, I get a Resource.NotFoundException, in the
third one, value.resourceId contains 0. So how do I get this preferred
item height in my code?

To give you an overview - my problem is part of a bigger problem: I
try to build up a ListView with RadioButtons in every row. For that, I
use a custom ListAdapter. Every row is basically created on-the-fly: a
LinearLayout with a TextView and a RadioButton.

It might also be, that my approach is a bit to complicated in that
case - I am not that experienced on the android platform (yet). In
that case, I'd be happy if you point me to a more elegant solution.
I'm using the SDK 1.5.

Greetings from Dresden/Germany,
Benjamin

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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: Bluetooth Support (lack of it)

2009-08-28 Thread eags

a)Do you have bluetooth turned on?  I haven't tried all the profiles
you listed but I do know that headset, and A2DP both work perfectly
for me.
b)This is a developer's group, not a users group.  You'll probably
have better luck in the correct group (I don't know the url).

On Aug 28, 9:04 am, Usability Architect de...@infinite3.com wrote:
 Andriod doesn't support many profiles.  (ummm 1, the headset profile)

 I just bought a MyTouch 3G as my first Android phone and to say the
 least, disappointed.  I like the open aspect of the phone, but I've
 bought phones 5+ years ago that supported more BT profiles than
 this.

 I came from a Blackjack (windows mobile 6.1) phone which had
 multimedia connections, DUN, OBEX, keyboard, and the list goes on.
 The new version of windows mobile has PAN and supports tethering out
 of the box.

 For GOD sakes, I can't even get a directory listing via USB
 connection.  How does anyone load their own videos and music on this
 device?
 I can't listen to music via bluetooth in my car anymore.

 Someone please tell me that there is a issue with my New MyTouch
 Andriod device and that I that I just didn't take a 10 year jump in BT
 functionality my making the jump to an open platform.

 Yours truly,
 Very frustrated
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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: No com.android.camera.CropImage on HTC Magic?

2009-08-28 Thread Klaus Kartou
This code works on G1

 Intent intent = new
Intent(com.android.camera.action.CROP);
 intent.setClassName(com.android.camera,
com.android.camera.CropImage);
 intent.setData(uri);
 intent.putExtra(outputX, 128);
 intent.putExtra(outputY, 128);
 intent.putExtra(aspectX, 128);
 intent.putExtra(aspectY, 128);
 intent.putExtra(scale, true);
 intent.putExtra(noFaceDetection, true);
 intent.putExtra(output, Uri.parse(file:/ + FILE_PATH + userId +
/user.jpg));
 startActivityForResult(intent, CROP_PICTURE_ACTION);




On Sat, Aug 29, 2009 at 12:16 AM, Klaus Kartou kar...@gmail.com wrote:

 Hi,

 I have a pretty urgent issue. I am using the CropImage intent on my G1 Dev
 phone to crop images.
 However when starting this intent on a HTC Magic I get an error indicating
 the activity cannot be found:

 Unable to find explicit activity class
 {com.android.camera/com.android.camera.CropImage}

 Why is this activity not present on HTC Magic?
 Any input is much appreciated.

 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: Countries for selling priced applications in Android Market

2009-08-28 Thread João Carvalho

Me and and small group of friend developers in Portugal are also very
interested. Currently there are HTC Magic and Hero in the shops and
financed  by the operators, but if there is no market to sell apps or
buy apps, there is point on developing for 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] getApplitcationContext() vs this vs ActivityClassName.this

2009-08-28 Thread eags

Ok, so the code below started working as soon as I switched from
getApplicationContext (which I thought was safe here) to
SmsDecorator.this.

I've been a little confused about which to use where for a while.  Can
anyone please clarify the differences and where it it best to use one
over the other??

Thanks.


On Aug 28, 3:24 pm, eags eagsala...@gmail.com wrote:
 I'm trying to pop up an AlertDialog when someone long presses a list
 item.  What I end up with is nested callback objects.  I'm not sure if
 that is the problem but simple Alert dialog examples are not working
 for me.  Here is what I want and is crashing:

 smsContactsListView.setOnItemLongClickListener(new
 OnItemLongClickListener() {
                 @Override
                         public boolean onItemLongClick(AdapterView? parent, 
 View view,
 int position, final long id) {

                         new AlertDialog.Builder(getApplicationContext())
                         .setTitle(Alert)
                         .setMessage(Really Delete SMS Contact?)
                         .setPositiveButton(Ok, new 
 DialogInterface.OnClickListener
 () {
                                         @Override
                                         public void onClick(DialogInterface 
 dialog, int which) {
                                                 
 dbAdapter.removeSmsContact(id);
                                         smsContactsCursor.requery();
                                         }
                                 })
                         .setPositiveButton(Cancel, new
 DialogInterface.OnClickListener() {
                                         @Override
                                         public void onClick(DialogInterface 
 dialog, int which) {
                                         }
                                 })
                         .show();

                         // return true to indicate we consumed the callback
                                 return true;
                         }
                 });

 Here is what works (no dialog at all):

 smsContactsListView.setOnItemLongClickListener(new
 OnItemLongClickListener() {
                 @Override
                         public boolean onItemLongClick(AdapterView? parent, 
 View view,
 int position, final long id) {

                         // This works for now
                         dbAdapter.removeSmsContact(id);
                         smsContactsCursor.requery();

                         // return true to indicate we consumed the callback
                                 return true;
                         }
                 });
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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] include xml argument

2009-08-28 Thread sdphil

i have some layout xml that looks like this:

== file1.xml ==
?xml version=1.0 encoding=utf-8?
LinearLayout ...
   ...
   ...
/LinearLayout

I want to include that in some other layout xml, so I do this --

== file2.xml ==
include layout=@layout/file1.xml/

The question I have is how to pass arguments (and refer to them) from
file2.xml to file1.xml.

So, for example:

== file1.xml ==
?xml version=1.0 encoding=utf-8?
LinearLayout ...
  TextView android:text=@text android:layout_width=fill_parent
android:layout_height=fill_parent/
   ...
/LinearLayout

== file2.xml ==
include layout=@layout/file1.xml text=abc/

is this possible?

tia.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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] JOIN Contacts.People and Contacts.People.Phones

2009-08-28 Thread eags

I have an app where I want to list all phone numbers and the
associated contact name.  I see that there is the Contacts.People
table for the purpose of getting all phone numbers and that there is a
PERSON_ID to allow me to lookup the contact in Contacts.People.
Great.

The only problem is I can't figure out how to JOIN these tables.  What
I roughly want to do is this (in SQL):

SELECT People.Phones._ID, People.NAME, People.Phones.NUMBER
FROM Contacts.People.Phones INNER JOIN Contacts.People
ON Contacts.People._ID=Contacts.People.Phones.PERSON_ID

**Now I see that all the columns I want are already joined to the
Contacts.People.Phones table.  But that seems lucky in this case.  How
could I do the equivalent of the above statement in general if the
implementer of the content provider hadn't been so nice as to join for
me?

Thanks in advance for any 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] Suggestions on how to stop threads with long operations?

2009-08-28 Thread jsdf

Hi Android experts,
I have a tricky question that I would like some advice on.

I have a thread that does a large amount of network and database
work.  E.g.:

new Thread(new Runnable() {
  public void run() {
String largeData = getLargeDataFromServer();
Object largeObject = xmlParser.parseFromXml(largeData);
saveLargeObjectToDatabase();
putLargeDataToSecondServer();
  }
}).start();

The problem I have is that I need to stop this thread at any point.
It does not need to stop absolutely immediately, but given limited
network and memory on the phone, the sooner I can stop it the better.

I currently am testing and stopping with a method similar to this:

new Thread(new Runnable() {
  public void run() {
if (shouldStop) return;
String largeData = getLargeDataFromServer();
if (shouldStop) return;
Object largeObject = xmlParser.parseFromXml(largeData);
if (shouldStop) return;
saveLargeObjectToDatabase();
if (shouldStop) return;
putLargeDataToSecondServer();
  }
}).start();

This makes me very uncomfortable, and litters my code with these
shouldStop statements.  Furthermore, if the system is in any of the
four long functions, that function has to complete before the test can
actually happen.

I notice that there is a Thread.stop(), but the comments warn against
using it.

Does anyone have suggestions on how to reconfigure the thread so I can
stop relatively quickly and regardless of whether execution is in one
of its subfunctions?

Thanks so much in advance,
jsdf
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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: include xml argument

2009-08-28 Thread Romain Guy

No it's not.

On Fri, Aug 28, 2009 at 3:52 PM, sdphilphil.pellouch...@gmail.com wrote:

 i have some layout xml that looks like this:

 == file1.xml ==
 ?xml version=1.0 encoding=utf-8?
 LinearLayout ...
   ...
   ...
 /LinearLayout

 I want to include that in some other layout xml, so I do this --

 == file2.xml ==
 include layout=@layout/file1.xml/

 The question I have is how to pass arguments (and refer to them) from
 file2.xml to file1.xml.

 So, for example:

 == file1.xml ==
 ?xml version=1.0 encoding=utf-8?
 LinearLayout ...
  TextView android:text=@text android:layout_width=fill_parent
 android:layout_height=fill_parent/
   ...
 /LinearLayout

 == file2.xml ==
 include layout=@layout/file1.xml text=abc/

 is this possible?

 tia.
 




-- 
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: getApplitcationContext() vs this vs ActivityClassName.this

2009-08-28 Thread Dianne Hackborn
Only use the application context if you need something that persists for the
lifetime of your process, and don't need to use it to do any UI (because it
is not associated with an activity UI session).

Generally if in doubt, pretend like it doesn't exist and don't use it.

On Fri, Aug 28, 2009 at 3:46 PM, eags eagsala...@gmail.com wrote:


 Ok, so the code below started working as soon as I switched from
 getApplicationContext (which I thought was safe here) to
 SmsDecorator.this.

 I've been a little confused about which to use where for a while.  Can
 anyone please clarify the differences and where it it best to use one
 over the other??

 Thanks.


 On Aug 28, 3:24 pm, eags eagsala...@gmail.com wrote:
  I'm trying to pop up an AlertDialog when someone long presses a list
  item.  What I end up with is nested callback objects.  I'm not sure if
  that is the problem but simple Alert dialog examples are not working
  for me.  Here is what I want and is crashing:
 
  smsContactsListView.setOnItemLongClickListener(new
  OnItemLongClickListener() {
  @Override
  public boolean onItemLongClick(AdapterView?
 parent, View view,
  int position, final long id) {
 
  new AlertDialog.Builder(getApplicationContext())
  .setTitle(Alert)
  .setMessage(Really Delete SMS Contact?)
  .setPositiveButton(Ok, new
 DialogInterface.OnClickListener
  () {
  @Override
  public void
 onClick(DialogInterface dialog, int which) {
 
 dbAdapter.removeSmsContact(id);
  smsContactsCursor.requery();
  }
  })
  .setPositiveButton(Cancel, new
  DialogInterface.OnClickListener() {
  @Override
  public void
 onClick(DialogInterface dialog, int which) {
  }
  })
  .show();
 
  // return true to indicate we consumed the
 callback
  return true;
  }
  });
 
  Here is what works (no dialog at all):
 
  smsContactsListView.setOnItemLongClickListener(new
  OnItemLongClickListener() {
  @Override
  public boolean onItemLongClick(AdapterView?
 parent, View view,
  int position, final long id) {
 
  // This works for now
  dbAdapter.removeSmsContact(id);
  smsContactsCursor.requery();
 
  // return true to indicate we consumed the
 callback
  return true;
  }
  });
 



-- 
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: Two applications, same package. How?

2009-08-28 Thread junker37

Ok, here's what I did.  Seems to be working now, but someone please
let me know if it will cause problems later.

In my manifest, I specified each activity's full path, rather than a
relative path: ie activity android:name=com.google.code.Activity
versus activity android:name=.Activity

In my manifest, I have a base package name, this is where the R gets
generated, ie: manifest package=com.google.code.package

Then, for each build of the app I create, I modify the package
attribute, ie: manifest package=com.google.code.package.a,
manifest package=com.google.code.package.b, etc.

This will keep me from needing to modify any source code during my
build.

On Aug 27, 11:27 pm, Mark Murphy mmur...@commonsware.com wrote:
  I created the two apk files, however, when trying to install the
  second application, it fails because it says it's already installed.
  From what I can tell, it thinks the two applications are the same, my
  guess is because of the package attribute in the manifest.

 Correct.

  I modified the manifest with a different package name, but R is
  generated based on that package name and that affects the rest of the
  code.

 Correct.

  So, my question is this: What's the process I should be using to
  install two applications using the same code, but with different names
  and different strings.xml files?

 The process you were using is correct, to the extent there is *any* good
 way of doing what you are trying to do. You will need to script a means of
 altering your source code (or use Eclipse's refactoring tools) to deal
 with the fact that your code and R.java should wind up in some other
 package.

 Depending on your code base, it may be worthwhile to package some of it as
 an independent JAR file that the two applications use. Since such JAR
 files cannot reliably reference R.java constants anyway, that JAR file's
 code would not need to change for such a rename process.

 --
 Mark Murphy (a Commons Guy)http://commonsware.com
 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] include xml argument

2009-08-28 Thread sdphil

i have some layout xml that looks like this:

== file1.xml ==
?xml version=1.0 encoding=utf-8?
LinearLayout ...
   ...
   ...
/LinearLayout

I want to include that in some other layout xml, so I do this --

== file2.xml ==
include layout=@layout/file1.xml/

The question I have is how to pass arguments (and refer to them) from
file2.xml to file1.xml.

So, for example:

== file1.xml ==
?xml version=1.0 encoding=utf-8?
LinearLayout ...
  TextView android:text=@text android:layout_width=fill_parent
android:layout_height=fill_parent/
   ...
/LinearLayout

== file2.xml ==
include layout=@layout/file1.xml text=abc/

is this possible?

tia.
tia.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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: key code constant for question mark?

2009-08-28 Thread Mark Murphy

 I don't see an android.view.KeyEvent.KEYCODE constant defined for
 question mark (key code 76).  Is there a key code constant defined for
 the question mark?

Try KeyEvent.KEYCODE_SLASH, plus true for isShiftPressed().

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
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: How to listen to Back key

2009-08-28 Thread Julian Peña
Hi,

Just add this method to your activity.

Best Regards.

@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
if (keyCode == KeyEvent.KEYCODE_BACK)
{
your code here
}
   return .;
}

2009/8/27 cindy ypu01...@yahoo.com


 In current activity, when user click the back key, I don't what it
 back to the last activity.
 Can I add a listener to listen to back key in current activity? When
 user click back key, it actually back to the activity I want it to
 go.

 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: OMG, this 325 character limit !

2009-08-28 Thread Maps.Huge.Info (Maps API Guru)

I suggest shortening the description and including a link to your
site. That would make more sense.

-John Coryat
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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] get current location after pressing button

2009-08-28 Thread Stefan

Hi,

I want to implement a tracking software (saving outdoor routes with
gps).
If the user press a button, the device should save the current! (and
not the LastKnownLocation) gps point.

If there isn't a direction change, the device looks after xxx seconds,
whether the user reaches a point yyy meters away from the last saved
point
(no problem with requestLocationUpdates(LocationManager.GPS_PROVIDER,
xxx, yyy, locationListener); )


I can't or won't save all 1m and 1 second a new gps point. Or does
somebody knows, how much memory is used, i i track a 10km route an
save every second the new gps points (~5km/h) ? And if somebody track
a 100km tour ^^
And whats up with the performance and responsivness of the app.

So I want to use a thread. If i click on the button (left or
right), I call removeLocationUpdate, than i start a thread, which
calls getLocation. In this function, I set requestLocationUpdates(..,
0,0,..). And here's my last question: How should my LocationListener
class know, wheter it was fired from requestLocationUpdates(..,
0,0,..) (pressing button) or from requestLocationUpdates
(LocationManager.GPS_PROVIDER, xxx, yyy, locationListener); ???
Because I want to change the requestLocationUpdates - function back to
xxx seconds and yyy meters??

I hope you can understand my problem and have some tipps for me.

Thanks and regards,
Stefan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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 the limit of memory heap only 6M?

2009-08-28 Thread fadden

On Aug 28, 12:49 am, Mark Murphy mmur...@commonsware.com wrote:
 Strategically, find ways to help out with improvements to the Android
 garbage collector.

The bitmap memory isn't actually stored on the VM heap -- it's an
external allocation -- so improvements to the GC will not help this
much.

A compacting GC would have some positive effects in that reduced
fragmentation will cause the reported footprint size of the virtual
heap to be closer to the actual usage.  Since the total allocation cap
is based on the footprint size, you'd potentially have a bit more
memory available for external allocs.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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] Layouts for base Android applications

2009-08-28 Thread stanlick

Where in the source are the layouts for the built-in UI's?  I would
like to reuse (copy) a couple of the contact UI's rather than recreate
the wheel.

Peace,
Scott

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



[android-developers] Re: MediaStore.EXTRA_OUTPUT

2009-08-28 Thread Bill

Having the same problem ... like the EXTRA_OUTPUT parameter is getting
ignored completely .

Does anybody have a workaround ?

On Aug 21, 2:09 am, Friso friso.kl...@gmail.com wrote:
 I tried this, but I don't get the full size image back from the
 camera, just a 512x384 pixels. I am using the Developer Phone.

 My code
 final Intent imageCaptureIntent = new Intent
 (MediaStore.ACTION_IMAGE_CAPTURE);
 imageCaptureIntent.putExtra(MediaStore.EXTRA_OUTPUT,
         Uri.fromFile(new File(Environment.getExternalStorageDirectory(),
 test.jpg)));
 startActivityForResult(imageCaptureIntent, 1);

 On Jul 15, 8:53 pm, Christine christine.kar...@gmail.com wrote:

  I have seen a number of posts from people who had trouble retrieving a
  full size image from  MediaStore.EXTRA_OUTPUT with code like

                Intent i = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
                pictureUri = Uri.fromFile(new File(/sdcard/
  picturefile.jpg));
                intent.putExtra(MediaStore.EXTRA_OUTPUT, pictureUri);
                startActivityForResult(i, PICTURE_TAKEN);

  Should this code work? I mean, should this result in a file containing
  the picture?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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] Call path flow

2009-08-28 Thread Peace7

Hi,

I am a newbie to Android and Telephony System.
I am trying to understand the complete call path for placing a voice
call in Android Telephony System.
I have followed the code flow till the AT command for call is formed
and send over a device socket/device node of the serial port. I am
interested to know, who receives this AT command and how it get
processed further from on?

Any comments/pointers in this direction would be greatly appreciated.

Thanks!
Peace

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



[android-developers] Re: unable to hide window title using a theme.

2009-08-28 Thread sdphil

okay, it looks like you can only do this at the application level
within the AndroidManifest.xml file.  If i put that in the
application section, it works (and applies to all activities), if I
put it in the activity section, it does not work.  can anyone
confirm or deny?

On Aug 26, 10:56 am, sdphil phil.pellouch...@gmail.com wrote:
 doh.  okay, so I added that to my AndroidManifest.xml file --

         activity android:name=.myActivity style=@style/myStyle/

 and it still doesn't work.

 style is in file == values/styles.xml ==

 -phil

 On Aug 26, 9:44 am, Dianne Hackborn hack...@android.com wrote:

  Er...  the window title is not associated with a linear layout.  That is
  associated with the activity (ideally set with android:theme in the
  manifest).

  On Wed, Aug 26, 2009 at 8:13 AM, sdphil phil.pellouch...@gmail.com wrote:

   yes, I know how to do it in the java code (requestWindowFeature
   (Window.FEATURE_NO_TITLE)) -- but I would like to create a style that
   does that.

      style name=myStyle
          item name=android:windowNoTitletrue/item
          item name=android:background@drawable/myBackground/item
          item name=android:layout_widthfill_parent/item
          item name=android:layout_heightfill_parent/item
          item name=android:orientationvertical/item
      /style

   Then I would expect to be able to do this in my layout xml file --

   ?xml version=1.0 encoding=utf-8?
   LinearLayout xmlns:android=http://schemas.android.com/apk/res/
   android style=@style/myStyle
      ...
      ...
      ...
   /LinearLayout

   I get the background and the vertical orientation and the layout width/
   height, but I still get a title!

   tia.

  --
  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: Accelerometer Speaker Interference Workarounds?

2009-08-28 Thread Chris Stratton

On Aug 28, 7:39 pm, Robert Green rbgrn@gmail.com wrote:

 It's no secret that both the HTC Dream and HTC Magic have problems
 with sound from the built-in speaker interfering with the
 accelerometer.  I'm currently having the problem with my new game and
 am not sure how I'm supposed to work around it.  Quite frankly, the
 sound is a big part of the game and most people prefer to play with it
 on.  I found a great way to use tilt-view control and it works really
 well until I turn sound on, then it all goes to crap.

 Sure, I could crank the sample rate up to highest and take a running
 average of the past 5 or so samples and pull out the outliers but it's
 still not very accurate.

Ugh, if your observation is accurate this sounds like a system design
bug.   Average actually won't fully work, because the sensor needs to
be low pass filtered before the analog to digital conversion, in order
to keep any frequency components above its nyquist limit out of the
digitizer.   Otherwise you will get really odd effects if you have an
audio frequency that's near a multiple of the sample rate... they can
alias back to near zero frequency and look like very slow variations
in reading, which would go right through your averaging.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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: Controling a Servo Controller? For use with robotics and sensors

2009-08-28 Thread Chris Stratton

On Aug 28, 8:32 am, Kit kitduna...@gmail.com wrote:
  I'm new to android and have found an interest in using an android
 powered phone to control a Pololu robotics servo controller/uart
 bridge (link to device below). I'm wondering if this is possible and
 what the best way to go about doing it would be. The device uses a usb
 port to send and receive data, it would also be valuable to be able to
 integrate the accelerometers, digital compasses and gps chips within
 the phone. For example the G1 or MyTouch seem to be likely candidates
 for the phone portion because they also incorporate a mini usb port.
 Please let me know what you think.

The USB will not work, because neither the G1 nor the Magic (Mytouch)
presently have USB host capability, they are USB devices which must be
connected to an external computer, and your servo board is the same,
so you would have two devices with no host computer.   There is some
suspicion that the underlying chips might be capable of host mode, but
I've not heard of anyone making it work and the main PCB could well
need modification.

The Neo Freerunner from open moko is a not entirely dissimilar
embedded linux phone (which can run android to some degree, though it
was not designed to and isn't officially and android phone) and does
have USB host mode (it's not 3g, or as debugged as a phone, but then
your project probably doesn't require either).

The G1, or at least  the ADP1 had a sort of debug serial port on the
extusb connector, and it sounds like the servo interface you were
looking at has a serial/uart version available.  This probably would
work if you can figure out how to turn it on (possibly even in a
Magic) - probably need to recompile the kernel or at least a kernel
module and have the ability to install the result on the phone, which
you can't officially do on a carrier-branded phone.

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



[android-developers] Android

2009-08-28 Thread Nikamov

Just wondering on the release date of Android?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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] Home Screen Widget Configuration Issue

2009-08-28 Thread Mark

I have written a home screen widget that pops up a configuration
window as you add it to your home screen.  I'm doing this via the
android:configure attribute in the appwidget-provider tag.  After
the user enters their configuration values in the configuration
activity I call the activity's finish() method and the device goes
back to the home screen, with the new widget now in place.

The problem I'm getting, is if the user reorients the phone from
portrait-landscape or landscape-portrait during the configuration
activity, such as when they open the keyboard on a G1 to type some
value into a text field on the configuration screen, then the home
screen widget does not get displayed on the home screen.

I wish I could give more details about what is happening, but I don't
see anything unusual in the logs when this happens.  My app even goes
on to log some things as if it's still running and attempting to
display the home screen widget.  The widget just isn't displayed on
the home screen if the phone's orientation was changed while the
configuration activity was active.

Any help would be GREATLY appreciated.

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



[android-developers] Dynamic Image Cropping help/examples?

2009-08-28 Thread Sam

Hi,

I'm able to display mulitple images on the screen and scale them fine,
however, I need to crop the images using the API and setting the
gravity for the cropping. I couldn't find much information on image
cropping.

Basically I want to the image to be cropped based on the gravity and
the dimensions of the new smaller size. Any help would be appreciated.
Thanks.

Sammy

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