[android-developers] Error Code 5: Database is locked

2009-08-23 Thread Armond Avanes

Hi Guys,

I have different background threads in my application, one doing periodical
database updates, another responsible for doing long searches and so.
Obviously some are just reading from database while others are writing as
well.

Once in a while I get database is locked exception. I need to know the
safe way of reading/writing from/to database on different threads.

As well I've found isDbLockedByCurrentThread() and
isDbLockedByOtherThreads() methods on SQLiteDatabase. Should I use them
every time I want to access the database? What if the database is locked?
Should I pause the current thread and retry a few milliseconds later?

Best Regards,
Armond


08-23 10:17:32.029 E/AndroidRuntime( 1331): Caused by:
android.database.sqlite.SQLiteException: error code 5: database is locked

08-23 10:17:32.029 E/AndroidRuntime( 1331): at
android.database.sqlite.SQLiteStatement.native_execute(Native Method)

08-23 10:17:32.029 E/AndroidRuntime( 1331): at
android.database.sqlite.SQLiteStatement.execute(SQLiteStatement.java:66)

08-23 10:17:32.029 E/AndroidRuntime( 1331): at
android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1534)

08-23 10:17:32.029 E/AndroidRuntime( 1331): at
com.test.db.TestDao.update (TestDao.java:327)

08-23 10:17:32.029 E/AndroidRuntime( 1331): at
com.test.UpdateService.onStart(UpdateService.java:35)

08-23 10:17:32.029 E/AndroidRuntime( 1331): at
android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2557)

08-23 10:17:32.029 E/AndroidRuntime( 1331): . 10 more


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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: Error Code 5: Database is locked

2009-08-23 Thread Armond Avanes

I forgot to mention that this exception happens (so far) from the service I
have for updating database (is executed every 24 hours).

Cheersss,
Armond

 Hi Guys,
 
 I have different background threads in my application, one doing
 periodical
 database updates, another responsible for doing long searches and so.
 Obviously some are just reading from database while others are writing as
 well.
 
 Once in a while I get database is locked exception. I need to know the
 safe way of reading/writing from/to database on different threads.
 
 As well I've found isDbLockedByCurrentThread() and
 isDbLockedByOtherThreads() methods on SQLiteDatabase. Should I use them
 every time I want to access the database? What if the database is locked?
 Should I pause the current thread and retry a few milliseconds later?
 
 Best Regards,
 Armond
 
 
 08-23 10:17:32.029 E/AndroidRuntime( 1331): Caused by:
 android.database.sqlite.SQLiteException: error code 5: database is locked
 
 08-23 10:17:32.029 E/AndroidRuntime( 1331): at
 android.database.sqlite.SQLiteStatement.native_execute(Native Method)
 
 08-23 10:17:32.029 E/AndroidRuntime( 1331): at
 android.database.sqlite.SQLiteStatement.execute(SQLiteStatement.java:66)
 
 08-23 10:17:32.029 E/AndroidRuntime( 1331): at
 android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1534)
 
 08-23 10:17:32.029 E/AndroidRuntime( 1331): at
 com.test.db.TestDao.update (TestDao.java:327)
 
 08-23 10:17:32.029 E/AndroidRuntime( 1331): at
 com.test.UpdateService.onStart(UpdateService.java:35)
 
 08-23 10:17:32.029 E/AndroidRuntime( 1331): at
 android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2557)
 
 08-23 10:17:32.029 E/AndroidRuntime( 1331): . 10 more
 
 
 

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

2009-08-23 Thread sdphil

i am trying to draw a custom progress bar (horizontal).

I have this xml --

?xml version=1.0 encoding=UTF-8?

layer-list xmlns:android=http://schemas.android.com/apk/res/
android
 item android:id=@+android:id/background
android:drawable=@drawable/progress_background/
 item android:id=@+android:id/secondaryProgress
android:drawable=@drawable/progress_secondary/
 item android:id=@+android:id/progress
android:drawable=@drawable/progress/
/layer-list

What should my drawable's look like (dimensions)?  I can get the
secondary and primary progress graphics (1x9 pixel images), but the
background image always reverts to this gray bar with rounded corners
no matter what dimensions I use for the background image...

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] different images for imagebutton states...

2009-08-23 Thread sdphil

how do I specify different images for an ImageButton when the state
changes (i.e. pressed).

ImageButton android:id=@+id/Btn1
 android:layout_width=wrap_content
 android:layout_height=wrap_content
 android:src=@drawable/btn1
 android:background=@color/transparent/

In a standard button the color changes to orange when pressed, I'd
like to change a custom image button with a different image.

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] custom toggle button with images...

2009-08-23 Thread sdphil

I would like have a ToggleButton with different images for the checked
and unchecked states.

ToggleButton android:id=@+id/Btn1
 android:layout_width=wrap_content
 android:layout_height=wrap_content
 android:src=@drawable/btn1
 android:layout_centerVertical=true
 android:background=@color/transparent/

Starts off in btn1 image.  When clicked (toggled), it switches to
btn2 image -- how/where do I specify that?

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] SensorEventListener for SENSOR_ORIENTATION - what are the units of event.values[]?

2009-08-23 Thread olko

I am experimenting with orientation sensor, register it like this:

SesnorManager sensor_manager = (SensorManager)getSystemService
(Context.SENSOR_SERVICE);
Sensor sensor_orientation = sensor_manager.getSensorList
(SensorManager.SENSOR_ORIENTATION).get(0);
sensor_manager.registerListener(sensor_listener, sensor_orientation,
SensorManager.SENSOR_DELAY_UI);

and then read the orientation values in the sensor event listener:

private final SensorEventListener sensor_listener = new
SensorEventListener() {
...
float sensor_data_x = event.values[SensorManager.DATA_X];
...
}

What comes out from this does not look like degrees, radians, or
anything that would reflect the phone orientation.
Am I missing something?

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



[android-developers] Developing a shared library client _without_ mydroid code

2009-08-23 Thread GiladH

hey,

i am reopening this issue as it is now becoming a high-priority
one for our team.


we have developed a shared library jar according to the sample:
http://android.git.kernel.org/?p=platform/development.git;a=blob;f=samples/PlatformLibrary/README.txt;h=5ce9d2f7756a0708e9fc0aed7845f3d69d4a6ae0;hb=cupcake



building the shared library itself requires the presence of the
mydroid
source tree, and we have no problem with this.

but, according to this sample, building a CLIENT application that
will use our shared library also requires the presence of the mydroid
source tree. this is unacceptable for us.


is there any way to circumvent this latter request?


tnx,
GiladH
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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: SensorEventListener for SENSOR_ORIENTATION - what are the units of event.values[]?

2009-08-23 Thread olko


.. I run it on G1.


On Aug 23, 10:14 am, olko y.olkho...@gmail.com wrote:
 I am experimenting with orientation sensor, register it like this:

 SesnorManager sensor_manager = (SensorManager)getSystemService
 (Context.SENSOR_SERVICE);
 Sensor sensor_orientation = sensor_manager.getSensorList
 (SensorManager.SENSOR_ORIENTATION).get(0);
 sensor_manager.registerListener(sensor_listener, sensor_orientation,
 SensorManager.SENSOR_DELAY_UI);

 and then read the orientation values in the sensor event listener:

 private final SensorEventListener sensor_listener = new
 SensorEventListener() {
 ...
 float sensor_data_x = event.values[SensorManager.DATA_X];
 ...

 }

 What comes out from this does not look like degrees, radians, or
 anything that would reflect the phone orientation.
 Am I missing something?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Fake call into real device

2009-08-23 Thread Peacemoon

Can i fake a call into a real deivce as i can do with the emulator.
When i debug my program on my real device, the Telephony Actions of
DDMS is disabled and i can't fake a call  anymore.
Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: How to update the UI from service

2009-08-23 Thread Abdula

Activity wich started service must get obtained data service for
update ui.
I think that the first options best suited. Please provide an example
for the first option. Thanks.

