[android-developers] Re: java.io.FileNotFoundException: (Device or resource busy)

2011-05-28 Thread Menion
similar problem for me!

I extract one zip file. This is done fine. When I delete extracted
directory and want to extract another file, it throw same error!

On 9 kvě, 19:00, faah  wrote:
> Can someone tell me how to handle "Device or resource busy" error? Or
> how to fix it?
>
> On May 6, 2:51 pm, faah  wrote:
>
>
>
>
>
>
>
> > On the 3.0 honeycomb, I am getting this error when trying to access a
> > file. It does not happen all the time. What causes is that I browse
> > around the market a bit and then i come back to my app. It tries to
> > access a file, and i get this error:
>
> > Exception caught in com.app.android.activities.Preview$DLTask: /mnt/
> > sdcard/tmp/1304702202502.jpg (Device orresourcebusy)
> > java.io.FileNotFoundException: /mnt/sdcard/tmp/1304702202502.jpg
> > (Device orresourcebusy)
> > at org.apache.harmony.luni.platform.OSFileSystem.open(Native Method)
> > at dalvik.system.BlockGuard$WrappedFileSystem.open(BlockGuard.java:
> > 239)
> > at java.io.FileOutputStream.(FileOutputStream.java:101)
> > at java.io.FileOutputStream.(FileOutputStream.java:77)
> > at com.app.android.activities.Preview
> > $DLTask.doInBackground(Preview.java:200)
> > at com.app.android.activities.Preview
> > $DLTask.doInBackground(Preview.java:1)
> > at com.app.android.activities.appAsyncTask$2.call(appAsyncTask.java:
> > 176)
> > at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
> > at java.util.concurrent.FutureTask.run(FutureTask.java:137)
> > at
> > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:
> > 1081)
> > at java.util.concurrent.ThreadPoolExecutor
> > $Worker.run(ThreadPoolExecutor.java:574)
> > at java.lang.Thread.run(Thread.java:1020)
>
> > To get the same code working again after I restart the device, i.e.
> > power off/on.
>
> > The same code works fine on the android version 7, but at times it
> > crashes on v11.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Paint single Path object with Xfermode

2011-03-16 Thread Menion
Looks that this really have no solution other, then separate Path
object every cca 100m to gain effect of darker color when path is
overlay one over another. Thanks anyway ...

On Mar 14, 12:37 pm, Menion  wrote:
> As I expect, wrong description. Sorry
>
> Once more. On this screenshot is what I'll 
> describehttp://locus.asamm.cz/data/screenshot02.png
>
> 1. I have one Path object with a complex path (as I walked and
> recorded path with GPS).
>
> 2. I draw this one Path object on canvas with
> c.drawPath(path, paint);
>
> where paint is Stroke, semi-transparent blue, width variable (now cca
> 50px)
>
> 3. I also draw second time same Path object with simple slim black
> color, 1px width, to see exact way I walked.
>
> You can on screenshot see, that all places have same blue color, even
> when on same place is path more then once. Clear? Xfer as I tested
> have no influence on this. It only works when I for example separate
> whole path object into more path objects, then color overlay work and
> on places where is more then one line, blue is darker. But it's really
> weird solution, manually separate path on straight lines.
>
> Is there anything I'm missing? Thank you for time to read this!
>
> On Mar 14, 10:10 am, Romain Guy  wrote:
>
> > It's not clear what your problem is? You can draw a Path and apply an
> > xfermode while drawing it.
>
> > On Mon, Mar 14, 2011 at 1:50 AM, Menion  wrote:
> > > Hmm, looks that no one have answer. Is problem that my question is not
> > > understandable or here is no simple solution?
>
> > > On Mar 13, 1:19 pm, Menion  wrote:
> > > > Hi,
> > > >   I have one path object (for example recorded track). I'm drawing it
> > > > on canvas. When I set semi-transparent color to paint object, whole
> > > > path is colored like this.
>
> > > >  This is correct. Imagine that you was walking on some rectangle area
> > > > from one side to another, few times you were on same place. And want
> > > > to draw this path in same way you're drawing single lines, so you can
> > > > see places where you were more then once darker then others (because
> > > > line is draw there more then once).
>
> > > >  Anyway path object draw all areas with same color and because it's
> > > > only one object, Xfermode PorterDuffXfermode(PorterDuff.Mode.DARKEN)
> > > > have no effect on it. I hope you understand what I want.
>
> > > >  And I don't want to use only drawing single lines, because track
> > > > width should be for example 100px. Nice example is herehttp://
> > > locus.asamm.cz/data/1300018457960.png. This is created with
> > > > drawing single lines and I want to all path to be connected together
> > > > but with darker places on place where I walk more then one. Do you
> > > > have any tip for this or only to separate path into more pieces?
>
> > > >   thanks guys!
>
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to android-developers@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > android-developers+unsubscr...@googlegroups.com
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
>
> > --
> > 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: Dynamically Resize Images for different Android devices

2011-03-14 Thread Menion
I'm using something like this ...

public static Bitmap resizeBitmap(Bitmap draw, int newWidth) {
if (draw == null || newWidth <= 0 || draw.getWidth() == newWidth)
return draw;

int newHeight = (int) (newWidth * draw.getHeight() /
draw.getWidth());
return Bitmap.createScaledBitmap(draw, newWidth, newHeight, true);
}

On Mar 14, 11:49 am, monty  wrote:
> Hi All
>     My issue is simple.I want to use one set of images which can be
> used on mobile as well as tablets.I have a image of size 690 by 400 .i
> want to use this image and resize it programmatically and have this
> resized image displayed on mobiles.
>    Could anyone please give an idea on how to accomplish this?This is
> bcoz if i use different set of images it will increase the size of
> "apk".

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Paint single Path object with Xfermode

