[android-developers] Re: Strange Layout issue on two different devices with same screen size and resolution

2014-02-23 Thread Piren
The difference in scaledDensity is because the font size is different 
across devices.
http://developer.android.com/reference/android/util/DisplayMetrics.html#scaledDensity

Regarding the bad layout, post the xml/code relevant to the Published/Draft 
buttons 

On Thursday, February 20, 2014 2:35:03 PM UTC+2, Ankita wrote:

 The further exploration revealed that the scaledDensity is different for 
 both the devices. For HTC, it is 1.275 while for Samsung it is 1.5 while 
 density is 1.5 for both.
 I found this using getResources().getDisplayMetrics().scaledDensity and 
 getResources().getDisplayMetrics().density respectively.

 Now, can someone help me to resolve this issue?

 On Thursday, February 20, 2014 5:30:47 PM UTC+5:30, Ankita wrote:

 Hi All,

 I have run into this strange issue. The two devices HTC Desire X and 
 Samsung Galaxy S Duos 2 GT-7582 have exactly same specs in terms of screen 
 sizes. However, one has got layouts coming up as close to shared .psd files 
 (Samsung) as possible but, another (HTC) shows lot of differences like 
 smaller font sizes but, larger padding. I tried different std. layout 
 folders (small, large, xlarge) but, not to much help. I have attached 
 screenshots for reference. 

 Moreover, I tried getResources().getDisplayMetrics().density also which 
 gave the same value 1.5 for both of them but, one shows the screenshots as 
 expected as per the .psd file (Samsung) while another is far from the 
 shared .psd files (HTC)
 Now, I am trying to know that even with the same spec(screen size and 
 resolution) for both the devices, one device is showing expected layout as 
 designed in eclipse while other is showing smaller font sizes, different 
 padding etc. One question is why it is happening in first place despite 
 using dp and sp. Secondly, what to do now? I mean how to know which layout 
 folder could help as hit and try doesn't seem to work so far. Although I 
 intend to invest more time on it today.

 It would be great if somebody could throw some light on the issue.

 HTC Desire X (Display): 
 http://www.htc.com/www/smartphones/htc-desire-x/#/ 

 Samsung Galaxy S Duos 2 (Display): 
 http://www.samsung.com/levant/consumer/mobile-phones/mobile-phones/duos/GT-S7582ZKAMID
 Thanks!




 http://www.samsung.com/levant/consumer/mobile-phones/mobile-phones/duos/GT-S7582ZKAMID



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


Re: [android-developers] WifiEnterpriseConfig setClientKeyEntry doesn't work with .p12 client cert/key in the keystore

2014-02-23 Thread Nikolay Elenkov
On Sat, Feb 22, 2014 at 9:02 AM, Pradeep Phatak
pradeep.pha...@gmail.com wrote:

 Context-
 I have stored a password protected .p12 client certificate/key
 programatically in the Android keystore.
 During provisioning, Wifi was selected in the dialog (instead of VPN and
 apps).
 I want to use it for Wifi EAP-TLS configuration using the Android API.

 Expectation-
 In Wifi Settings, this EAP-TLS wifi configuration should show this user
 certificate pre-selected.

I haven't looked at this for a while, but IIRC it doesn't work the way
you expect it to (see below).


 Observation-
 setClientKeyEntry method throws exception-
 java.lang.IllegalArgumentException: Private key cannot be encoded.
 setClientKeyEntry method throws this exception if getEncoded method returns
 null for the PrivateKey object reference.
 It is not clear why getEncoded returns null in this case.

Once a key is imported into the device keystore you can use it, but
not extract the private part. That is why getEncoded() returns null.
If it returned the encoded key bytes, that would let you extract
the private key, which defeats the purpose of storing it in the
keystore.


 Can a password protected .p12 file stored in keystore be used for
 programatically configuring Wifi EAP-TLS using this procedure?


Again IIRC (I might be wrong, so do check),  WifiEnterpriseConfig
imports the key into the keystore for you, so you should provide
it a key it can read. To do that, load the PKCS#12 file using
a KeyStore.getInstance(PKCS12), then find the private key
entry and pass it to WifiEnterpriseConfig. Do *not* import into
the Android keystore first.

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


Re: [android-developers] ContentProvider contains dirty data from a previous JUnit test

2014-02-23 Thread Danny D
As I read your reply, I'm confused now about what's being tested.  Are you 
testing the ContentProvider or the Activity?  If testing the Activity, it may 
be better to create a MockContentProvider that's responsible for providing back 
the info.  If testing the ContentProvider, skip the Activity and use an 
Application test case, as you get direct control of when its created or 
destroyed.