On 21 авг, 21:01, Mark Murphy mmur...@commonsware.com wrote:
 Abdula wrote:
  Need service wich retrive data by http and then return them to
  activity for update list view. How i can do this. I don't know return
  retrived data.

 You can:

 -- have the activity register some sort of callback or listener object
 with the service, which the service calls when the data is loaded

 -- use a message bus (http://github.com/commonsguy/cwac-bus/tree),
 though my current implementation is overly complicated and needs a rewrite

 -- broadcast an Intent and have the activity listen for the broadcast Intent

 -- put the activity in a static public data member, though this is
 dangerous, as it think it is more prone than the other techniques to
 lead to memory leaks

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

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



[android-developers] Re: Simple Java Question

2009-08-23 Thread chinchin

Well you could flush the stream each time, wouldn't that be similar
with creating a new formatter? I used to do something similar when
reading from files etc.

On Aug 23, 1:18 am, Rud rudmerr...@gmail.com wrote:
 Rather wasteful on a platform like Android. Are there any other
 options other than Formatter?

 Rud

 On Aug 22, 10:28 am, Mark Murphy mmur...@commonsware.com wrote:

  Rud wrote:
   The is (maybe) a simple Java question but I can't find the anwer
   searching.

   The code is:

           final Formatter f = new Formatter();

           for (Sentinel s : Sentinel.mSentinels) {
               if (s.mIsLive) {
                   pos++;
                   f.format(%4d%5d, s.mPos.x, s.mPos.y);
                   canvas.drawText(f.toString(), x_pos, (pos *
   mHalfHeight), mPaint);
               }

   The problem is Formatter appends the output rather than clearing the
   underlying buffer for each 'format'. Okay, my bad. I looked for
   something to clear the underlying buffer but can't find anything.

   Suggestions?

  Create a new Formatter.

  If you look at the constructors for Formatter, you will see that its
  mission in life is to dump data to some stream-like object, be that a
  literal stream, or a File, or any sort of Appendable object. As such, it
   is aimed at calling format() multiple times to dump more data to the
  same output stream, then closing up the stream (via flush() and close()).

  If you want to dump data to some new stream (in your case, a new
  String), you need to create a new Formatter.

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

  Android App Developer Books:http://commonsware.com/books.html-Hide quoted 
  text -

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



[android-developers] Re: SensorEventListener for SENSOR_ORIENTATION - what are the units of event.values[]?

2009-08-23 Thread olko



.. Ok, that should have been Sensor.TYPE_ORIENTATION i.s.o. deprecated
SensorManager.SENSOR_ORIENTATION:

Sensor sensor_orientation = sensor_manager.getDefaultSensor
(Sensor.TYPE_ORIENTATION);

Now the event.values[] look like degrees but they never changes, e.g
event.values[0] is always just above 70 degrees no matter what
orientation the phone has.



On Aug 23, 10:25 am, olko y.olkho...@gmail.com wrote:
 .. I run it on G1.

 On Aug 23, 10:14 am, olko y.olkho...@gmail.com wrote:



  I am experimenting with orientation sensor, register it like this:

  SesnorManager sensor_manager = (SensorManager)getSystemService
  (Context.SENSOR_SERVICE);
  Sensor sensor_orientation = sensor_manager.getSensorList
  (SensorManager.SENSOR_ORIENTATION).get(0);
  sensor_manager.registerListener(sensor_listener, sensor_orientation,
  SensorManager.SENSOR_DELAY_UI);

  and then read the orientation values in the sensor event listener:

  private final SensorEventListener sensor_listener = new
  SensorEventListener() {
  ...
  float sensor_data_x = event.values[SensorManager.DATA_X];
  ...

  }

  What comes out from this does not look like degrees, radians, or
  anything that would reflect the phone orientation.
  Am I missing something?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: catching out of memory errors

2009-08-23 Thread alex

I guess you are trying to perform manipulations on a byte[]. Just use
decodeStream(...) or decodeFile(...) instead. Cathing runtime errors
is plain wrong.

On Aug 23, 2:45 am, Bob bshumsk...@yahoo.com wrote:
 Hi,
 I am getting an outofmemory error (java.lang.outofmememoryerror) from
 a bitmapfactory that doesn't seem to be caught despite the fact that
 it is in a try{ }catch block.  Can I catch this error somehow or is it
 outofmemory inherently uncatchable?

 Thanks,
 Bob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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. TranslateAnimation takes no effect

2009-08-23 Thread LD

Hi,

I am trying to create animation that moves an image.

Lets have a look at following (like image locations on screen):
  01 02
  03 04

If I move from 01 to 02, 03 to 04, 01 to 03, 02 to 04,
TranslateAnimation works fine.

But when I do 01 to 04 (or 02 to 03) I will have no visual animation,
and image takes immediate vertical position.

Could you please suggest what could be wrong?

Thanks.
Lyubomyr
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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: My emulator is running 100% CPU, it's annoying..

2009-08-23 Thread jiaoni

Hi Dianne,

Thanks. I tried adb shell top -t command, and here is the result:

  PID   TID CPU% S VSS RSS UID  Thread  Proc
  578   784  83% R 191676K  23200K system   er$SensorThread
system_server
  788   788   8% R948K412K root top top

And according to link provided by GC (Thanks GC), I turned off
Orientation sensing in Settings/Sound  Display.  Unfortunately,
the work around seems doesn't work for me, see below:

  PID   TID CPU% S VSS RSS UID  Thread  Proc
  578   784  89% R 201824K  23180K system   er$SensorThread
system_server
  798   798   9% R948K412K root top top

Any solution?

Thanks,
Jiaoni

On Aug 23, 5:21 am, GC gtcopel...@gmail.com wrote:
 This is a known bug. I reported it back in June. A work around is
 provided by the Google developer in the bug 
 thread.http://code.google.com/p/android/issues/detail?id=3099

 On Aug 21, 2:57 am, jiaoni jiaoni5...@gmail.com wrote:

  Hi,

  Many times (not all the times), my emulator is running 100% of one of
  my two CPUs on the machine.

  Can anyone tell me why it is so, and how can I reduce the cpu usage?

  Thanks a lot,
  Jiaoni
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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: SensorEventListener for SENSOR_ORIENTATION - what are the units of event.values[]?

2009-08-23 Thread olko


.. solution is here: http://mysticlakesoftware.blogspot.com/ - cloning
event.values[] does work.


On Aug 23, 11:01 am, olko y.olkho...@gmail.com wrote:
 .. Ok, that should have been Sensor.TYPE_ORIENTATION i.s.o. deprecated
 SensorManager.SENSOR_ORIENTATION:

 Sensor sensor_orientation = sensor_manager.getDefaultSensor
 (Sensor.TYPE_ORIENTATION);

 Now the event.values[] look like degrees but they never changes, e.g
 event.values[0] is always just above 70 degrees no matter what
 orientation the phone has.

 On Aug 23, 10:25 am, olko y.olkho...@gmail.com wrote:



  .. I run it on G1.

  On Aug 23, 10:14 am, olko y.olkho...@gmail.com wrote:

   I am experimenting with orientation sensor, register it like this:

   SesnorManager sensor_manager = (SensorManager)getSystemService
   (Context.SENSOR_SERVICE);
   Sensor sensor_orientation = sensor_manager.getSensorList
   (SensorManager.SENSOR_ORIENTATION).get(0);
   sensor_manager.registerListener(sensor_listener, sensor_orientation,
   SensorManager.SENSOR_DELAY_UI);

   and then read the orientation values in the sensor event listener:

   private final SensorEventListener sensor_listener = new
   SensorEventListener() {
   ...
   float sensor_data_x = event.values[SensorManager.DATA_X];
   ...

   }

   What comes out from this does not look like degrees, radians, or
   anything that would reflect the phone orientation.
   Am I missing something?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] EditText onChange

2009-08-23 Thread poncz

My Application need to perform a database search when the user change
the text in an EditText view.
I need a method like onChange to allow me to know when the text in the
EditText changed.
How can I detect a change in the EditText view?

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: EditText onChange

2009-08-23 Thread poncz

I think I found it:


etSearch.addTextChangedListener(new TextWatcher() {

public void  afterTextChanged (Editable s){
Log.d(seachScreen, afterTextChanged);
}
public void  beforeTextChanged  (CharSequence s, int 
start, int
count, int after){
Log.d(seachScreen, beforeTextChanged);
}
public void  onTextChanged  (CharSequence s, int start, 
int before,
int count) {
Log.d(seachScreen, onTextChanged);
}


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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] set background of ImageButton to transparent leads to the disabled flicker of the button when click

2009-08-23 Thread OiuNt

hello everyone!
 i try to custom a button like ZoomControls, which has left round
corners and fliker when click.
 i extend the LinearLayout with two ImageButtons, and set the
imagebutton with transparent background. However, when click on the
button, the button doesn't flicker again.
 Could you help me ? 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] Thread in multiple Activities .

2009-08-23 Thread rizwan

Hi All ,
I have started a thread from one Activity and then i have started
another activit from parent Activity . Now my Parrent Activity is in
pause state .
but what will happen to thread that I have started from parrent . I
belive it will continuenot going in sleep state
any thoughts

Thanks

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

2009-08-23 Thread engin

Hi, how can we download a file from server using ftp? How can we use
android's download manager manually to download ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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: get area name using latitude and longitude

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

Not sure what you mean by area name but the process you're referring
to is called reverse geocoding.

-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] Re: get area name using latitude and longitude

2009-08-23 Thread Marc Lester Tan
try this one:

final Geocoder geoCoder = new Geocoder(context, Locale.getDefault());
ListAddress addresses = geoCoder.getFromLocation(latitude, longitude,
numResults);

-Marc

On Sun, Aug 23, 2009 at 1:33 PM, Honest honestsucc...@gmail.com wrote:


 Hello,

 Can some one tell me how can i get area name by passing latitdue and
 longitude in android? Which api i will have to use.

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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 all the resources from other apks

2009-08-23 Thread Spektor Yaron
Hi,
i was able to play around with the resource on a different apk and get them
using createPackageContext as you suggested.
here is an example of the code:
otherAppContext =
this.createPackageContext(com.android.demo.notepad2,Context.CONTEXT_INCLUDE_CODE
+ Context.CONTEXT_IGNORE_SECURITY);
int resID = otherAppContext.getResources().getIdentifier(icon, drawable,
com.android.demo.notepad2);

this works well.
now i am trying to get ALL the drawables (or all the layouts) in this
package. i tried a multitude of ways including reflection and AssetManager
but was unsuccessful. any tips here?
just to be clear i can not use R.drawable.icon as this is a different
context

-- 
Yaron Spektor

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

2009-08-23 Thread Spektor Yaron
Hi Kabir,
if you mean how do you catch these events and change the layout this could
help:
http://www.devx.com/wireless/Article/40792/1954


On Sun, Aug 23, 2009 at 1:27 AM, kabir kab...@gmail.com wrote:


 Hi,

 I have an activity which I have defined to keep in portrait position.

 However I would still like to change things (slightly) when the screen
 is rotated, what is the best way of doing this?
 I notice onConfigurationChanged is still called, but this still
 reports portrait mode.

 I want to keep the notification bar etc in the same position if
 possible.

 Cheers
 Kabir
 



-- 
Yaron Spektor

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



[android-developers] Re: getting all the resources from other apks

2009-08-23 Thread Dianne Hackborn
I don't believe there is any way to do that from an application.  From a
desktop, you can use the aapt dump commands to find out about the contents
of the .apk.

On Sun, Aug 23, 2009 at 8:15 AM, Spektor Yaron spekt...@gmail.com wrote:

 Hi,
 i was able to play around with the resource on a different apk and get them
 using createPackageContext as you suggested.
 here is an example of the code:
 otherAppContext =
 this.createPackageContext(com.android.demo.notepad2,Context.CONTEXT_INCLUDE_CODE
 + Context.CONTEXT_IGNORE_SECURITY);
 int resID = otherAppContext.getResources().getIdentifier(icon,
 drawable, com.android.demo.notepad2);

 this works well.
 now i am trying to get ALL the drawables (or all the layouts) in this
 package. i tried a multitude of ways including reflection and AssetManager
 but was unsuccessful. any tips here?
 just to be clear i can not use R.drawable.icon as this is a different
 context

 --
 Yaron Spektor

 



-- 
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: bluetooth use in android

2009-08-23 Thread gymshoe

I am confused.  According to above, There is no Bluetooth API in the
SDK at this time, yet Android does offer:

Stereo Bluetooth support (A2DP and AVCRP profiles)   (http://
developer.android.com/sdk/android-1.5-highlights.html)

Is there no API for use with the A2DP or AVCRP profiles?


thanks,
JIm



On Aug 9, 11:42 pm, Stefano Sanna gerda...@gmail.com wrote:
 Hello.

 On Sun, Aug 9, 2009 at 7:10 PM, Honesthonestsucc...@gmail.com wrote:

  Hello,

  Stefano Sanna thanks for your great work.

 Thank you.

  I put one issue in your
  project please take a look at it and let me know.

 Thanks for feedback. It is probably a permission issue.
 AndroidManifest.xml must have following permissions:

 uses-permission android:name=android.permission.BLUETOOTH/

 uses-permission android:name=android.permission.BLUETOOTH_ADMIN/

 Best regards,
 Stefano.

 --
 Stefano Sanna
 gerda...@gmail.com (Skype: gerdavax)

 Personal blog:http://www.gerdavax.it
 Linkedin profile:http://www.linkedin.com/in/gerdavax
 QuadraSpace Project:http://www.quadraspace.org
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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: catching out of memory errors

2009-08-23 Thread Streets Of Boston

Depends...

In general, it's no good catching Errors. But I'm using this
particular error to see if i have enough memory for creating a full-
sized bitmap (no other way of doing this). If not, i catch the
outofmemoryerror and will use a smaller sized bitmap.

On Aug 23, 5:02 am, alex gsm...@gmail.com wrote:
 I guess you are trying to perform manipulations on a byte[]. Just use
 decodeStream(...) or decodeFile(...) instead. Cathing runtime errors
 is plain wrong.

 On Aug 23, 2:45 am, Bob bshumsk...@yahoo.com wrote:



  Hi,
  I am getting an outofmemory error (java.lang.outofmememoryerror) from
  a bitmapfactory that doesn't seem to be caught despite the fact that
  it is in a try{ }catch block.  Can I catch this error somehow or is it
  outofmemory inherently uncatchable?

  Thanks,
  Bob- Hide quoted text -

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



[android-developers] Re: media player exception

2009-08-23 Thread Venky

Riz

Try this.
holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
mMediaPlayer.setScreenOnWhilePlaying(true);

On Aug 20, 8:02 pm, riz rizcs...@gmail.com wrote:
 when I try to createmediaPlayerthrough Create(Context,Resource_ID)
 (rest of the codr remain same)it played the audio of the video file
 but still no video . ..my project is stuck . I need to know how to
 play video file from resource folder. .

 On Aug 20, 8:41 am, riz rizcs...@gmail.com wrote:

  Hi Venky,
  No I have not file the bug yet ,if you want to file the bug then
  please go ahead. most important thing for me right now is how to play
  a resource video file in android ?
  please suggest me alternate solution . I m stuck here ,looking for a
  solution ...please help me .

  Thanks
  Riz

  On Aug 19, 4:39 pm, Venky sgve...@gmail.com wrote:

   Hi Riz

   Did you get a chance to file the bug for crash. This is not specific
   to file I believe. I get the same crash with a different .3gp file
   when prepare is called after create.

   Regds,
   Venky

   On Aug 19, 3:14 pm, riz rizcs...@gmail.com wrote:

I m trying to play mp4 
moviehttp://www.mp4mail.com/docs/files/disney_128v_16a.mp4
.mediaplayer.start() method is onprepaidEventListener() , but still no
success. please help me

I m using this code

public void onCreate(Bundle icicle) {
super.onCreate(icicle);

try {

/*
  * TODO: Set the path variable to a localmedia
file path.
  */
 setContentView(R.layout.mediaplayer_2);
mPreview = (SurfaceView) findViewById(R.id.surface);
holder = mPreview.getHolder();

// Create a newmediaplayerand set the listeners
mMediaPlayer = new MediaPlayer() ;

AssetFileDescriptor afd = 
getResources().openRawResourceFd
(R.raw.disney);
 mMediaPlayer.setDataSource(afd.getFileDescriptor(),
afd.getStartOffset(), afd.getLength());
 mMediaPlayer.setDisplay(holder);

 //   mMediaPlayer.prepare();
mMediaPlayer.setOnBufferingUpdateListener(this);
mMediaPlayer.setOnCompletionListener(this);
mMediaPlayer.setOnPreparedListener(this);

mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);

} catch (Exceptione) {

Log.e(TAG, error:  + e.getMessage(), e);
}

}

public void onBufferingUpdate(MediaPlayer arg0, int percent) {
Log.d(TAG, onBufferingUpdate percent: + percent);

}

public void onCompletion(MediaPlayer arg0) {
Log.d(TAG, onCompletion called);

}

public void onPrepared(MediaPlayer mediaplayer) {
try  {
Log.d(TAG, onPrepared called);
mVideoWidth = mMediaPlayer.getVideoWidth();
mVideoHeight = mMediaPlayer.getVideoHeight();
Log.d(TAG, VideoWidth :+mVideoWidth);
Log.d(TAG, VideoHeight :+mVideoHeight);
if (mVideoWidth != 0  mVideoHeight != 0) {
holder.setFixedSize(mVideoWidth, mVideoHeight);
  mMediaPlayer.start();
Log.d(TAG, PlayerStarted );
}
}
catch(Exceptione) {
Log.d(TAG, ExceptionTrace.. +e.getMessage());

}

}

here is the stack trace

I/ActivityManager(  568): Starting activity: Intent { flags=0x1000
comp={Hel
lo.Android/Hello.Android.HellAndroid} }
D/AndroidRuntime(  712): Shutting down VM
D/dalvikvm(  712): DestroyJavaVM waiting for non-daemon threads to
exit
D/dalvikvm(  712): DestroyJavaVM shutting VM down
D/dalvikvm(  712): HeapWorker thread shutting down
D/dalvikvm(  712): HeapWorker thread has shut down
D/jdwp(  712): JDWP shutting down net...
D/dalvikvm(  712): VM cleaning up
I/ActivityManager(  568): Start proc Hello.Android for activity
Hello.Android/.H
ellAndroid: pid=718 uid=10019 gids={3003}
D/dalvikvm(  712): LinearAlloc 0x0 used 637060 of 4194304 (15%)
I/jdwp(  653): received file descriptor 30 from ADB
I/jdwp(  662): received file descriptor 25 from ADB
I/jdwp(  681): received file descriptor 27 from ADB
I/jdwp(  718): received file descriptor 13 from ADB
I/ActivityManager(  568): Displayed activity
Hello.Android/.HellAndroid: 1542 ms

D/dalvikvm(  633): GC freed 2853 objects / 162352 bytes in 132ms
D/dalvikvm(  653): GC freed 2852 objects / 175536 bytes in 142ms
D/dalvikvm(  662): GC freed 1248 objects / 79664 bytes in 117ms
D/dalvikvm(  611): GC freed 2128 objects / 114400 bytes in 115ms

On Aug 19, 2:03 pm, 李亮亮 leeco...@hotmail.com wrote:

 Hi,

 Maybe you didn't post all your 

[android-developers] Re: Screen rotation

2009-08-23 Thread kabir

Thanks

On Aug 22, 11:27 pm, kabir kab...@gmail.com wrote:
 Hi,

 I have an activity which I have defined to keep in portrait position.

 However I would still like to change things (slightly) when the screen
 is rotated, what is the best way of doing this?
 I notice onConfigurationChanged is still called, but this still
 reports portrait mode.

 I want to keep the notification bar etc in the same position if
 possible.

 Cheers
 Kabir
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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 use in android

2009-08-23 Thread Dianne Hackborn
Hi Stefano, I know you already say this in your site, but just to be extra
clear -- the code here is accessing private APIs, so we make no guarantees
about it working in future versions of the platform.  There is a very good
chance that applications using it will break at a platform update.

On Sun, Aug 9, 2009 at 7:49 AM, Stefano Sanna gerda...@gmail.com wrote:


 Hi.

 On Sun, Aug 9, 2009 at 1:29 PM, Honesthonestsucc...@gmail.com wrote:
 
  I want to use bluetooth APIS in my android application. I could found
  the API related to wifi but i could not find the API for bluetooth.
  Can some one tell me how can i use it ? any links for API docs and
  code snippt will be much useful to me.

 I've written an experimental Bluetooth API that provides Bluetooth
 stack on/off, device discovery and rfcomm (SPP) client connections. It
 does not need to get root access on the device and it have been
 successfully tested on firmware 1.1 and 1.5, on HTC Dream, HTC Magic
 and Samsung Galaxy.

 This Bluetooth API and a sample application (published on the Android
 Market as Bluetooth Samples) is published under Apache 2.0 license
 at:

 http://code.google.com/p/android-bluetooth/

 Feel free to contact me if you need further details.

 Ciao,
 Stefano.

 --
 Stefano Sanna
 gerda...@gmail.com (Skype: gerdavax)

 Personal blog: http://www.gerdavax.it
 Linkedin profile: http://www.linkedin.com/in/gerdavax
 QuadraSpace Project: http://www.quadraspace.org

 



-- 
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: Find long/lat distance X from current location

2009-08-23 Thread alexdonnini

Hi John,

Excellent! Connceptually, that's exactly what I was looking for. I
will probably need to make some changes to the code but it's a great
start.

Thank you.

Alex Donnini

On Aug 22, 2:10 pm, Maps.Huge.Info (Maps API Guru)
cor...@gmail.com wrote:
 This example using a Google map may be useful: (JavaScript)

 http://maps.huge.info/dragcircle2.htm

 -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] Re: Writing a Bitmap to a a outputstream

2009-08-23 Thread karthikr


I am trying to write the contents of the bitmap without doing a
compress on it for a format, as I am facing somme problems in quality
while formatting.

I am using thte below code but its not working,

ByteBuffer bf = ByteBuffer.allocate(IMAGE_WIDTH*IMAGE_HEIGHT*4);
mBitmap.copyPixelsToBuffer(bf);
out.write(bf.array());

Is there any other way forward,can i do a get pixels and write it to
an output stream?

If i can any sample code or pointers for the same?

Thanks in advance,
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: Writing a Bitmap to a a outputstream