2011-03-14 Thread Menion
As I expect, wrong description. Sorry

Once more. On this screenshot is what I'll describe
http://locus.asamm.cz/data/screenshot02.png

1. I have one Path object with a complex path (as I walked and
recorded path with GPS).

2. I draw this one Path object on canvas with
c.drawPath(path, paint);

where paint is Stroke, semi-transparent blue, width variable (now cca
50px)

3. I also draw second time same Path object with simple slim black
color, 1px width, to see exact way I walked.

You can on screenshot see, that all places have same blue color, even
when on same place is path more then once. Clear? Xfer as I tested
have no influence on this. It only works when I for example separate
whole path object into more path objects, then color overlay work and
on places where is more then one line, blue is darker. But it's really
weird solution, manually separate path on straight lines.

Is there anything I'm missing? Thank you for time to read this!



On Mar 14, 10:10 am, Romain Guy  wrote:
> It's not clear what your problem is? You can draw a Path and apply an
> xfermode while drawing it.
>
>
>
> On Mon, Mar 14, 2011 at 1:50 AM, Menion  wrote:
> > Hmm, looks that no one have answer. Is problem that my question is not
> > understandable or here is no simple solution?
>
> > On Mar 13, 1:19 pm, Menion  wrote:
> > > Hi,
> > >   I have one path object (for example recorded track). I'm drawing it
> > > on canvas. When I set semi-transparent color to paint object, whole
> > > path is colored like this.
>
> > >  This is correct. Imagine that you was walking on some rectangle area
> > > from one side to another, few times you were on same place. And want
> > > to draw this path in same way you're drawing single lines, so you can
> > > see places where you were more then once darker then others (because
> > > line is draw there more then once).
>
> > >  Anyway path object draw all areas with same color and because it's
> > > only one object, Xfermode PorterDuffXfermode(PorterDuff.Mode.DARKEN)
> > > have no effect on it. I hope you understand what I want.
>
> > >  And I don't want to use only drawing single lines, because track
> > > width should be for example 100px. Nice example is herehttp://
> > locus.asamm.cz/data/1300018457960.png. This is created with
> > > drawing single lines and I want to all path to be connected together
> > > but with darker places on place where I walk more then one. Do you
> > > have any tip for this or only to separate path into more pieces?
>
> > >   thanks guys!
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> 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: Paint single Path object with Xfermode

2011-03-14 Thread Menion
Hmm, looks that no one have answer. Is problem that my question is not
understandable or here is no simple solution?

On Mar 13, 1:19 pm, Menion  wrote:
> Hi,
>   I have one path object (for example recorded track). I'm drawing it
> on canvas. When I set semi-transparent color to paint object, whole
> path is colored like this.
>
>  This is correct. Imagine that you was walking on some rectangle area
> from one side to another, few times you were on same place. And want
> to draw this path in same way you're drawing single lines, so you can
> see places where you were more then once darker then others (because
> line is draw there more then once).
>
>  Anyway path object draw all areas with same color and because it's
> only one object, Xfermode PorterDuffXfermode(PorterDuff.Mode.DARKEN)
> have no effect on it. I hope you understand what I want.
>
>  And I don't want to use only drawing single lines, because track
> width should be for example 100px. Nice example is 
> herehttp://locus.asamm.cz/data/1300018457960.png. This is created with
> drawing single lines and I want to all path to be connected together
> but with darker places on place where I walk more then one. Do you
> have any tip for this or only to separate path into more pieces?
>
>   thanks guys!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Paint single Path object with Xfermode

2011-03-14 Thread Menion
Hmm, looks that no one have answer. Is problem that my question is not
understandable or here is no simple solution?

On Mar 13, 1:19 pm, Menion  wrote:
> Hi,
>   I have one path object (for example recorded track). I'm drawing it
> on canvas. When I set semi-transparent color to paint object, whole
> path is colored like this.
>
>  This is correct. Imagine that you was walking on some rectangle area
> from one side to another, few times you were on same place. And want
> to draw this path in same way you're drawing single lines, so you can
> see places where you were more then once darker then others (because
> line is draw there more then once).
>
>  Anyway path object draw all areas with same color and because it's
> only one object, Xfermode PorterDuffXfermode(PorterDuff.Mode.DARKEN)
> have no effect on it. I hope you understand what I want.
>
>  And I don't want to use only drawing single lines, because track
> width should be for example 100px. Nice example is 
> herehttp://locus.asamm.cz/data/1300018457960.png. This is created with
> drawing single lines and I want to all path to be connected together
> but with darker places on place where I walk more then one. Do you
> have any tip for this or only to separate path into more pieces?
>
>   thanks guys!

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


[android-developers] Paint single Path object with Xfermode

2011-03-13 Thread Menion
Hi,
  I have one path object (for example recorded track). I'm drawing it
on canvas. When I set semi-transparent color to paint object, whole
path is colored like this.

 This is correct. Imagine that you was walking on some rectangle area
from one side to another, few times you were on same place. And want
to draw this path in same way you're drawing single lines, so you can
see places where you were more then once darker then others (because
line is draw there more then once).

 Anyway path object draw all areas with same color and because it's
only one object, Xfermode PorterDuffXfermode(PorterDuff.Mode.DARKEN)
have no effect on it. I hope you understand what I want.

 And I don't want to use only drawing single lines, because track
width should be for example 100px. Nice example is here
http://locus.asamm.cz/data/1300018457960.png. This is created with
drawing single lines and I want to all path to be connected together
but with darker places on place where I walk more then one. Do you
have any tip for this or only to separate path into more pieces?

  thanks guys!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: searching in HUGE SQLite database

2011-01-15 Thread Menion
that's not true. As I wrote, I cannot change structure of database,
but i did my own test and indexes as are

PRIMARY KEY (x, y, z, s)