Sometimes its hard to do, but the goal in testing is to isolate the components 
and build known conditions around 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
--- 
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.


Re: [android-developers] ContentProvider contains dirty data from a previous JUnit test

2014-02-23 Thread Code Guru
In this case, I am testing the activities of my app with
ActivityInstrumentationTestCase2. (I also have tests for the
ContentProvider using ProviderTestCase2.) The two tests that I outlined
earlier are for the data entry activity. I want to verify that the data
entered is inserted into the underlying database. The Activity inserts the
data via `getContentResolver.insert()`. The test case then opens the
database directly to assert that the data is there. How would I use a
MockContentProvider and/or other mock objects to perform this kind of
testing?

On Sun, Feb 23, 2014 at 12:29 PM, Danny D daniel.m.dev...@gmail.com wrote:

 As I read your reply, I'm confused now about what's being tested.  Are you
 testing the ContentProvider or the Activity?  If testing the Activity, it
 may be better to create a MockContentProvider that's responsible for
 providing back the info.  If testing the ContentProvider, skip the Activity
 and use an Application test case, as you get direct control of when its
 created or destroyed.

 Sometimes its hard to do, but the goal in testing is to isolate the
 components and build known conditions around 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
 ---
 You received this message because you are subscribed to a topic in the
 Google Groups Android Developers group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/android-developers/oOCF2V8tf90/unsubscribe
 .
 To unsubscribe from this group and all its topics, send an email to
 android-developers+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




On Sun, Feb 23, 2014 at 12:29 PM, Danny D daniel.m.dev...@gmail.com wrote:

 As I read your reply, I'm confused now about what's being tested.  Are you
 testing the ContentProvider or the Activity?  If testing the Activity, it
 may be better to create a MockContentProvider that's responsible for
 providing back the info.  If testing the ContentProvider, skip the Activity
 and use an Application test case, as you get direct control of when its
 created or destroyed.

 Sometimes its hard to do, but the goal in testing is to isolate the
 components and build known conditions around 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
 ---
 You received this message because you are subscribed to a topic in the
 Google Groups Android Developers group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/android-developers/oOCF2V8tf90/unsubscribe
 .
 To unsubscribe from this group and all its topics, send an email to
 android-developers+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


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


Re: [android-developers] ContentProvider contains dirty data from a previous JUnit test

2014-02-23 Thread Kostya Vasilyev
I think you're seeing normal Unix (and Linux) file system semantics, with
respect to deleting a file that's currently open. This unlinks the name
from the underlying file system, but the file itself continues to stay
open, and has same content as before unlinking -- until the process that
has the file open terminates.

So, if you're going to execute both tests in one run, you need a way to
reset the database some other way.

One method would be to ensure that the CP closes the database before
deleting the files (then reopens).

Another would be to delete all data (DELETE FROM tablename).

Yet another would be to drop all tables (and to re-create them).

In any case, you'll need a way for your test code to trigger this code
inside the CP.

One way to do this would be to create a special purpose content:// URI and
call it from the test code (and the CP would recognize it and reset its
data using one of the methods above).

-- K



2014-02-24 1:33 GMT+04:00 Code Guru codegur...@gmail.com:

 In this case, I am testing the activities of my app with
 ActivityInstrumentationTestCase2. (I also have tests for the
 ContentProvider using ProviderTestCase2.) The two tests that I outlined
 earlier are for the data entry activity. I want to verify that the data
 entered is inserted into the underlying database. The Activity inserts the
 data via `getContentResolver.insert()`. The test case then opens the
 database directly to assert that the data is there. How would I use a
 MockContentProvider and/or other mock objects to perform this kind of
 testing?

 On Sun, Feb 23, 2014 at 12:29 PM, Danny D daniel.m.dev...@gmail.comwrote:

 As I read your reply, I'm confused now about what's being tested.  Are
 you testing the ContentProvider or the Activity?  If testing the Activity,
 it may be better to create a MockContentProvider that's responsible for
 providing back the info.  If testing the ContentProvider, skip the Activity
 and use an Application test case, as you get direct control of when its
 created or destroyed.

 Sometimes its hard to do, but the goal in testing is to isolate the
 components and build known conditions around 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
 ---
 You received this message because you are subscribed to a topic in the
 Google Groups Android Developers group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/android-developers/oOCF2V8tf90/unsubscribe
 .
 To unsubscribe from this group and all its topics, send an email to
 android-developers+unsubscr...@googlegroups.com.

 For more options, visit https://groups.google.com/groups/opt_out.




 On Sun, Feb 23, 2014 at 12:29 PM, Danny D daniel.m.dev...@gmail.comwrote:

 As I read your reply, I'm confused now about what's being tested.  Are
 you testing the ContentProvider or the Activity?  If testing the Activity,
 it may be better to create a MockContentProvider that's responsible for
 providing back the info.  If testing the ContentProvider, skip the Activity
 and use an Application test case, as you get direct control of when its
 created or destroyed.

 Sometimes its hard to do, but the goal in testing is to isolate the
 components and build known conditions around 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
 ---
 You received this message because you are subscribed to a topic in the
 Google Groups Android Developers group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/android-developers/oOCF2V8tf90/unsubscribe
 .
 To unsubscribe from this group and all its topics, send an email to
 android-developers+unsubscr...@googlegroups.com.

 For more options, visit https://groups.google.com/groups/opt_out.


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