2009-08-23 Thread Streets Of Boston

Bitmap bmToSave = ... // the bitmap you want to save
int height = ... // height of bitmap
int width  = ... // width of bitmap

int[] bmData = new int[TMP_BUFFER_SIZE]; // holds the ARGB data for
pixels of bmToSave
int heightChunk = ... // number of pixel-rows of bmToSave that will
fit into the buffer of bmData

IntArrayOutputStream ios = null;
try {
final OutputStream os = new FileOutputStream(getTemporarySaveFile());
ios = new IntArrayOutputStream(os);
int heightLeft = height;
int y = 0;
while (heightLeft  0) {
final int chunkSize = Math.min(heightChunk, heightLeft);

bmToSave.getPixels(bmData, 0, width, 0, y, width, chunkSize);
ios.write(bmData, 0, width*chunkSize);

y += chunkSize;
heightLeft -= heightChunk;
}
}
catch (Exception e) {
throw new RuntimeException(e);
}
finally {
if (ios != null) { try { ios.close(); } catch (Exception e) {} }
}


Notes:
-- The getTemporarySaveFile() will make sure that a file on the SD-
card exists that can be used to save the bitmap to.
-- The IntArrayOutputStream class is a class that i wrote: It
translates an integer-array into a proper byte-array (one integer --
4 bytes). There is a corresponding IntArrayInputStream to read integer-
arrays.
-- Above code may not compile. It only serves as an guideline. The
actual code is different, because that code does not save a bitmap 'as
is', but a bitmap backed by a canvas that allows me to save color-
corrections on the original bitmap.


On Aug 23, 2:32 pm, karthikr karthik.scintill...@gmail.com wrote:
 I am trying to write the contents of thebitmapwithout doing a
 compress on it for a format, as I am facing somme problems in quality
 while formatting.

 I am using thte below code but its not working,

 ByteBuffer bf = ByteBuffer.allocate(IMAGE_WIDTH*IMAGE_HEIGHT*4);
 mBitmap.copyPixelsToBuffer(bf);
 out.write(bf.array());

 Is there any other way forward,can i do a get pixels and write it to
 an output stream?

 If i can any sample code or pointers for the same?

 Thanks in advance,
 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: EditText and Virtual Keyboard

2009-08-23 Thread Hazam

Hi guys,
I just got back from holidays :)
this is the hack

@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
InputConnection ic = super.onCreateInputConnection(outAttrs);
InputConnectionWrapper icw = new InputConnectionWrapper(ic, false) {

public boolean commitText(CharSequence text, int 
newCursorPosition)
{
//TODO text is the new inserted text, return if the 
text is ok or
not
}
};
return icw;
}

The point is, one should use InputFilter objects on a TextField as
much as possible,
but in the very special case that you have to react to the key pressed
on the vitual keyboard
to do something more custom, that's the only way I found.

Hope this helps

On Aug 6, 11:09 pm, Hong lordh...@gmail.com wrote:
 Hi Emanuele,

 I'm interested in knowing your solution as well ;)  A small favor on
 my tips to you... please...

 Thanks

 Hong



 On Fri, Jul 31, 2009 at 10:48 AM, Azhdarazh...@gmail.com wrote:

  Hi Hazam,

  could you show us more in detail how you do that ?

  Thank you !

  Azhdar

  On Jul 10, 3:23 pm, Hazam emanuele.disave...@gmail.com wrote:
  Hi Hong,
  thanks for your reply.
  I tried that but to no avail.
  The reason seems to be that clicks and actions fromvirtualkeyboard
  do not follow the same
  path that normal key and touch events do.
  The get tunneled in an InputConnection, and things get REALLY
  difficult for me to understand fully.
  So i just override onCreateInputConnection and return a
  BaseInputConnection and now it works.
  thanks again for the reply,

  -Emanuele
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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: catching out of memory errors

2009-08-23 Thread Nivek

I've coded this too in my first app (EmailAlbum Viewer) which displays
pictures contained in archives that are received by email, for
example.

If someone receive pictures which are too large for the app memory, I
prefer catching the error and display an informative message to the
user rather than an ugly default application shutdown.

Nivek

On 23 août, 19:07, Streets Of Boston flyingdutc...@gmail.com wrote:
 Depends...

 In general, it's no good catching Errors. But I'm using this
 particular error to see if i have enough memory for creating a full-
 sized bitmap (no other way of doing this). If not, i catch the
 outofmemoryerror and will use a smaller sized bitmap.

 On Aug 23, 5:02 am, alex gsm...@gmail.com wrote:



  I guess you are trying to perform manipulations on a byte[]. Just use
  decodeStream(...) or decodeFile(...) instead. Cathing runtime errors
  is plain wrong.

  On Aug 23, 2:45 am, Bob bshumsk...@yahoo.com wrote:

   Hi,
   I am getting an outofmemory error (java.lang.outofmememoryerror) from
   a bitmapfactory that doesn't seem to be caught despite the fact that
   it is in a try{ }catch block.  Can I catch this error somehow or is it
   outofmemory inherently uncatchable?

   Thanks,
   Bob- Hide quoted text -

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



[android-developers] Re: Fake call into real device

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

I could think of to extend the framework code for doing this. If you
are only interested in receiving the call related intents on SDK level
you could modify the framework in a way that you could trigger these
events manually.

--
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 23, 1:44 am, Peacemoon tran.bin...@gmail.com wrote:
 Can i fake a call into a real deivce as i can do with the emulator.
 When i debug my program on my real device, the Telephony Actions of
 DDMS is disabled and i can't fake a call  anymore.
 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: EditText and Virtual Keyboard

2009-08-23 Thread Dianne Hackborn
If possible, it is better to add an appropriate watcher/filter on the text
view, and do your specialization as a result of the text being modified.
This will work for both hard keys and soft edits.

On Sun, Aug 23, 2009 at 12:05 PM, Hazam emanuele.disave...@gmail.comwrote:


 Hi guys,
 I just got back from holidays :)
 this is the hack

 @Override
 public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
InputConnection ic = super.onCreateInputConnection(outAttrs);
InputConnectionWrapper icw = new InputConnectionWrapper(ic, false) {

public boolean commitText(CharSequence text, int
 newCursorPosition)
 {
//TODO text is the new inserted text, return if the
 text is ok or
 not
}
};
return icw;
 }

 The point is, one should use InputFilter objects on a TextField as
 much as possible,
 but in the very special case that you have to react to the key pressed
 on the vitual keyboard
 to do something more custom, that's the only way I found.

 Hope this helps

 On Aug 6, 11:09 pm, Hong lordh...@gmail.com wrote:
  Hi Emanuele,
 
  I'm interested in knowing your solution as well ;)  A small favor on
  my tips to you... please...
 
  Thanks
 
  Hong
 
 
 
  On Fri, Jul 31, 2009 at 10:48 AM, Azhdarazh...@gmail.com wrote:
 
   Hi Hazam,
 
   could you show us more in detail how you do that ?
 
   Thank you !
 
   Azhdar
 
   On Jul 10, 3:23 pm, Hazam emanuele.disave...@gmail.com wrote:
   Hi Hong,
   thanks for your reply.
   I tried that but to no avail.
   The reason seems to be that clicks and actions fromvirtualkeyboard
   do not follow the same
   path that normal key and touch events do.
   The get tunneled in an InputConnection, and things get REALLY
   difficult for me to understand fully.
   So i just override onCreateInputConnection and return a
   BaseInputConnection and now it works.
   thanks again for the reply,
 
   -Emanuele
 



-- 
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: ListView with multiple buttons, how do I detect which View the buttons were pressed in?

2009-08-23 Thread Croccy22

Hi thanks for the reply,

I've set an onClickListener and it's only parameter is View. The
problem is  don't know how to translate that information back to a
useful identifier. I can't use getID ecause the buttons are all
created from the same XML layout so they have the same ID. The only
unique thing I can find is if I do a v.toString() tis returns somehing
like android.widget.but...@123456.

What I need to do is if I press a button in the second View of the
ListView I need to retrieve a value from a cursor database from the
second result?

Matt.

On Aug 21, 6:53 pm, skink psk...@gmail.com wrote:
 On Aug 21, 10:18 am, Croccy22 matthew.bea...@gmail.com wrote:





  Hi all,

  I am writing  a program where I need a ListView for which I am using a
 ListActivity. Each one  of the views within the ListView has four
  buttons, (Off, Dim, Bright and On). Each one of these buttons is
  configured with it's own OnClickListener when I build the view. This
  part seems to work  ok.

  However when I have say 5 Views each which has these four buttonns, I
  cann tell whether an off,dim,bright or onbuttonwas pressed but I
  cannot tell from which view it was pressed.

  So for example if my views are devices (Light, Heater and Kettle) I
  press an onbuttonand i know an Onbuttonwas pressed but how do I
  get it to tell me the Onbuttonfor the Light was pressed?

  Any ideas on how to achieve this?

  Thanks, Matt

 well,

 what method does OnClickListener interface  have?

 and what's its only parameter?

 pskink- Hide quoted text -

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



[android-developers] Re: getting all the resources from other apks

2009-08-23 Thread Spektor Yaron
Hi,
i know it is done somehow by other applications (for example adding new
skins to an existing application w/o knowing the name of the layout ahead of
time)
what am i missing here. is this not the way to do it?
should i copy all resources to the file system and read them from there?
would that make sense? would i be able to inflate a view with them this way?
Thanks,

On Sun, Aug 23, 2009 at 6:44 PM, Dianne Hackborn hack...@android.comwrote:

 I don't believe there is any way to do that from an application.  From a
 desktop, you can use the aapt dump commands to find out about the contents
 of the .apk.


 On Sun, Aug 23, 2009 at 8:15 AM, Spektor Yaron spekt...@gmail.com wrote:

 Hi,
 i was able to play around with the resource on a different apk and get
 them using createPackageContext as you suggested.
 here is an example of the code:
 otherAppContext =
 this.createPackageContext(com.android.demo.notepad2,Context.CONTEXT_INCLUDE_CODE
 + Context.CONTEXT_IGNORE_SECURITY);
 int resID = otherAppContext.getResources().getIdentifier(icon,
 drawable, com.android.demo.notepad2);

 this works well.
 now i am trying to get ALL the drawables (or all the layouts) in this
 package. i tried a multitude of ways including reflection and AssetManager
 but was unsuccessful. any tips here?
 just to be clear i can not use R.drawable.icon as this is a different
 context

 --
 Yaron Spektor





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


 