are almost twice faster for query on single row by x, y, z values (for
reading and mainly for writing), then classic ID

INTEGER PRIMARY KEY

I'm not database expert, but this are measured values!

and finally, for me, in this case, speed is not primary! Problem is
that I cannot use database bigger then 2GB.
But, problem is solved as I wrote in my previous post.

Thanks all very much for you time and if anyone of you is Locus user -
Sorry, but more then 2GB bigger maps, aren't allowed now :)

On Jan 15, 8:55 am, Frank Weiss  wrote:
> As I recall, there were no indexes on the table. Without indexes I would
> expect most every query on a very table to be very slow.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: searching in HUGE SQLite database

2011-01-14 Thread Menion
Hi guys
 thanks for your big help!

so after I read all answers there is only one solution for me! Deny
users to have database bigger then 2GB!

why?
  because structure of database cannot be change. It's something like
"standart" so I have to use it as is! I just wanted to know, if exist
any SQL query, that help me to get some data with slower speed but
without crash. Nevermind, I just, when find this big database on
filesystem, I'll "Toast" user message that this is not allowed!

thank you very much!

On Jan 15, 3:29 am, DanH  wrote:
> It won't do any good to break the table into smaller tables in the
> same database.  SQLite throws all the tables into one large pool that
> it manages as a single "heap", so you still get offsets as large as
> the overall database size.
>
> You'd have to put the different tables into different database files.
>
> On Jan 14, 7:37 pm, asierra01  wrote:
>
> >   What you have is a database/dba issue not an android issue
>
> >   Lets say you have 1 database ( may be with 1 table 8G in size)
> >   BRAKE the database in
> >   1 Table that will hold some kind description (metadata) of what the
> > BIG01, BIG02, BIG03, BIG04 tables have
> >      BIG1, BIG2, BIG3...,BIG99 will have at most 100K records , lets
> > say and will potentially be as big as 100MB? 300M ? in size or less
> >      This table will have three fields (first_rec_key, last_rec_key,
> > table name)
> >      Table1->
> >           (0, 5,'BIG1')
> >           (51, 100, 'BIG2')
> >           (101, 40, 'BIG3')
> >           
> >           (80, 900, 'BIG78')
> >     you start by looking in this table that only has 100 records
> >    it will tell you the key you need is in BIG56, which is 100M,
> >    now you use your current method of finding your record, just
> > instead of looking on 2GB table
> >    you look into 100M or 300M BIG56 table.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: searching in HUGE SQLite database

2011-01-14 Thread Menion
only one info

database 1.8GB works fine

database 2.5GB do not work!

On Jan 14, 4:44 pm, Menion  wrote:
> nono, data aren't corrupted
>
> when I use SQLite Database Browser 2.0b1 (desktop software) all SQL
> string done fine, just takes a too much time too. This database is
> user database with map tiles. Same can be created in application but
> this tests are done only on READ_ONLY opened database!
>
> In my case it's problem thanks to size of database, when I create same
> but only 1GB big, all works fine. I'm mainly asking if you don't know
> any other SQL command that check and return Z values for me.
>
> I also tried
>
>                         int minZoom = 8;
>                         int maxZoom = 29;
>                         ArrayList testZooms = new 
> ArrayList();
>                         for (int i = maxZoom; i >= minZoom; i--) {
>                                 int testZoom = 25 - i;
>                                 Cursor cursor = 
> sql.query(SqLiteCache.SQL_TABLE_TILES, null,
>                                                 SqlTableTilesColumns.Z + "==" 
> + testZoom,
>                                                 null, null, null, null, "1");
>                                 if (cursor.getCount() == 1) {
>                                         // zoom exist
>                                         testZooms.add(i);
>                                 }
>                                 cursor.close();
>                         }
>
> that should test every available zoom but it's the same.
>
> hope you understand me :)
>
> thanks guys
> On Jan 14, 3:47 pm, Marcin Orlowski  wrote:
>
> > On 14 January 2011 15:24, Menion  wrote:
>
> > > I'm testing on one big database, more then 2GB (stored on SD card of
> > > have you please any tip how to solve this??
>
> > Maybe consider moving your DB to external machine and exposing via any API.
> > Depending on the purspose, how often data is updated/queried etc it might
> > have sense

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: searching in HUGE SQLite database

2011-01-14 Thread Menion
nono, data aren't corrupted

when I use SQLite Database Browser 2.0b1 (desktop software) all SQL
string done fine, just takes a too much time too. This database is
user database with map tiles. Same can be created in application but
this tests are done only on READ_ONLY opened database!

In my case it's problem thanks to size of database, when I create same
but only 1GB big, all works fine. I'm mainly asking if you don't know
any other SQL command that check and return Z values for me.

I also tried

int minZoom = 8;
int maxZoom = 29;
ArrayList testZooms = new ArrayList();
for (int i = maxZoom; i >= minZoom; i--) {
int testZoom = 25 - i;
Cursor cursor = 
sql.query(SqLiteCache.SQL_TABLE_TILES, null,
SqlTableTilesColumns.Z + "==" + 
testZoom,
null, null, null, null, "1");
if (cursor.getCount() == 1) {
// zoom exist
testZooms.add(i);
}
cursor.close();
}

that should test every available zoom but it's the same.

hope you understand me :)

thanks guys
On Jan 14, 3:47 pm, Marcin Orlowski  wrote:
> On 14 January 2011 15:24, Menion  wrote:
>
> > I'm testing on one big database, more then 2GB (stored on SD card of
> > have you please any tip how to solve this??
>
> Maybe consider moving your DB to external machine and exposing via any API.
> Depending on the purspose, how often data is updated/queried etc it might
> have sense

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


[android-developers] searching in HUGE SQLite database

2011-01-14 Thread Menion
Hi,
  this was already discussed here, but I have another problem with
