[android-developers] AvoidXfermode is deprecated since API 16, is there a replacement?

2013-04-21 Thread AndroidCompile
Hi,
I need to draw a bitmap on another bitmap, but I only want to draw on top 
of pixels that have a specific color (transparent in this case) .
I understand that AvoidXfermode could do that, but it is deprecated since 
API 16.
Is there a different method to this now ?

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[android-developers] Which is more suitable for uploading large files? a service on separate process or ...

2013-04-18 Thread AndroidCompile
Hi,
When an application needs to upload many large files, which would be a 
better solution:
1) Doing this on a separate process (i.e. remote service)?
2) Using a separate thread (or AsyncTask)?

Is there a clear and definite answer to this?

The application, by the way, is uploading things all the time - usually 
very small chunks of data. 
Every now and then it needs to send large files, so I want to do that with 
a separate mechanism then the one I am using.
(BTW for the small chunks I am using a single task thread which works great)

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[android-developers] Why I receive a wrong valuew from InputMethodManager.isFullScreenMode()?

2013-03-18 Thread AndroidCompile
InputMethodManager contains a function called isFullscreenMode() that is 
supposed to return a boolean that indicated whether the soft keyboard is in 
extract mode (full screen) or not.
In my application I switch from portrait to landscape mode and bring up the 
keyboard:
mgr.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);

The keyboard shows up in fullscreen, but imm.isFullscreenMode() returns 
false. How is that possible?

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[android-developers] Is there any way of knowing the screen size before rotation occurs?

2013-03-04 Thread AndroidCompile
Hi,
I am trying to figure out the screen size I will have in portrait and in 
landscape at the beginning of my app.
I can get the real display size using Display.getRealSize() and then 
calculate the navigation bar height in case there is one.
However, in devices with 600dp or less the navigation bar can have 
different heights (depending on orientation) and may even move to the right 
in landscape mode.
My app would needs to know these paramters when it begins (the app is 
connected to a cloud server that receives these dimensions when it connects 
- so I really need to know these before the app starts doing things).

My current solution is this:
id = res.getIdentifier(navigation_bar_height, dimen, android);
int navigation_bar_height = res.getDimensionPixelSize(id);

Although this works, it is never a good practice to use android's internal 
resources.
Is there any other way of knowing the dimensions of the screen in a 
different orientation BEFORE you rotate the device?

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[android-developers] Re: Can I decide how bitmaps are compressed via png?

2013-01-11 Thread AndroidCompile
If I want to compress bitmaps with less than 256 colors, I can compress 
them more efficiently (66% decrease in size for the bitmaps I am using)


On Thursday, January 10, 2013 5:52:19 PM UTC+2, bob wrote:

 Why would you want to do this?



 On Sunday, January 6, 2013 3:42:08 AM UTC-6, AndroidCompile wrote:

 Hi,
 Is it possible to determine that a bitmap is compressed (programatically, 
 of course) as a png image with an 8 bit color palette? 4 bit?
 I know there are different types of png compressions, can I decide which 
 type is used?
 If the answer is no, can anyone recommend a method for doing so?

 Thank you 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] Re: Can I decide how bitmaps are compressed via png?

2013-01-10 Thread AndroidCompile
Eventually I figured out the answer myself: in Android it's not possible.
I had to make changes to the Android frameworks to enable this feature 
(skia for that matter: 
you may look at 
https://github.com/androidcompile/Android_external_skia_pngCompression), 
but otherwise, as a developer, there's no access to these features.
Developers may only use an external library in order to save a png in a 
color paletted format.

On Sunday, January 6, 2013 11:42:08 AM UTC+2, AndroidCompile wrote:

 Hi,
 Is it possible to determine that a bitmap is compressed (programatically, 
 of course) as a png image with an 8 bit color palette? 4 bit?
 I know there are different types of png compressions, can I decide which 
 type is used?
 If the answer is no, can anyone recommend a method for doing so?

 Thank you 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] Can I decide how bitmaps are compressed via png?

2013-01-06 Thread AndroidCompile
Hi,
Is it possible to determine that a bitmap is compressed (programatically, 
of course) as a png image with an 8 bit color palette? 4 bit?
I know there are different types of png compressions, can I decide which 
type is used?
If the answer is no, can anyone recommend a method for doing so?

Thank you 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] Best bitmap compression for 2 color Bitmaps