-- 
Yaron Spektor

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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: Thread in multiple Activities .

2009-08-23 Thread niko20

Yes, the thread will continue to run. That Activity's OnPause() will
get called. So if you want the thread to stop then put in a flag
boolean that the thread can check, and set the flag in the Activities
OnPause() callback.

-niko

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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: different images for imagebutton states...

2009-08-23 Thread niko20


Hi, there is no built in functionality to do this. What you have to do
is switch the images yourself in the button's onClick handler. Check
for if the button was pressed or released in that handler, and then
you can use SetImageResource() or such to swap the image that is begin
displayed.

-niko
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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: set background of ImageButton to transparent leads to the disabled flicker of the button when click

2009-08-23 Thread niko20

Hi, try calling Invalidate() on the View after switching the images.
You'll have to do all drawing yourself.

-niko


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



[android-developers] Re: getting all the resources from other apks

2009-08-23 Thread Spektor Yaron
Hi again,
just to verify that i am explaining myself correctly. my code takes all the
relevant apk's based on the intent filter and wants to take all the
resources from the \layout to later be able to inflate them.
i get the package name (e.g.,com.android.demo.notepad2) from the returned
resolveInfo and i know the folder name (e.g., layout etc.) all i need now is
a method to get all the resources in something like:
com.android.demo.notepad2:layout on a diffrent apk.
thanks

On Mon, Aug 24, 2009 at 12:18 AM, Spektor Yaron spekt...@gmail.com wrote:

 Hi,
 i know it is done somehow by other applications (for example adding new
 skins to an existing application w/o knowing the name of the layout ahead of
 time)
 what am i missing here. is this not the way to do it?
 should i copy all resources to the file system and read them from there?
 would that make sense? would i be able to inflate a view with them this way?
 Thanks,


 On Sun, Aug 23, 2009 at 6:44 PM, Dianne Hackborn hack...@android.comwrote:

 I don't believe there is any way to do that from an application.  From a
 desktop, you can use the aapt dump commands to find out about the contents
 of the .apk.


 On Sun, Aug 23, 2009 at 8:15 AM, Spektor Yaron spekt...@gmail.comwrote:

 Hi,
 i was able to play around with the resource on a different apk and get
 them using createPackageContext as you suggested.
 here is an example of the code:
 otherAppContext =
 this.createPackageContext(com.android.demo.notepad2,Context.CONTEXT_INCLUDE_CODE
 + Context.CONTEXT_IGNORE_SECURITY);
 int resID = otherAppContext.getResources().getIdentifier(icon,
 drawable, com.android.demo.notepad2);

 this works well.
 now i am trying to get ALL the drawables (or all the layouts) in this
 package. i tried a multitude of ways including reflection and AssetManager
 but was unsuccessful. any tips here?
 just to be clear i can not use R.drawable.icon as this is a different
 context

 --
 Yaron Spektor





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


 



 --
 Yaron Spektor




-- 
Yaron Spektor

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



[android-developers] Re: getting all the resources from other apks

2009-08-23 Thread Dianne Hackborn
I'm not sure what this has to do with skinning.  I don't know of any
applications that scan for different resources for a skin; rather, you
create a skin by replacing the existing (layout, drawable, etc) resource
with a different one.

On Sun, Aug 23, 2009 at 2:18 PM, Spektor Yaron spekt...@gmail.com wrote:

 Hi,
 i know it is done somehow by other applications (for example adding new
 skins to an existing application w/o knowing the name of the layout ahead of
 time)
 what am i missing here. is this not the way to do it?
 should i copy all resources to the file system and read them from there?
 would that make sense? would i be able to inflate a view with them this way?
 Thanks,

 On Sun, Aug 23, 2009 at 6:44 PM, Dianne Hackborn hack...@android.comwrote:

 I don't believe there is any way to do that from an application.  From a
 desktop, you can use the aapt dump commands to find out about the contents
 of the .apk.


 On Sun, Aug 23, 2009 at 8:15 AM, Spektor Yaron spekt...@gmail.comwrote:

 Hi,
 i was able to play around with the resource on a different apk and get
 them using createPackageContext as you suggested.
 here is an example of the code:
 otherAppContext =
 this.createPackageContext(com.android.demo.notepad2,Context.CONTEXT_INCLUDE_CODE
 + Context.CONTEXT_IGNORE_SECURITY);
 int resID = otherAppContext.getResources().getIdentifier(icon,
 drawable, com.android.demo.notepad2);

 this works well.
 now i am trying to get ALL the drawables (or all the layouts) in this
 package. i tried a multitude of ways including reflection and AssetManager
 but was unsuccessful. any tips here?
 just to be clear i can not use R.drawable.icon as this is a different
 context

 --
 Yaron Spektor





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






 --
 Yaron Spektor

 



-- 
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: getting all the resources from other apks

2009-08-23 Thread Dianne Hackborn
Sorry but this just isn't something we have APIs for right now.  I don't
recall anyone wanting to do this kind of thing before, so it hasn't been
high on our priority list.

Note that layout etc at the resource level are not really folder names --
they are just symbolic names for the part of the resource identifier integer
that categorizes the resource.  The resource system itself revolves almost
entirely around integer identifiers; the symbolic names are pretty much just
there for the convenience of developers.  There is a big binary data
structure in the .apk that is used to map from integer identifiers to the
corresponding resource value (which may be stored directly inside the data
structure for simple resources like integers and strings, or may be a path
to another file in the .apk for things like xml data or images).

You could probably hack something together by taking advantage of the
current implementation detail that the resource system assigns resource
identifiers in a sequential manner (sequentially incrementing the entry part
and type part of the integer), to step through retrieving names until you
get a resource not found exception.  However, I can't make any guarantees
that this will work in the future.

On Sun, Aug 23, 2009 at 3:44 PM, Spektor Yaron spekt...@gmail.com wrote:

 Hi again,
 just to verify that i am explaining myself correctly. my code takes all the
 relevant apk's based on the intent filter and wants to take all the
 resources from the \layout to later be able to inflate them.
 i get the package name (e.g.,com.android.demo.notepad2) from the returned
 resolveInfo and i know the folder name (e.g., layout etc.) all i need now is
 a method to get all the resources in something like:
 com.android.demo.notepad2:layout on a diffrent apk.
 thanks


 On Mon, Aug 24, 2009 at 12:18 AM, Spektor Yaron spekt...@gmail.comwrote:

 Hi,
 i know it is done somehow by other applications (for example adding new
 skins to an existing application w/o knowing the name of the layout ahead of
 time)
 what am i missing here. is this not the way to do it?
 should i copy all resources to the file system and read them from there?
 would that make sense? would i be able to inflate a view with them this way?
 Thanks,


 On Sun, Aug 23, 2009 at 6:44 PM, Dianne Hackborn hack...@android.comwrote:

 I don't believe there is any way to do that from an application.  From a
 desktop, you can use the aapt dump commands to find out about the contents
 of the .apk.


 On Sun, Aug 23, 2009 at 8:15 AM, Spektor Yaron spekt...@gmail.comwrote:

 Hi,
 i was able to play around with the resource on a different apk and get
 them using createPackageContext as you suggested.
 here is an example of the code:
 otherAppContext =
 this.createPackageContext(com.android.demo.notepad2,Context.CONTEXT_INCLUDE_CODE
 + Context.CONTEXT_IGNORE_SECURITY);
 int resID = otherAppContext.getResources().getIdentifier(icon,
 drawable, com.android.demo.notepad2);

 this works well.
 now i am trying to get ALL the drawables (or all the layouts) in this
 package. i tried a multitude of ways including reflection and AssetManager
 but was unsuccessful. any tips here?
 just to be clear i can not use R.drawable.icon as this is a different
 context

 --
 Yaron Spektor





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






 --
 Yaron Spektor




 --
 Yaron Spektor

 



-- 
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: getting all the resources from other apks

2009-08-23 Thread Spektor Yaron
Thanks Dianne, i appreciate your help.
firstly i am not even sure how to do the single skin version you suggested,
unless i state that the resources names must not change which is something i
am not eager to do.
secondly, i was thinking (in terms of skins) to allow multiple skins at
once. so the user selects one or more skins and can see them (lets say i
have one default skin and then i click on a change skin button and change
it to the next one in line).
so my idea (and hopefully i will be able to post it here soon for everyone
to use) was to take all the relevant apks based on the intent-filter, and
show them to the user to be able to choose from, thus creating a list of
skin, for this i need to load the resources for the drawable and the layout
etc. (again, skins are just an example) from all the apks i got back from
the search.
as i said earlier, i may be missing something and there may be a much easier
way to do it in android
Thanks,
Yaron

On Mon, Aug 24, 2009 at 3:03 AM, Dianne Hackborn hack...@android.comwrote:

 I'm not sure what this has to do with skinning.  I don't know of any
 applications that scan for different resources for a skin; rather, you
 create a skin by replacing the existing (layout, drawable, etc) resource
 with a different one.


 On Sun, Aug 23, 2009 at 2:18 PM, Spektor Yaron spekt...@gmail.com wrote:

 Hi,
 i know it is done somehow by other applications (for example adding new
 skins to an existing application w/o knowing the name of the layout ahead of
 time)
 what am i missing here. is this not the way to do it?
 should i copy all resources to the file system and read them from there?
 would that make sense? would i be able to inflate a view with them this way?
 Thanks,

 On Sun, Aug 23, 2009 at 6:44 PM, Dianne Hackborn hack...@android.comwrote:

 I don't believe there is any way to do that from an application.  From a
 desktop, you can use the aapt dump commands to find out about the contents
 of the .apk.


 On Sun, Aug 23, 2009 at 8:15 AM, Spektor Yaron spekt...@gmail.comwrote:

 Hi,
 i was able to play around with the resource on a different apk and get
 them using createPackageContext as you suggested.
 here is an example of the code:
 otherAppContext =
 this.createPackageContext(com.android.demo.notepad2,Context.CONTEXT_INCLUDE_CODE
 + Context.CONTEXT_IGNORE_SECURITY);
 int resID = otherAppContext.getResources().getIdentifier(icon,
 drawable, com.android.demo.notepad2);

 this works well.
 now i am trying to get ALL the drawables (or all the layouts) in this
 package. i tried a multitude of ways including reflection and AssetManager
 but was unsuccessful. any tips here?
 just to be clear i can not use R.drawable.icon as this is a different
 context

 --
 Yaron Spektor





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






 --
 Yaron Spektor





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


 