database search.

I'm testing on one big database, more then 2GB (stored on SD card of
course) with around 1 million of rows in table 'tiles'. Database
contain X, Y, Z coordinates as INT (map index) and byte[] image data.

database is created with this SQLite string which cannot be changed!
CREATE TABLE tiles (x INTEGER,y INTEGER,z INTEGER,s INTEGER,image
BYTE, PRIMARY KEY (x, y, z, s));

And all I want is to get all available Z values in database like by
this
SELECT DISTINCT z FROM tiles

But after around 5 minutes of loading (time isn't problem here) logcat
return
  android.database.sqlite.SQLiteDiskIOException: disk I/O error

have you please any tip how to solve this??

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


[android-developers] Re: How to create Android library in Eclipse?

2010-05-03 Thread Menion
You say that sharing resources between projects is coming? Hopefully,
thx for very, very good info :)

On May 3, 11:34 pm, Xavier Ducrohet  wrote:
> If you're code is straight java with no android resources then just
> create a Java project and reference it by your Android projects.
>
> Android libraries allowing you to share (android specific) code and
> resources between projects is not supported at the moment, but it's
> coming.
>
> Shared libraries are not supported at this time by the platform and I
> don't think there's any plan for it.
>
> Xav
>
> 2010/5/3 Rafał Grzybowski :
>
>
>
> > I'm working on two android applications and would like to share some
> > code between them. My guess is I need to create Java library and put
> > all the required code there. But I don't know:
> >  - what kind of project create for the library in Eclipse,
> >  - does the shared library can contain Android resources,
> >  - what about AndroidManifest.xml for the library, is it possible to
> > have one,
> >  - is it possible to deploy shared library once on the device or is
> > it shareable during development and then deployed per Android
> > application?
>
> > Thank you.
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Xavier Ducrohet
> Android SDK Tech Lead
> Google Inc.
>
> Please do not send me questions directly. 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 
> athttp://groups.google.com/group/android-developers?hl=en

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


[android-developers] Re: Clear defaults programmatically

2010-04-18 Thread Menion
I'm using this code ... hope it helps

PreferenceManager.getDefaultSharedPreferences(context).edit().clear().commit();

On Apr 16, 11:09 am, Bonifaz  wrote:
> Does anyone know
> how to clear defaults of my own app by code.
>
> I know that a user can always go to Manage Applications, find my app
> and click the button there to clear previously assigned default
> actions. But for most users this isn't intuitive at all.
>
> I would like to offer my customers a solution to clear defaults within
> my own app if they don't like to use my app as a replacement for a
> specific action anymore.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en

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


[android-developers] Re: Performance comparison NDK vs SDK

2010-04-07 Thread Menion
I'm doing some little research school project, together with learning
basics of C++ (thanks to JNI) and here is some simple example ...

Java function:
---
public double doClickAction04J() {
  double x = 45.0 / (180.0 / Math.PI);
  double result = 0.5;
  for (int i = 0; i < 100; i++) {
result += Math.pow(Math.cos(x), 2.0);
result -= Math.pow(Math.sin(x), 2.0);
result = Math.log(result);
result = Math.exp(result);
  }
  return result;
}

and C code

JNIEXPORT jdouble JNICALL
Java_menion_android_jnitest_Main_doClickAction04C
  (JNIEnv *env, jclass thiz) {
double x = 45.0 / (180.0 / M_PI);
double result = 0.5;
int i;
for (i = 0; i < 100; i++) {
result += pow(cos(x), 2.0);
result -= pow(sin(x), 2.0);
result = log(result);
result = exp(result);
}
return result;
}


and the results?
Java: 5250ms
C :   1600ms

I then enabled experimental version of JIT compilator (in 2.1-r1
system) and new results
Java: 4700ms
C :   1600ms

so ... these are facts. I'm not really experienced with C, but this
seems for me as very objective test.


On Apr 7, 6:26 pm, Ralf Schneider  wrote:
> There exists  (GL_UNSIGNED_SHORT_4_4_4_4) Textures.
> May be this helps a litle bit.
>
> I'm not sure but switching to VBOs might not bring an improvement.
> My observation on a Nexus One is: VBOs are great if there are many tris
> (>250) to render per call. For billboards it really doesn't matter that
> match.
> But I don't have any hard numbers this is just an observation on a specific
> device.
>
> Many have observed most devices are currently fill-rate-limited. So, if you
> have lots of overdraw it might be worth checking if you can reduce it.
>
> 2010/4/7 MrChaz 
>
> > 100 is a low estimate but it's around that point that the frame-rate
> > seems to get into the sub 30's.
> > I'm already doing pretty much everything you've mentioned except using
> > VBOs - most sprites are rendered via the draw_texture extension.
> > Unfortunately pretty much all the sprites have some transparency so
> > I'm using ARGB_ for the texture atlas's.
>
>

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

To unsubscribe, reply using "remove me" as the subject.


[android-developers] Re: restarting the application

2010-03-30 Thread Menion
Hi Asik
  I'm trying to find solutin for similar problem, how to restart an
application. Your slution is "little funny" but functional of course.
In my code, to force close app I use this

In my main activity I call
[code]
ActivityManager aM = (ActivityManager)
getApplicationContext().getSystemService(ACTIVITY_SERVICE);

// Setup one-short alarm to restart my application in 3 seconds - TODO
need use another context
AlarmManager alarmMgr = (AlarmManager)
getSystemService(Context.ALARM_SERVICE);
Intent intent = new Intent(Const.SMARTMAPS_SCREEN_PATH);
PendingIntent pi = PendingIntent.getBroadcast(Main.this, 0, intent,
PendingIntent.FLAG_ONE_SHOT);
alarmMgr.set(AlarmManager.ELAPSED_REALTIME, System.currentTimeMillis()
+ 3000, pi);