[android-developers] Download folder

2014-02-23 Thread yves...@gmail.com
This is the strangest thing. 

-- 
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] Download folder

2014-02-23 Thread yves...@gmail.com
This is the strangest thing. This problem I found is on Nexus 5. Maybe this 
applies to all Android devices.

I downloaded a picture from gmail, and from Gallery, i can see that 
picture. By click on Details, I can see the file path 
is /storage/emulated/0/Download/12345.jpg. Then in my app, I tried to 
access that picture, it says file is not found. So, I used Astro File 
Manager and get to that folder location, I cant find that file. But if I 
connect the phone to a PC, and after the storage is mounted, I get to 
\Nexus 5\Internal storage\Download folder and the file is there. Anyone 
knows why? How can I find the real path of the file?

Any help will be appreciated.

Thanks

Yves

-- 
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] Gradle and amazon libs?

2014-02-23 Thread Larry Meadors
I've been fighting with this all weekend and could use some help.

Hope this isn't tl;dr. :-/

Short version: I'm looking for a way to add a provided scope, but
the trick where you add a provided configuration doesn't seem to
work with android apps that use productFlavors.

I have an application that uses google maps and device messaging.

I'm am now trying to make it work with amazon maps and device messaging.

I've reconfigured the project to use productFlavors named google
and amazon.

I added a dependency for the google flavor like this:
 - googleCompile('com.google.android.gms:play-services:4.0.30')

The google flavor now compiles and works. Joy.

Next, I tried to add the dependency for amazon in a similar way, but
it turns out that the jars for the amazon APIs are just stubs and are
not intended to be deployed with the APK - they are just supposed to
be available at compile time.

Using this provided trick adds the jars to the main compile classpath.

main{
  compileClasspath += configurations.provided
}

However, that isn't the classpath that's used when compiling the
amazon flavor. I tried to do this:

android.sourceSets.amazon{
  compileClasspath += configurations.provided
}

But I get this error:

Could not find method plus() for arguments [configuration ':provided']
on source set 'compile classpath'.

I've tried 100 things, and nothing seems to work. :-/

Anyone know how to do this?

Larry

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


Re: [android-developers] Download folder

2014-02-23 Thread TreKing
On Sun, Feb 23, 2014 at 6:41 PM, yves...@gmail.com yves...@gmail.comwrote:

 Then in my app, I tried to access that picture, it says file is not found.


What API level are you running and how are you accessing the file?

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

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


Re: [android-developers] Download folder

2014-02-23 Thread Yves Liu
TreKing,

Here is the code snippet

File file = new File( /storage/emulated/0/Download/12345.jpg);

if(file.exists())
 return true;

And another file which I can see through astro file manager there works.




On Sun, Feb 23, 2014 at 10:20 PM, TreKing treking...@gmail.com wrote:


 On Sun, Feb 23, 2014 at 6:41 PM, yves...@gmail.com yves...@gmail.comwrote:

 Then in my app, I tried to access that picture, it says file is not found.


 What API level are you running and how are you accessing the file?


 -
 TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
 transit tracking app for Android-powered devices

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


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


Re: [android-developers] Download folder

2014-02-23 Thread TreKing
On Mon, Feb 24, 2014 at 12:27 AM, Yves Liu yves...@gmail.com wrote:

 Here is the code snippet


OK, first thing is you should not be hard-coding paths. Use the external
storage APIs.

Second, you didn't answer the other question: which platform version are
you running on?

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

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