-- 
Yaron Spektor

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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 add default zoom in/out in my MapView?

2009-08-23 Thread idoun

Hi!

You don't have to use the ZoomControls class, if you need just a
simple zoom in/out built-in function.


Use this simple method.

mapView.setBuiltInZoomControls(true);

try~!


On Jun 30, 7:01 pm, tstanly tsai.sta...@gmail.com wrote:
 it's a stupid question...
 there are a ZoomControl widget in the sdk that can use..

 On 6月30日, 下午3時57分, tstanly tsai.sta...@gmail.com wrote:

  hi all,

  like the map app in the emulator,
  there are zoom in/out function and beutiful icon in the bellow of
 mapview,

  can i write the same function and icon for mymapview?

  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: getting all the resources from other apks

2009-08-23 Thread Spektor Yaron
Thanks again Dianne,
i don't think your solution will do as i also need to know which class i am
in (i need to know that 0x7f02 is a drawable and that 0x7f03 is a
layout).
Is it possible to get the information i need through the AssetManager? any
way to hack into the binary data structure?
if not i guess it is back to the drawing-board for me.

On Mon, Aug 24, 2009 at 3:09 AM, Dianne Hackborn hack...@android.comwrote:

 Sorry but this just isn't something we have APIs for right now.  I don't
 recall anyone wanting to do this kind of thing before, so it hasn't been
 high on our priority list.

 Note that layout etc at the resource level are not really folder names --
 they are just symbolic names for the part of the resource identifier integer
 that categorizes the resource.  The resource system itself revolves almost
 entirely around integer identifiers; the symbolic names are pretty much just
 there for the convenience of developers.  There is a big binary data
 structure in the .apk that is used to map from integer identifiers to the
 corresponding resource value (which may be stored directly inside the data
 structure for simple resources like integers and strings, or may be a path
 to another file in the .apk for things like xml data or images).

 You could probably hack something together by taking advantage of the
 current implementation detail that the resource system assigns resource
 identifiers in a sequential manner (sequentially incrementing the entry part
 and type part of the integer), to step through retrieving names until you
 get a resource not found exception.  However, I can't make any guarantees
 that this will work in the future.

 On Sun, Aug 23, 2009 at 3:44 PM, Spektor Yaron spekt...@gmail.com wrote:

 Hi again,
 just to verify that i am explaining myself correctly. my code takes all
 the relevant apk's based on the intent filter and wants to take all the
 resources from the \layout to later be able to inflate them.
 i get the package name (e.g.,com.android.demo.notepad2) from the
 returned resolveInfo and i know the folder name (e.g., layout etc.) all i
 need now is a method to get all the resources in something like:
 com.android.demo.notepad2:layout on a diffrent apk.
 thanks


 On Mon, Aug 24, 2009 at 12:18 AM, Spektor Yaron spekt...@gmail.comwrote:

 Hi,
 i know it is done somehow by other applications (for example adding new
 skins to an existing application w/o knowing the name of the layout ahead of
 time)
 what am i missing here. is this not the way to do it?
 should i copy all resources to the file system and read them from there?
 would that make sense? would i be able to inflate a view with them this way?
 Thanks,


 On Sun, Aug 23, 2009 at 6:44 PM, Dianne Hackborn hack...@android.comwrote:

 I don't believe there is any way to do that from an application.  From a
 desktop, you can use the aapt dump commands to find out about the contents
 of the .apk.


 On Sun, Aug 23, 2009 at 8:15 AM, Spektor Yaron spekt...@gmail.comwrote:

 Hi,
 i was able to play around with the resource on a different apk and get
 them using createPackageContext as you suggested.
 here is an example of the code:
 otherAppContext =
 this.createPackageContext(com.android.demo.notepad2,Context.CONTEXT_INCLUDE_CODE
 + Context.CONTEXT_IGNORE_SECURITY);
 int resID = otherAppContext.getResources().getIdentifier(icon,
 drawable, com.android.demo.notepad2);

 this works well.
 now i am trying to get ALL the drawables (or all the layouts) in this
 package. i tried a multitude of ways including reflection and AssetManager
 but was unsuccessful. any tips here?
 just to be clear i can not use R.drawable.icon as this is a different
 context

 --
 Yaron Spektor





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






 --
 Yaron Spektor




 --
 Yaron Spektor





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


 



-- 
Yaron Spektor

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

2009-08-23 Thread D.Garcia
Hi all,
Any news about submission site?
Please, if anybody knows something from official sources just let us know.

Thanks,
Darío

On Fri, Aug 21, 2009 at 15:19, Jack Ha jack...@t-mobile.com wrote:


 Check this link:

   http://www.meetup.com/svandroid/messages/7262249/

 --
 Jack Ha
 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 20, 8:52 pm, Jeremiah jlcoh...@gmail.com wrote:
  I'm also searching for an answer to this question. We finished our app
  today and looked for the submission form, only to not find one. We are
  unsure if we should submit it to the Android Market or wait for the
  form. Anyone from Google want to help us out?
 
  Also, the fine print states that the apps cannot be updated once
  submitted, but implies they should be available for free in the
  Android Market. Does that mean that the Android Market will prevent
  updating of the application during the competition?
 
  Thanks!
 
  Jeremiah Cohickhttp://DigitalDandelion.net
 
  On Aug 3, 2:31 am, Croco luciano.brous...@gmail.com wrote:
 
   Hi all,
 
   I'm wondering what is the procedure to submit an application entry for
   the competition.
 
   I can't find into the related docs the procedure to submit  a
   candidate application.
 
   Do we need to submit on the Android Market but any android application
   can't participate according the terms and agreements of the cup.
 
   Thanks for your lights  ;)
 
   Croco
 
 
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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: set background of ImageButton to transparent leads to the disabled flicker of the button when click

2009-08-23 Thread OiuNt

thanks for your suggestion!
but i don't quite understand your meaning, you mean the flicker of the
button when click on should be implemented by myself with two images
switching, because the default background has been set to transparent?
thanks for your kind!

On Aug 24, 6:25 am, niko20 nikolatesl...@yahoo.com wrote:
 Hi, try calling Invalidate() on the View after switching the images.
 You'll have to do all drawing yourself.

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



[android-developers] Re: disable HOME key and right soft key

2009-08-23 Thread Shang Hao

Hi Mark,

Thanks for your reply.. I actually meant the home key and the End call
button on the device. For home key i have found a solution at
PhoneWindowManager.java @framework Any idea about the End call
button??

Thanks.

On Aug 22, 4:03 am, Mark Murphy mmur...@commonsware.com wrote:
 Shang Hao wrote:
  Hi,
  dis
  I m making a test application and want to able all keys excluding the
  back button.. Using below code i am not able to disable HOME key
  and right soft key. Please suggest what to do.

    �...@override
     public boolean onKeyDown(int keyCode, KeyEvent event) {
             if(keyCode == KeyEvent.KEYCODE_BACK){
                     return super.onKeyDown(keyCode, event);
             }
         else   {
                     return true;
             }

     }

 You cannot disable the home key, and Android does not have soft keys.

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

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



[android-developers] Re: disable HOME key and right soft key

2009-08-23 Thread Romain Guy

You cannot disabled these keys from an application.

On Sun, Aug 23, 2009 at 6:53 PM, Shang Haosahilz...@gmail.com wrote:

 Hi Mark,

 Thanks for your reply.. I actually meant the home key and the End call
 button on the device. For home key i have found a solution at
 PhoneWindowManager.java @framework Any idea about the End call
 button??

 Thanks.

 On Aug 22, 4:03 am, Mark Murphy mmur...@commonsware.com wrote:
 Shang Hao wrote:
  Hi,
  dis
  I m making a test application and want to able all keys excluding the
  back button.. Using below code i am not able to disable HOME key
  and right soft key. Please suggest what to do.

    �...@override
     public boolean onKeyDown(int keyCode, KeyEvent event) {
             if(keyCode == KeyEvent.KEYCODE_BACK){
                     return super.onKeyDown(keyCode, event);
             }
         else   {
                     return true;
             }

     }

 You cannot disable the home key, and Android does not have soft keys.

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

 _Beginning Android_ from Apress Now Available!
 




-- 
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: disable HOME key and right soft key

2009-08-23 Thread Hristo Yordanov
Please unsubscribe me!

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



[android-developers] Re: Error Code 5: Database is locked

2009-08-23 Thread Andrei

If your write time take long i would try this
I would create another in memory database, attach it to yours.
In memory database table would have same schema.
You would write to in memory database and after done do insert into
db1.table as select * from db2.table
I did something similar but on desktop not phone and of course you
need to wait for lock to clear

On Aug 23, 2:31 am, Armond Avanes armond...@yahoo.com wrote:
 I forgot to mention that this exception happens (so far) from the service I
 have for updating database (is executed every 24 hours).

 Cheersss,
 Armond

  Hi Guys,

  I have different background threads in my application, one doing
  periodical
  database updates, another responsible for doing long searches and so.
  Obviously some are just reading from database while others are writing as
  well.

  Once in a while I get database is locked exception. I need to know the
  safe way of reading/writing from/to database on different threads.

  As well I've found isDbLockedByCurrentThread() and
  isDbLockedByOtherThreads() methods on SQLiteDatabase. Should I use them
  every time I want to access the database? What if the database is locked?
  Should I pause the current thread and retry a few milliseconds later?

  Best Regards,
  Armond

  08-23 10:17:32.029 E/AndroidRuntime( 1331): Caused by:
  android.database.sqlite.SQLiteException: error code 5: database is locked

  08-23 10:17:32.029 E/AndroidRuntime( 1331):     at
  android.database.sqlite.SQLiteStatement.native_execute(Native Method)

  08-23 10:17:32.029 E/AndroidRuntime( 1331):     at
  android.database.sqlite.SQLiteStatement.execute(SQLiteStatement.java:66)

  08-23 10:17:32.029 E/AndroidRuntime( 1331):     at
  android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1534)

  08-23 10:17:32.029 E/AndroidRuntime( 1331):     at
  com.test.db.TestDao.update (TestDao.java:327)

  08-23 10:17:32.029 E/AndroidRuntime( 1331):     at
  com.test.UpdateService.onStart(UpdateService.java:35)

  08-23 10:17:32.029 E/AndroidRuntime( 1331):     at
  android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2557)

  08-23 10:17:32.029 E/AndroidRuntime( 1331):     . 10 more
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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] Why there is an error when I doing unit test with ActivityInstrumentationTestCase2?