aM.restartPackage(getPackageName());
finish();
[/code]

unfortunatelly AlarmManager do not work, and as I wrote as comment, I
think that is needed to use some Intent independent on application.
But any help will be appreciated- But rest of code (part with
activityManager) works and have for me same effect that your force
close (but without error message of course).

Hope this helps

On Mar 30, 7:48 am, Asif k  wrote:
> Hi All,
>
>   I have kept the title bar in my application. But I have also given
> an option in the menu to invisible title bar. If someone clicks that
> menu option then my application need to restart and clear all the
> activities from the task.
>
>   For time being, I had thrown an unhandled exception menually using
> following code,
> ***
> after clicking " no title bar" option
> String s = "hello"
> char c = s.charAt(10); // this line throw the exection which is not
> handled, so app. restarts
>
>  Thus " application stopped dialog" comes and after clicking " force
> close button app. restarts and settings are applicable.
>
>   But is there any android APIs availble which will restart the
> application clearing all the activity on the task and moves back to
> root activity.
>
> Thanks,
> Asif

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

To unsubscribe, reply using "remove me" as the subject.


[android-developers] Re: restarting the application

2010-03-30 Thread Menion
Hi Asik
  I'm trying to find solutin for similar problem, how to restart an
application. Your slution is "little funny" but functional of course.
In my code, to force close app I use this

In my main activity I call
[code]
ActivityManager aM = (ActivityManager)
getApplicationContext().getSystemService(ACTIVITY_SERVICE);

// Setup one-short alarm to restart my application in 3 seconds - TODO
need use another context
AlarmManager alarmMgr = (AlarmManager)
getSystemService(Context.ALARM_SERVICE);
Intent intent = new Intent(Const.SMARTMAPS_SCREEN_PATH);
PendingIntent pi = PendingIntent.getBroadcast(Main.this, 0, intent,
PendingIntent.FLAG_ONE_SHOT);
alarmMgr.set(AlarmManager.ELAPSED_REALTIME, System.currentTimeMillis()
+ 3000, pi);

aM.restartPackage(getPackageName());
finish();
[/code]

unfortunatelly AlarmManager do not work, and as I wrote as comment, I
think that is needed to use some Intent independent on application.
But any help will be appreciated- But rest of code (part with
activityManager) works and have for me same effect that your force
close (but without error message of course).

Hope this helps

On Mar 30, 7:48 am, Asif k  wrote:
> Hi All,
>
>   I have kept the title bar in my application. But I have also given
> an option in the menu to invisible title bar. If someone clicks that
> menu option then my application need to restart and clear all the
> activities from the task.
>
>   For time being, I had thrown an unhandled exception menually using
> following code,
> ***
> after clicking " no title bar" option
> String s = "hello"
> char c = s.charAt(10); // this line throw the exection which is not
> handled, so app. restarts
>
>  Thus " application stopped dialog" comes and after clicking " force
> close button app. restarts and settings are applicable.
>
>   But is there any android APIs availble which will restart the
> application clearing all the activity on the task and moves back to
> root activity.
>
> Thanks,
> Asif

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

To unsubscribe, reply using "remove me" as the subject.


[android-developers] Re: GPS Queueing in LocationListener

2010-03-25 Thread Menion
Hmm, did not see NMEA listener before, try to look now. Thanks. I'm
aware of Android limitations. But because I'm trying to do some
geodetic work with GPS (as my disertation project) I need to get raw
NMEA data. Thanks for answer, really appreciate it.

On Mar 25, 2:37 pm, mike  wrote:
> On 03/25/2010 01:07 AM, Menion wrote:
>
> > Hi guys,
> >    Mike, please, you wrote that you are pretty sure not to do some
> > direct processing of satellites ephemeris in Java. But my question is,
> > do you know some method (probably thanks to JNI) how to obtain direct
> > measure from GPS receiver? I have some imaginations to do
> > postprocessing comupation above these values in desktop pc, but
> > firstly I need to save them into some file. Thanks for answer.
>
> So this is only an educated guess -- remember that Android is
> just the OS, not a hardware spec -- but it looks to me that given
> that there is a NMEA listener in the API now that what's really
> going on under the hood is that they're using a GPS chipset and
> that those chipsets are, essentially, uarts hardwarewise. That is,
> they speak NMEA over a serial interface. The chipset I'm most
> familiar with is the MTK chipset (I have no idea if that's what
> some of the phones are using) has a limited set of commands it
> understands, and can give you a limited set of information
> back along with the normal position updates. What these commands
> and responses are don't seem to be especially standarized (they
> look like NMEA sentences, but they're proprietary).
>
> So the long and short of this is I doubt very seriously that you're
> going to find a low level interface to the raw data, and that even
> if there were an interface on one chipset, you wouldn't be guaranteed
> that it would work across the various phones.
>
> Mike
>
> > And for JFrog, I do same as Mike, just throw away measure that
> > accuracy is worst then your limit. This will filter biggest anomalies.
>
> > On Mar 23, 3:43 pm, mike  wrote:
>
> >> On 03/23/2010 07:23 AM, JFrog wrote:
>
> >>> Rough, yeah.  I'll have to look into the best way to throw out
> >>> inaccurate values.  Otherwise the application tends to look a bit ugly
> >>> (inertial navigation).  For instance, if I walk by a window while my
> >>> application is estimating movements on its own and happens to get a
> >>> gps signal for a moment or two, then all of a sudden I get one or two
> >>> inaccurate dots come on the screen and my estimated movement for where
> >>> the droid is will start at that new GPS location.
>
> >> I don't know what your app is, but for mine (tracking skiing/riding, etc)
> >> I just filter out points with horizontal accuracy>  100m. This works
> >> just fine for me because I'm interested in the overall dataset, but
> >> I'm not terribly real time sensitive. But I also do some post-processing
> >> to deal with outliers like looking for silly velocities and accelerations.
> >> I had looked into smoothing the data with Kalman filtering, but it
> >> turned out that it wasn't necessary even though it would probably
> >> do a pretty good job.
>
> >>> At first I thought perhaps I would throw away a couple of initial
> >>> values, but it doesn't seem as though there is a consistent number of
> >>> bad results before receiving a good one.  I'll see if there is a way
> >>> to wait for a fine grained result related to triggering the
> >>> onLocationChanged segment.  Perhaps I can even put up a range zone
> >>> around my estimated value, and as long as its close I can throw away
> >>> any GPS that fall outside that range.  That's my current thoughts.
>
> >> The hdop and vdop are your friends :) Google them as it's the
> >> GPS measures that eventually get translated into meter-based
> >> accuracy. The bad results are based on the satellite constellation
> >> at the time, where the GPS signal processing state is, and of
> >> course noise like multipath, etc. In normal terrestrial environs
> >> it's just a fact of life that the accuracy is going to better at some
> >> times than others. Adjust accordingly.
>
> >> Mike
>
> >>> Thanks for the input Mike.
>
>

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

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words "REMOVE ME" as the subject.