2012-12-30 Thread AndroidCompile
Hi,
Can anyone recommend a way to compress a 2 color Bitmap?  (preferably a 
lossless one)

I suppose I should use  RGB_565 (I am currently using ARGB) , but other 
than that, what should give me the best compression ratio? (JPEG, PNG,...)
Should I think of my own compression algorithm for this? 


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

[android-developers] Re: Best bitmap compression for 2 color Bitmaps

2012-12-30 Thread AndroidCompile
How can I save the bitmap programatically in a 2 color palette png? Is that 
possible?

On Sunday, December 30, 2012 5:26:42 PM UTC+2, Nobu Games wrote:

 You can store your bitmap as a palette-based PNG with 2 colors. As far as 
 I know the PNG format allows lossless run-length encoding compression.

 If you really want to implement your own data format then the simplest 
 approach would be a file header with image width and height, 6 bytes for 
 the two RGB color definitions for your two colors, followed by a sequence 
 of pixel bytes. Each byte encodes 8 sequential pixels from your bitmap 
 where a set bit represents one color and an unset bit the other.
 If you want to go fancy you could RLE-encode the sequence of pixels but 
 then you might as well store the image as a palette-based PNG.

 On Sunday, December 30, 2012 8:04:33 AM UTC-6, AndroidCompile wrote:

 Hi,
 Can anyone recommend a way to compress a 2 color Bitmap?  (preferably a 
 lossless one)

 I suppose I should use  RGB_565 (I am currently using ARGB) , but other 
 than that, what should give me the best compression ratio? (JPEG, PNG,...)
 Should I think of my own compression algorithm for this? 




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

[android-developers] Re: Can two applications that run in the same process have different STATIC object values?

2012-12-27 Thread AndroidCompile
Thanks, tried it and it works...


On Thursday, December 27, 2012 11:53:51 AM UTC+2, Massycat wrote:

 From the second app, you can create a Context that is the same as that of 
 the first app using createPackageContext(), 
 http://developer.android.com/reference/android/content/Context.html#createPackageContext(java.lang.String,
  
 int)
 This Context will give access to the ClassLoader used by the first app 
 (call getClassLoader() on the Context) if you include 
 the CONTEXT_INCLUDE_CODE flag in the createPackageContext() call. Since 
 both the apps are running in the same process the createPackageContext() 
 call will not throw a SecurityException.
 Within the second app, loading the common class through the acquired 
 ClassLoader will give both apps access to the same static fields.



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

[android-developers] Can two applications that run in the same process have different STATIC object values?

2012-12-22 Thread AndroidCompile
 

I created two Android applications that share the same user Id 
(sharedUserId) as well as the same process. In the first app, on startup, I 
set a static int variable to 1 (it's default is 0). In the second app, I 
load (using reflection) the same class from the other app and read the 
static int variable. I read 0.

Since both applications run on the same process, I would expect them to 
share the same static values, no? Can anyone tell me what the mechanism 
underneath does? (are they using, maybe, different apk/dex loaders and that 
causes this behavior?)

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

[android-developers] Get the calling thread's id

2012-11-19 Thread AndroidCompile
Hi,
Is it possible to retrieve the id of a thread that called a certain 
function? (assuming this function can be called from several threads)
I know that it is possible to ask a Binder object which Process had called 
it, but is it also possible with threads from the same process?

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: Get the calling thread's id

2012-11-19 Thread AndroidCompile
If two threads can access a service (that sits in the same process they are 
- the service could have created these threads) and use its methods, I want 
the service to know who was the caller.
I think that Thread.getId returns the current running thread (in this case, 
if the service calls this function, it will always receive its own thread 
Id).



On Monday, November 19, 2012 12:38:02 PM UTC+2, Johan Appelgren wrote:

 You can get the thread id using Thread.getId() 
 http://developer.android.com/reference/java/lang/Thread.html#getId()

 On Monday, November 19, 2012 10:14:27 AM UTC+1, AndroidCompile wrote:

 Hi,
 Is it possible to retrieve the id of a thread that called a certain 
 function? (assuming this function can be called from several threads)
 I know that it is possible to ask a Binder object which Process had 
 called it, but is it also possible with threads from the same process?

 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] Can I tell if a Bitmap is blank?

2012-10-16 Thread AndroidCompile
Hi,
Does anyone know if there's an easy way to tell whether a Bitmap is all 
black (blank)?
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