2009-08-23 Thread android.bu...@gmail.com

I am using ActivityInstrumentationTestCase2 to do some test for an
activity.
I get a button in the setUp() method like this:
protected void setUp() throws Exception {
super.setUp();
act = getActivity();

btn = (Button)act.findViewById( R.id.bike_button ); // this
button has been defined in layout
 }
Then I use this button to perform a click in a test method like this:
public void testBikeButton(){
  //click the bike button
  btn.performClick();
  ..
}
When run it as android junit, there will be an error like this:
android.view.ViewRoot$CalledFromWrongThreadException: Only the
original thread that created a view hierarchy can touch its views.
at android.view.ViewRoot.checkThread(ViewRoot.java:2440)
at android.view.ViewRoot.playSoundEffect(ViewRoot.java:2261)
at android.view.View.playSoundEffect(View.java:7457)
at android.view.View.performClick(View.java:2178)
at com.liufeng.vehicle.test.BikeTests.testBikeButton(BikeTests.java:
40)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.InstrumentationTestCase.runMethod
(InstrumentationTestCase.java:191)
at android.test.InstrumentationTestCase.runTest
(InstrumentationTestCase.java:181)
at android.test.ActivityInstrumentationTestCase2.runTest
(ActivityInstrumentationTestCase2.java:175)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:164)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:151)
at android.test.InstrumentationTestRunner.onStart
(InstrumentationTestRunner.java:418)
at android.app.Instrumentation$InstrumentationThread.run
(Instrumentation.java:1520)

How do I fix 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: disable HOME key and right soft key

2009-08-23 Thread Dan Sherman
Please read the signature at the bottom of every message explaining how to
unsubscribe!

On Sun, Aug 23, 2009 at 10:02 PM, Hristo Yordanov me4ta...@gmail.comwrote:

 Please unsubscribe me!


 


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



[android-developers] Re: different images for imagebutton states...

2009-08-23 Thread Marc Lester Tan
in your res/drawable folder, put an xml that contains (sample.xml):

?xml version=1.0 encoding=utf-8?
selector xmlns:android=http://schemas.android.com/apk/res/android;
item android:state_focused=true android:state_pressed=false
android:drawable=@drawable/focused /
item android:state_focused=true android:state_pressed=true
android:drawable=@drawable/focusedpressed /
item android:state_focused=false android:state_pressed=true
android:drawable=@drawable/pressed /
item android:drawable=@drawable/defaultbutton /
/selector

then on your button, use this xml as your background.
(background=@drawable/sample)


check out this tutorial from anddev.org about selectors

http://www.anddev.org/tinytutcustom_button_backgrounds-better_imagebutton-t4298.html

-Marc


On Sun, Aug 23, 2009 at 3:13 PM, sdphil phil.pellouch...@gmail.com wrote:


 how do I specify different images for an ImageButton when the state
 changes (i.e. pressed).

 ImageButton android:id=@+id/Btn1
 android:layout_width=wrap_content
 android:layout_height=wrap_content
 android:src=@drawable/btn1
 android:background=@color/transparent/

 In a standard button the color changes to orange when pressed, I'd
 like to change a custom image button with a different image.

 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: disable HOME key and right soft key

2009-08-23 Thread Shang Hao

Hi Roman,

Accepted that I cannot play around with these keys from apps...But
there must be a way somewhere where they must be getting handledi
just need to broadcast and make these keys handling ineffective/
effective Can u help me with the files which i should be looking
for

Thanks.

On Aug 23, 7:42 pm, Romain Guy romain...@google.com wrote:
 You cannot disabled these keys from an application.



 On Sun, Aug 23, 2009 at 6:53 PM, Shang Haosahilz...@gmail.com wrote:

  Hi Mark,

  Thanks for your reply.. I actually meant the home key and the End call
  button on the device. For home key i have found a solution at
  PhoneWindowManager.java @framework Any idea about the End call
  button??

  Thanks.

  On Aug 22, 4:03 am, Mark Murphy mmur...@commonsware.com wrote:
  Shang Hao wrote:
   Hi,
   dis
   I m making a test application and want to able all keys excluding the
   back button.. Using below code i am not able to disable HOME key
   and right soft key. Please suggest what to do.

     �...@override
      public boolean onKeyDown(int keyCode, KeyEvent event) {
              if(keyCode == KeyEvent.KEYCODE_BACK){
                      return super.onKeyDown(keyCode, event);
              }
          else   {
                      return true;
              }

      }

  You cannot disable the home key, and Android does not have soft keys.

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

  _Beginning Android_ from Apress Now Available!

 --
 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: getting all the resources from other apks

2009-08-23 Thread Dianne Hackborn
Resources.getResourcePackageName(), Resources.getResourceTypeName(), and
Resources.getResourceEntryName() return the names associated with a resource
ID.  And by convention, you will get the type name layout for layout
resources, drawable for drawable, etc...  however, this is only a
convention, and nothing really enforces it.

On Sun, Aug 23, 2009 at 5:29 PM, Spektor Yaron spekt...@gmail.com wrote:

 Thanks again Dianne,
 i don't think your solution will do as i also need to know which class i am
 in (i need to know that 0x7f02 is a drawable and that 0x7f03 is a
 layout).
 Is it possible to get the information i need through the AssetManager? any
 way to hack into the binary data structure?
 if not i guess it is back to the drawing-board for me.


 On Mon, Aug 24, 2009 at 3:09 AM, Dianne Hackborn hack...@android.comwrote:

 Sorry but this just isn't something we have APIs for right now.  I don't
 recall anyone wanting to do this kind of thing before, so it hasn't been
 high on our priority list.

 Note that layout etc at the resource level are not really folder names
 -- they are just symbolic names for the part of the resource identifier
 integer that categorizes the resource.  The resource system itself revolves
 almost entirely around integer identifiers; the symbolic names are pretty
 much just there for the convenience of developers.  There is a big binary
 data structure in the .apk that is used to map from integer identifiers to
 the corresponding resource value (which may be stored directly inside the
 data structure for simple resources like integers and strings, or may be a
 path to another file in the .apk for things like xml data or images).

 You could probably hack something together by taking advantage of the
 current implementation detail that the resource system assigns resource
 identifiers in a sequential manner (sequentially incrementing the entry part
 and type part of the integer), to step through retrieving names until you
 get a resource not found exception.  However, I can't make any guarantees
 that this will work in the future.

 On Sun, Aug 23, 2009 at 3:44 PM, Spektor Yaron spekt...@gmail.comwrote:

 Hi again,
 just to verify that i am explaining myself correctly. my code takes all
 the relevant apk's based on the intent filter and wants to take all the
 resources from the \layout to later be able to inflate them.
 i get the package name (e.g.,com.android.demo.notepad2) from the
 returned resolveInfo and i know the folder name (e.g., layout etc.) all i
 need now is a method to get all the resources in something like:
 com.android.demo.notepad2:layout on a diffrent apk.
 thanks


 On Mon, Aug 24, 2009 at 12:18 AM, Spektor Yaron spekt...@gmail.comwrote:

 Hi,
 i know it is done somehow by other applications (for example adding new
 skins to an existing application w/o knowing the name of the layout ahead 
 of
 time)
 what am i missing here. is this not the way to do it?
 should i copy all resources to the file system and read them from there?
 would that make sense? would i be able to inflate a view with them this 
 way?
 Thanks,


 On Sun, Aug 23, 2009 at 6:44 PM, Dianne Hackborn 
 hack...@android.comwrote:

 I don't believe there is any way to do that from an application.  From
 a desktop, you can use the aapt dump commands to find out about the 
 contents
 of the .apk.


 On Sun, Aug 23, 2009 at 8:15 AM, Spektor Yaron spekt...@gmail.comwrote:

 Hi,
 i was able to play around with the resource on a different apk and get
 them using createPackageContext as you suggested.
 here is an example of the code:
 otherAppContext =
 this.createPackageContext(com.android.demo.notepad2,Context.CONTEXT_INCLUDE_CODE
 + Context.CONTEXT_IGNORE_SECURITY);
 int resID = otherAppContext.getResources().getIdentifier(icon,
 drawable, com.android.demo.notepad2);

 this works well.
 now i am trying to get ALL the drawables (or all the layouts) in this
 package. i tried a multitude of ways including reflection and 
 AssetManager
 but was unsuccessful. any tips here?
 just to be clear i can not use R.drawable.icon as this is a different
 context

 --
 Yaron Spektor





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






 --
 Yaron Spektor




 --
 Yaron Spektor





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






 --
 Yaron Spektor

 



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

Note: please don't send private questions to me, as I don't have 

[android-developers] Re: getting all the resources from other apks

2009-08-23 Thread Dianne Hackborn
I'm sorry, I thought you were just bringing up skins as an example.  The
platform currently doesn't support skinning, and when/if it ever does, it
will be done very differently than what you are describing here (rather
would probably be something like the approach I was describing before).  If
you want to implement some kind of skinning for your app, you are on your
own, and can do whatever you want.  And you really don't need to make this
hard -- for example you could just define the resource IDs that are in the
skin and what they should contain and not have to worry about any analysis
of the resources.