[android-developers] Re: GPS Queueing in LocationListener

2010-03-25 Thread Menion
Hi guys,
  Mike, please, you wrote that you are pretty sure not to do some
direct processing of satellites ephemeris in Java. But my question is,
do you know some method (probably thanks to JNI) how to obtain direct
measure from GPS receiver? I have some imaginations to do
postprocessing comupation above these values in desktop pc, but
firstly I need to save them into some file. Thanks for answer.

And for JFrog, I do same as Mike, just throw away measure that
accuracy is worst then your limit. This will filter biggest anomalies.

On Mar 23, 3:43 pm, mike  wrote:
> On 03/23/2010 07:23 AM, JFrog wrote:
>
> > Rough, yeah.  I'll have to look into the best way to throw out
> > inaccurate values.  Otherwise the application tends to look a bit ugly
> > (inertial navigation).  For instance, if I walk by a window while my
> > application is estimating movements on its own and happens to get a
> > gps signal for a moment or two, then all of a sudden I get one or two
> > inaccurate dots come on the screen and my estimated movement for where
> > the droid is will start at that new GPS location.
>
> I don't know what your app is, but for mine (tracking skiing/riding, etc)
> I just filter out points with horizontal accuracy > 100m. This works
> just fine for me because I'm interested in the overall dataset, but
> I'm not terribly real time sensitive. But I also do some post-processing
> to deal with outliers like looking for silly velocities and accelerations.
> I had looked into smoothing the data with Kalman filtering, but it
> turned out that it wasn't necessary even though it would probably
> do a pretty good job.
>
> > At first I thought perhaps I would throw away a couple of initial
> > values, but it doesn't seem as though there is a consistent number of
> > bad results before receiving a good one.  I'll see if there is a way
> > to wait for a fine grained result related to triggering the
> > onLocationChanged segment.  Perhaps I can even put up a range zone
> > around my estimated value, and as long as its close I can throw away
> > any GPS that fall outside that range.  That's my current thoughts.
>
> The hdop and vdop are your friends :) Google them as it's the
> GPS measures that eventually get translated into meter-based
> accuracy. The bad results are based on the satellite constellation
> at the time, where the GPS signal processing state is, and of
> course noise like multipath, etc. In normal terrestrial environs
> it's just a fact of life that the accuracy is going to better at some
> times than others. Adjust accordingly.
>
> Mike
>
> > Thanks for the input Mike.
>
>

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

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words "REMOVE ME" as the subject.


[android-developers] Re: selecting language from within the app rather than by locale of the system settings

2010-03-04 Thread Menion
next time, I'll try to read comments also :). Thank you very much, you
point me to finally working solution.

On Mar 4, 11:41 am, Adrian Vintu  wrote:
> Hi Menion,
>
> Yes, you have to set the locale in onCreate. It was written in the comments
> of the article.
>
> BR,
> Adrian Vintu
>
> http://adrianvintu.com
>
> On Thu, Mar 4, 2010 at 6:33 AM, Menion  wrote:
> > Hi Adrian,
> >  thanks for you response. Your code is very similar to mine. Only
> > base diference is that you use
> > Activity.getBaseContext().getResources() instead of mine used
> > Activity.getResources(). But this not help with my main problem.
> > Probably in your code, every display rotate call same
>
> > INFO/ActivityManager(1160): Config changed: { scale=1.0 imsi=230/3
> > loc=en_GB touch=3 keys=2/1/1 nav=2/1 orien=2 layout=34}
>
> > and after that, locale change to default.
>
> > but is seems that only solution is to call language change code in
> > every onCreate() in every activity. Little bit weird but cannot find
> > any other "permanent" solution.
>
> > On Mar 3, 10:38 pm, Adrian Vintu  wrote:
> > > Hope this will helphttp://
> > adrianvintu.com/blogengine/post/Force-Locale-on-Android.aspx
>
> > > BR,
> > > Adrian Vintu
>
> > >http://adrianvintu.com
>
> > > On Sat, Feb 27, 2010 at 3:09 PM, Menion  wrote:
> > > > Hi mot12,
> > > >  sorry not post earlier. I don't know, if you find my info still
> > > > useful ..., but
>
> > > > ad 1) Yes, it's my own function that check if user selected Czech or
> > > > English, so this return "cz" or "en" String.
>
> > > > ad 2) I didn't tried this. When user change locale in
> > > > PreferenceScreen, I force him to restart application. Changing of
> > > > application language is not a common activity, so restart is not a bad
> > > > solution I think :). But with your problem, it's relevant to my
> > > > another problem. Did you try set another locale (language) and then
> > > > rotate display? With my current solution, ActivityManager send this
> > > > event
>
> > > > INFO/ActivityManager(1160): Config changed: { scale=1.0 imsi=230/3
> > > > loc=en_GB touch=3 keys=2/1/1 nav=2/1 orien=2 layout=34}
>
> > > > and language of whole application set from my (e.g. "cz", to default
> > > > (in this case to "loc=en_GB"). I think that this is similar to your
> > > > problem. Grr ...
>
> > > > Hope we find any solution ...
>
> > > > On Feb 14, 11:45 am, mot12  wrote:
> > > > > Menion,
> > > > > Ok, now I feel silly because I thought I could figure it out from
> > your
> > > > > post.
>
> > > > > 1) Settings.getLanguage() is from your own preference settings?
> > > > > It is no android.provider.Settings, right?
>
> > > > > 2) When my app loads, I read the language preference from my own app
> > > > > preference settings and set the locale using the code you gave. Works
> > > > > great. But if I change the language preference in my settings using
> > > > > updateConfiguration, I hoped I would trigger the
> > > > > onConfigurationChanged of my main Activity. But that doesn't happen
> > > > > despite my entries "android:configChanges="locale" for the main
> > > > > activity and  > > > > android:name="android.permission.CHANGE_CONFIGURATION"/> in the
> > > > > manifest.
>
> > > > > Let's say I am in the main activity. I load the locale specified in
> > > > > the settings in OnCreate. Everything is great. Now I go from there to
> > > > > a preference activity, change the desired locale, update the
> > > > > configuration via updateConfiguration and using the 'back' key I go
> > > > > back to my main activity. Instead of "onConfigurationChanged" I get
> > > > > "onResume", giving me no possibility to reload my resources.
>
> > > > > Any idea?
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "Android Developers" group.
> > > > To post to this group, send email to
> > android-developers@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > android-developers+unsubscr...@googlegroups.com
> > 
>
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/android-developers?hl=en
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
>

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


[android-developers] Re: selecting language from within the app rather than by locale of the system settings

2010-03-03 Thread Menion
Hi Adrian,
  thanks for you response. Your code is very similar to mine. Only
base diference is that you use
Activity.getBaseContext().getResources() instead of mine used
Activity.getResources(). But this not help with my main problem.
Probably in your code, every display rotate call same

INFO/ActivityManager(1160): Config changed: { scale=1.0 imsi=230/3
loc=en_GB touch=3 keys=2/1/1 nav=2/1 orien=2 layout=34}

and after that, locale change to default.

but is seems that only solution is to call language change code in
every onCreate() in every activity. Little bit weird but cannot find
any other "permanent" solution.

On Mar 3, 10:38 pm, Adrian Vintu  wrote:
> Hope this will 
> helphttp://adrianvintu.com/blogengine/post/Force-Locale-on-Android.aspx
>
> BR,
> Adrian Vintu
>
> http://adrianvintu.com
>
> On Sat, Feb 27, 2010 at 3:09 PM, Menion  wrote:
> > Hi mot12,
> >  sorry not post earlier. I don't know, if you find my info still
> > useful ..., but
>
> > ad 1) Yes, it's my own function that check if user selected Czech or
> > English, so this return "cz" or "en" String.
>
> > ad 2) I didn't tried this. When user change locale in
> > PreferenceScreen, I force him to restart application. Changing of
> > application language is not a common activity, so restart is not a bad
> > solution I think :). But with your problem, it's relevant to my
> > another problem. Did you try set another locale (language) and then
> > rotate display? With my current solution, ActivityManager send this
> > event
>
> > INFO/ActivityManager(1160): Config changed: { scale=1.0 imsi=230/3
> > loc=en_GB touch=3 keys=2/1/1 nav=2/1 orien=2 layout=34}
>
> > and language of whole application set from my (e.g. "cz", to default
> > (in this case to "loc=en_GB"). I think that this is similar to your
> > problem. Grr ...
>
> > Hope we find any solution ...
>
> > On Feb 14, 11:45 am, mot12  wrote:
> > > Menion,
> > > Ok, now I feel silly because I thought I could figure it out from your
> > > post.
>
> > > 1) Settings.getLanguage() is from your own preference settings?
> > > It is no android.provider.Settings, right?
>
> > > 2) When my app loads, I read the language preference from my own app
> > > preference settings and set the locale using the code you gave. Works
> > > great. But if I change the language preference in my settings using
> > > updateConfiguration, I hoped I would trigger the
> > > onConfigurationChanged of my main Activity. But that doesn't happen
> > > despite my entries "android:configChanges="locale" for the main
> > > activity and  > > android:name="android.permission.CHANGE_CONFIGURATION"/> in the
> > > manifest.
>
> > > Let's say I am in the main activity. I load the locale specified in
> > > the settings in OnCreate. Everything is great. Now I go from there to
> > > a preference activity, change the desired locale, update the
> > > configuration via updateConfiguration and using the 'back' key I go
> > > back to my main activity. Instead of "onConfigurationChanged" I get
> > > "onResume", giving me no possibility to reload my resources.
>
> > > Any idea?
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
>

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


[android-developers] Re: Security question: can Android source be decompiled and read?

2010-03-02 Thread Menion
Hi,
  can you imagine how hard is then to decompile shared library written
in C? Or is this even possible? Thanks