On Sun, Aug 23, 2009 at 5:15 PM, Spektor Yaron spekt...@gmail.com wrote:

 Thanks Dianne, i appreciate your help.
 firstly i am not even sure how to do the single skin version you suggested,
 unless i state that the resources names must not change which is something i
 am not eager to do.
 secondly, i was thinking (in terms of skins) to allow multiple skins at
 once. so the user selects one or more skins and can see them (lets say i
 have one default skin and then i click on a change skin button and change
 it to the next one in line).
 so my idea (and hopefully i will be able to post it here soon for everyone
 to use) was to take all the relevant apks based on the intent-filter, and
 show them to the user to be able to choose from, thus creating a list of
 skin, for this i need to load the resources for the drawable and the layout
 etc. (again, skins are just an example) from all the apks i got back from
 the search.
 as i said earlier, i may be missing something and there may be a much
 easier way to do it in android
 Thanks,
 Yaron


 On Mon, Aug 24, 2009 at 3:03 AM, Dianne Hackborn hack...@android.comwrote:

 I'm not sure what this has to do with skinning.  I don't know of any
 applications that scan for different resources for a skin; rather, you
 create a skin by replacing the existing (layout, drawable, etc) resource
 with a different one.


 On Sun, Aug 23, 2009 at 2:18 PM, Spektor Yaron spekt...@gmail.comwrote:

 Hi,
 i know it is done somehow by other applications (for example adding new
 skins to an existing application w/o knowing the name of the layout ahead of
 time)
 what am i missing here. is this not the way to do it?
 should i copy all resources to the file system and read them from there?
 would that make sense? would i be able to inflate a view with them this way?
 Thanks,

 On Sun, Aug 23, 2009 at 6:44 PM, Dianne Hackborn hack...@android.comwrote:

 I don't believe there is any way to do that from an application.  From a
 desktop, you can use the aapt dump commands to find out about the contents
 of the .apk.


 On Sun, Aug 23, 2009 at 8:15 AM, Spektor Yaron spekt...@gmail.comwrote:

 Hi,
 i was able to play around with the resource on a different apk and get
 them using createPackageContext as you suggested.
 here is an example of the code:
 otherAppContext =
 this.createPackageContext(com.android.demo.notepad2,Context.CONTEXT_INCLUDE_CODE
 + Context.CONTEXT_IGNORE_SECURITY);
 int resID = otherAppContext.getResources().getIdentifier(icon,
 drawable, com.android.demo.notepad2);

 this works well.
 now i am trying to get ALL the drawables (or all the layouts) in this
 package. i tried a multitude of ways including reflection and AssetManager
 but was unsuccessful. any tips here?
 just to be clear i can not use R.drawable.icon as this is a different
 context

 --
 Yaron Spektor





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






 --
 Yaron Spektor





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






 --
 Yaron Spektor

 



-- 
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] Adding Threshold to Bitmap Images

2009-08-23 Thread Abdul Mateen
Hi,
I have a question about adding a threshold images into bitmap images, can
this be possible with the Android SDK, if not can anyone here generate the
Algorithm for that to add threshold to images.

Thank You,
Abdul Mateen.

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



[android-developers] Re: disable HOME key and right soft key

2009-08-23 Thread Dianne Hackborn
You already said it, PhoneWindowManager is what handles the keys.

On Sun, Aug 23, 2009 at 9:53 PM, Shang Hao sahilz...@gmail.com wrote:


 Hi Roman,

 Accepted that I cannot play around with these keys from apps...But
 there must be a way somewhere where they must be getting handledi
 just need to broadcast and make these keys handling ineffective/
 effective Can u help me with the files which i should be looking
 for

 Thanks.

 On Aug 23, 7:42 pm, Romain Guy romain...@google.com wrote:
  You cannot disabled these keys from an application.
 
 
 
  On Sun, Aug 23, 2009 at 6:53 PM, Shang Haosahilz...@gmail.com wrote:
 
   Hi Mark,
 
   Thanks for your reply.. I actually meant the home key and the End call
   button on the device. For home key i have found a solution at
   PhoneWindowManager.java @framework Any idea about the End call
   button??
 
   Thanks.
 
   On Aug 22, 4:03 am, Mark Murphy mmur...@commonsware.com wrote:
   Shang Hao wrote:
Hi,
dis
I m making a test application and want to able all keys excluding
 the
back button.. Using below code i am not able to disable HOME key
and right soft key. Please suggest what to do.
 
   @Override
   public boolean onKeyDown(int keyCode, KeyEvent event) {
   if(keyCode == KeyEvent.KEYCODE_BACK){
   return super.onKeyDown(keyCode, event);
   }
   else   {
   return true;
   }
 
   }
 
   You cannot disable the home key, and Android does not have soft keys.
 
   --
   Mark Murphy (a Commons Guy)http://commonsware.com|
 http://twitter.com/commonsguy
 
   _Beginning Android_ from Apress Now Available!
 
  --
  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
 



-- 
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: disable HOME key and right soft key

2009-08-23 Thread Keiji Ariyama

Hi Shang,

You can use END_BUTTON_BEHAVIOR setting in Settings.System.

Android Developers
http://developer.android.com/reference/android/provider/Settings.System.html#END_BUTTON_BEHAVIOR

What happens when the user presses the end call button if they're not on 
a call.
Values:
0 - The end button does nothing.
1 - The end button goes to the home screen.
2 - The end button puts the device to sleep and locks the keyguard.
3 - The end button goes to the home screen. If the user is already on 
the home screen, it puts the device to sleep.

Cheers,
Keiji

Dianne Hackborn wrote:
 You already said it, PhoneWindowManager is what handles the keys.
 
 On Sun, Aug 23, 2009 at 9:53 PM, Shang Hao sahilz...@gmail.com 
 mailto:sahilz...@gmail.com wrote:
 
 
 Hi Roman,
 
 Accepted that I cannot play around with these keys from apps...But
 there must be a way somewhere where they must be getting handledi
 just need to broadcast and make these keys handling ineffective/
 effective Can u help me with the files which i should be looking
 for
 
 Thanks.
 
 On Aug 23, 7:42 pm, Romain Guy romain...@google.com
 mailto:romain...@google.com wrote:
   You cannot disabled these keys from an application.
  
  
  
   On Sun, Aug 23, 2009 at 6:53 PM, Shang Haosahilz...@gmail.com
 mailto:sahilz...@gmail.com wrote:
  
Hi Mark,
  
Thanks for your reply.. I actually meant the home key and the
 End call
button on the device. For home key i have found a solution at
PhoneWindowManager.java @framework Any idea about the End call
button??
  
Thanks.
  
On Aug 22, 4:03 am, Mark Murphy mmur...@commonsware.com
 mailto:mmur...@commonsware.com wrote:
Shang Hao wrote:
 Hi,
 dis
 I m making a test application and want to able all keys
 excluding the
 back button.. Using below code i am not able to disable
 HOME key
 and right soft key. Please suggest what to do.
  
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if(keyCode == KeyEvent.KEYCODE_BACK){
return super.onKeyDown(keyCode, event);
}
else   {
return true;
}
  
}
  
You cannot disable the home key, and Android does not have
 soft keys.
  
--
Mark Murphy (a Commons
 Guy)http://commonsware.com|http://twitter.com/commonsguy
  
_Beginning Android_ from Apress Now Available!
  
   --
   Romain Guy
   Android framework engineer
   romain...@android.com mailto: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
 
 
 
 
 -- 
 Dianne Hackborn
 Android framework engineer
 hack...@android.com mailto: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.
 
 
  

-- 
Keiji,
ml_andr...@c-lis.co.jp

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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 with Dialog theme when launching from another activity

2009-08-23 Thread ANKIT SOMANI
Hi all,

I am facing a strange problem. I have 2 activities.  The Second activity
having the theme.Dialog (set in manifest). when I launched the second
activity from first activity via startActivityforResult(). The Second
activity is not Visible. When i minimize it  launched it again then its
showing.

ahere are my 2 classes.

Activity 1 :

package com.startActivityTest;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

public class StartActivityTest extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = new Intent();

setContentView(R.layout.main);


intent.setClassName(com.startActivityTest,com.startActivityTest.StartActivityTest1);


startActivityForResult(intent,1);

}
}

Activity 2 :

package com.startActivityTest;

import android.app.Activity;
import android.os.Bundle;

public class StartActivityTest1 extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main2);
}
}



main.xml


?xml version=1.0 encoding=utf-8?
LinearLayout xmlns:android=http://schemas.android.com/apk/res/android;
android:orientation=vertical
android:layout_width=fill_parent
android:layout_height=fill_parent

TextView
android:layout_width=fill_parent
android:layout_height=wrap_content
android:text=Activity 1
/
/LinearLayout


main2.xml

?xml version=1.0 encoding=utf-8?
LinearLayout xmlns:android=http://schemas.android.com/apk/res/android;
android:orientation=vertical
android:layout_width=fill_parent
android:layout_height=fill_parent

TextView
android:layout_width=fill_parent
android:layout_height=wrap_content
android:text=Dialog Activity
/
/LinearLayout


AndroidManifest.xml

?xml version=1.0 encoding=utf-8?
manifest xmlns:android=http://schemas.android.com/apk/res/android;
  package=com.startActivityTest
  android:versionCode=1
  android:versionName=1.0
application android:icon=@drawable/icon
android:label=@string/app_name
activity android:name=.StartActivityTest
  android:label=Launcher Acitivity
intent-filter
action android:name=android.intent.action.MAIN /
category android:name=android.intent.category.LAUNCHER /
/intent-filter
/activity

activity android:name=.StartActivityTest1
android:theme=@android:style/Theme.Dialog
  android:label=Dialog Activity
intent-filter
action android:name=android.intent.action.MAIN /
category android:name=android.intent.category.DEFAULT /
/intent-filter
/activity

/application
uses-sdk android:minSdkVersion=3 /
/manifest


please suggest any solution or correct me if i am wrong.

Thanks in Advance.

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



[android-developers] ADC2 deadline

2009-08-23 Thread rizwan

Hi ,

can anyone from Google let us know the exact date of submission of
ADC2 Applications. or Google is extending date . I m very much curious
about it . please let us know.

Thanks
Rizwan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
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] Countries for selling priced applications in Android Market

2009-08-23 Thread Michael Leung
Hi,
  That is near the end of Q3 now. Does anyone know whether there will be a
new list of Countries for selling priced applications in Android Market?

-- 
Regards,
Michael Leung
http://www.itblogs.info
http://www.michaelleung.info

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