On Mar 2, 9:17 pm, Greg Donald  wrote:
> On Tue, Mar 2, 2010 at 12:23 PM, Anna PS  
> wrote:
> > So I would like to store a username and password for HTTP login in the
> > Android source (it's an account that is app-wide, rather than per-
> > user, so I would like to supply it with the app).
>
> > Is this a really bad idea? In other words, should I just assume that
> > any text in Android source can be decompiled and read once I've
> > released an app on the Market?
>
> I wouldn't put a login in the code.
>
> Here's the tool anyone can use to disassemble your 
> code:http://jdasm.sourceforge.net/
>
> > If yes, would encrypting it help? Or would anyone who decompiled the
> > app also be able to work out the encryption method?
>
> Decryption is just a matter of time, and it will go even quicker if
> you give them your encrypted password in the code.
>
> --
> Greg Donald
> destiney.com | gregdonald.com

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


[android-developers] Re: selecting language from within the app rather than by locale of the system settings

2010-02-27 Thread Menion
Hi mot12,
  sorry not post earlier. I don't know, if you find my info still
useful ..., but

ad 1) Yes, it's my own function that check if user selected Czech or
English, so this return "cz" or "en" String.

ad 2) I didn't tried this. When user change locale in
PreferenceScreen, I force him to restart application. Changing of
application language is not a common activity, so restart is not a bad
solution I think :). But with your problem, it's relevant to my
another problem. Did you try set another locale (language) and then
rotate display? With my current solution, ActivityManager send this
event

INFO/ActivityManager(1160): Config changed: { scale=1.0 imsi=230/3
loc=en_GB touch=3 keys=2/1/1 nav=2/1 orien=2 layout=34}

and language of whole application set from my (e.g. "cz", to default
(in this case to "loc=en_GB"). I think that this is similar to your
problem. Grr ...

Hope we find any solution ...


On Feb 14, 11:45 am, mot12  wrote:
> Menion,
> Ok, now I feel silly because I thought I could figure it out from your
> post.
>
> 1) Settings.getLanguage() is from your own preference settings?
> It is no android.provider.Settings, right?
>
> 2) When my app loads, I read the language preference from my own app
> preference settings and set the locale using the code you gave. Works
> great. But if I change the language preference in my settings using
> updateConfiguration, I hoped I would trigger the
> onConfigurationChanged of my main Activity. But that doesn't happen
> despite my entries "android:configChanges="locale" for the main
> activity and  android:name="android.permission.CHANGE_CONFIGURATION"/> in the
> manifest.
>
> Let's say I am in the main activity. I load the locale specified in
> the settings in OnCreate. Everything is great. Now I go from there to
> a preference activity, change the desired locale, update the
> configuration via updateConfiguration and using the 'back' key I go
> back to my main activity. Instead of "onConfigurationChanged" I get
> "onResume", giving me no possibility to reload my resources.
>
> Any idea?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: selecting language from within the app rather than by locale of the system settings

2010-02-14 Thread Menion
Hi mot12,
  i was fighting with similar problem few days ago and succesfully
solved. so my solution which may help you too ...

String lang = Settings.getLanguage();
Resources res = activity.getResources();
DisplayMetrics dm = res.getDisplayMetrics();
Configuration config = res.getConfiguration();

String loca = "";
if
(lang.equals(activity.getString(R.string.pref_misc_locale_lang_en_value)))
{
  loca = "en";
} else if
(lang.equals(activity.getString(R.string.pref_misc_locale_lang_cs_value)))
{
  loca = "cs";
}

Locale locale = new Locale(loca);
Locale.setDefault(locale);

config.locale = locale;
res.updateConfiguration(config, dm);

I'm giving user posibility to choose language from app settings. When
my app start (or restart after lang change, i check which lang is
selected by "Settings.getLanguage()" and then set selected lang (in
this case czech or english). One important think is that in ALL my
Activities in manifest file, I have "android:configChanges="locale".

Everything works perfectly, for me ...

Hope this help

On Feb 13, 9:00 pm, mot12  wrote:
> Hi,
>
> Any help on this would be much appreciated.
>
> I would like to give the users of my app the possibility of selecting
> a language from within the application. All languages are supplied the
> standard way via the values-?? resource directory.
>
> However, I don't want Android to select which resource directory to
> use but let the user decide instead.
>
> Any ideas how to accomplish that?
>
> The rationale for this:
> - some languages are not supported by the Android framework and can
> not be selected as a locale via the system settings
> - if you buy a phone in Spain, it will typically not have a system
> setting for Russian language, if you purchase in Russia, you will have
> that setting. So a Russian person in Spain would prefer using the
> Russian language included with the app, but can't access it
>
> thanks for any suggestions,
> Martin

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


[android-developers] Re: Android Performance Monitoring..

2010-01-21 Thread Menion
try look at this ...

http://developer.android.com/intl/fr/guide/developing/tools/traceview.html

i mean, very usefull ;)

On Jan 21, 10:54 am, bharat  wrote:
> Guys,
> I am working on a project where I need to measure the performance of
> an app in terms of memory and CPU cycles used...I need to know any
> simple way to do it(even code is ok)...
>
> Has anyone implemented PerformanceTestCase interface provided by
> android and got results(performance parameters)
>
> Regards,
> Bharat Pawar
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email 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: Unexpected Resumes Running Under 2.0

2009-11-13 Thread Menion
Hi, I have very similar problem, but still not successfully resolved.
In first activity during onCreate() I have this code

Resources res = activity.getResources();
DisplayMetrics dm = res.getDisplayMetrics();
Configuration conf = res.getConfiguration();

// want to set (force) czech language on english phone
Logger.i(TAG, "set CS lang");
Locale loca = new Locale("cs"); // cs_CZ not work too
// !!! THIS LINE DO CYCLE !!!
conf.locale = loca;
res.updateConfiguration(conf, dm);

as I commented in code, line 'conf.locale = loca;' cause repeating
whole creating and destroying cycle as wrote Nmix in first post. And
also I have to say, than this code worked perfectly until 2.0 SDK. Any
suggestion? I'm using this for ability to choose app language
different from system lang. Thank you very much ...

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