[android-developers] Re: custom attributes in library projects

2012-10-03 Thread joebowbeer
This was fixed in r17.

See: http://code.google.com/p/android/issues/detail?id=9656

A new namespace was introduced for use in library projects:

  http://schemas.android.com/apk/res-auto

--Joe

On Monday, October 1, 2012 8:03:29 AM UTC-7, Andrew Mackenzie wrote:
>
> So, having read the entire thread: we're still stuck on this one?
>
> Define a custom XML *something* (string, attribute, color, style) in a 
> library project, and then refer to it in XML (say layout, drawable 
> definition, etc) in an App cannot be done?
>

-- 
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 install our app from an APK and then update it with Google Play?

2012-09-15 Thread joebowbeer
Agreed.  Pre-installed apps are updated from Google Play all the time, and 
many rely on this capability.

On Saturday, September 15, 2012 7:30:54 AM UTC-7, b0b wrote:
>
>
>
> On Saturday, 15 September 2012 16:23:21 UTC+2, scadaguru wrote:
>>
>> Yes, if you use same signed package.
>> No, if you use unsigned or different package name.
>>
>>
>> And the versionCode on Google Play  has to be higher than the installed 
> test version.
>
> In short if you distribute non official test versions to user (beta, 
> debugging, ...), do not forget to increment the versionCode if the final 
> Google Play version has changed in the meantime
>

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

Re: [android-developers] Issues with SpeechRecognizer on Jelly Bean

2012-08-30 Thread joebowbeer
The problem has been verified by about a half-dozen different developers.

Here is sample code demonstrating the problem:

http://code.google.com/p/recognition-listener-broken-on-jb/ 


On Thursday, August 30, 2012 4:01:23 PM UTC-7, Spooky wrote:
>
> On Thu, Aug 30, 2012 at 01:53:30PM -0700, joebowbeer wrote: 
> > There seems to be a major issue affecting programmatic users of the 
> speech 
> > recognition service on Jelly Bean handsets: 
>
> > In particular, users of the RecognitionListener are not receiving 
> > results. 
>
> Seems to me like that'd be a problem in the developer's code...
>

-- 
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] Issues with SpeechRecognizer on Jelly Bean

2012-08-30 Thread joebowbeer
There seems to be a major issue affecting programmatic users of the speech 
recognition service on Jelly Bean handsets:

http://code.google.com/p/android/issues/detail?id=36679

In particular, users of the RecognitionListener are not receiving results.

If anyone is interested, please star this issue.  And if anyone has a 
workaround (other than changing the language from en-US to en-GB), please 
comment.

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

Re: [android-developers] Re: static vs non-static inner classes

2012-07-20 Thread joebowbeer
Note that there is now an Android Lint check for non-static inner classes 
that extend Handler.  See HandlerLeak:

http://tools.android.com/tips/lint-checks

I've implemented a Handler.Callback wrapper that wraps the Callback 
(usually an inner class) in a WeakReference, and I construct the Handler 
instance using the wrapped Callback.  This way, the code that used to exist 
in the leaky Handler inner class now exists in the Callback implementation. 
 This seems to have the least impact on the source code, while still 
removing the potential leak.

On Friday, July 13, 2012 6:01:49 AM UTC-7, Michael Rozumyanskiy wrote:
>
> But what about a Handler.Callback interface which can be passed to the 
> Handler's constructor. According to the source code it is stored in the 
> Handler class as a strong reference, so if the Message lives in the queue 
> for a long time, the callback will not be gc'ed. And the callback may be an 
> Activity or an inner class of an activity. But I can't see any checks in 
> the source code and any recommendations in the documentation. As far as I 
> understand, there isn't any right way to use the Handler.Callback with the 
> Handler, is there? 
>
> On Saturday, April 4, 2009 9:52:06 PM UTC+4, Romain Guy wrote:
>>
>> I wrote that debugging code because of a couple of memory leaks I 
>> found in the Android codebase. Like you said, a Message has a 
>> reference to the Handler which, when it's inner and non-static, has a 
>> reference to the outer this (an Activity for instance.) If the Message 
>> lives in the queue for a long time, which happens fairly easily when 
>> posting a delayed message for instance, you keep a reference to the 
>> Activity and "leak" all the views and resources. It gets even worse 
>> when you obtain a Message and don't post it right away but keep it 
>> somewhere (for instance in a static structure) for later use. 
>>
>> If you want to use the equivalent of an inner-class but not risk a 
>> leak, here's a simple pattern: 
>>
>> class OuterClass { 
>>   class InnerClass { 
>> private final WeakReference mTarget; 
>>
>> InnerClass(OuterClass target) { 
>>   mTarget = new WeakReference(target); 
>> } 
>>
>> void doSomething() { 
>>   OuterClass target = mTarget.get(); 
>>   if (target != null) target.do(); 
>> } 
>>   } 
>> } 
>>
>> On Sat, Apr 4, 2009 at 12:15 AM, Greg Krimer wrote: 
>> > 
>> > Thank you very much for the reply! After reading what Fadden said 
>> > weeks ago, I happily converted my static inner handler classes to non- 
>> > static ones. 
>> > 
>> > Just recently, I was browsing the source code of Handler and came 
>> > across this bit of internal Android debugging: 
>> > 
>> >/* 
>> > * Set this flag to true to detect anonymous, local or member 
>> > classes 
>> > * that extend this Handler class and that are not static. These 
>> > kind 
>> > * of classes can potentially create leaks. 
>> > */ 
>> >private static final boolean FIND_POTENTIAL_LEAKS = false; 
>> > 
>> > There is some code further down that uses reflection to locate such 
>> > subclasses if this flag is true. 
>> > 
>> > My handlers fall into the category of non-static member classes, so I 
>> > am curious how such classes could cause a memory leak. My initial 
>> > thinking was that handlers could perhaps accumulate in a collection 
>> > associated with the MessageQueue. But handlers are never placed into 
>> > collections, as far as I can tell. The reference to the handler is in 
>> > the message. Clever! (And in any case if the memory leak is due to an 
>> > ever-growing collection of handlers somewhere then that has nothing to 
>> > do with whether or not the handler class is static or not.) 
>> > 
>> > Just wondering if someone can shed some light on this comment in the 
>> > Android source code. 
>> > 
>> > Thanks, 
>> > 
>> > Greg 
>> > 
>> > On Mar 10, 4:08 pm, fadden  wrote: 
>> >> On Mar 9, 7:17 pm, Greg Krimer  wrote: 
>> >> 
>> >> > I have been finding it convenient to extend Handler in many of my 
>> >> > activities to handle messages specific to the activity. The handler 
>> >> > sublass is an inner class of the activity and needs to access its 
>> >> > state. I am wondering if there is any performance difference between 
>> >> > making the handler subclassstaticand passing in the activity 
>> >> > explicitly in its constructor or making the subclass an "instance 
>> >> > class" and letting the vm worry about my accessing members of the 
>> >> > containing activity. 
>> >> 
>> >> There's no real difference between explicitly and implicitly passing 
>> >> the outer-class reference around.  Your example above is essentially 
>> >> doing what javac does automatically. 
>> >> 
>> >> Staticinner classes have some useful properties, e.g. you know 
>> >> they're not modifying state in the parent, and you can use 
>> >> Class.newInstance() with them.  There's no performance magic though. 
>> >> 
>> >> If you're really 

[android-developers] Re: Activity stack.

2012-04-22 Thread joebowbeer
What happens depends as much on how the "post to wall" activity is declared 
in its AndroidManifest, and how it is intended to be used.

I suggest you use the documented methods, for example, see Hackbook for 
Android:

http://developers.facebook.com/docs/mobile/android/hackbook/ 

On Saturday, April 21, 2012 8:18:50 PM UTC-7, Put_tiMe wrote:
>
> I have an activity that launches another activity, like let's say 
> facebook's "post to wall" activity.
>
> Let's say facebook app was already running, and you were in "what's on 
> your mind" screen.
>
> When my app launches the facebook's  "post to wall" activity, and in that 
> activity I press 'Back", then the facebbok's  "what's on your mind" 
> activity is now on top of stack.
>
> But I want my activity to be on top. What should I do?
>
> I'm using the following flags while I'm launching   facebook's  "post to 
> wall" activity.
>
> Intent.FLAG_ACTIVITY_CLEAR_TOP | 
> Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET | 
>  Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP | 
>  Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | 
> Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
>
>
>
>

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

[android-developers] Re: Is there any alter native to download internal source code I am need mms source code ..

2012-04-19 Thread joebowbeer
http://androidxref.com/source/xref/packages/apps/Mms/ ?

On Friday, April 13, 2012 3:44:47 AM UTC-7, ADB wrote:
>
> Hi every one..
>
> Thanks to be here. I am developing MMS application i know there is 
> no official documentation available.but my problem is how can i download 
> internal application of android MMS application so that i can consider as 
> reference..
> I have Link http://code.google.com/p/modified-android-mms/source/checkout
> ..
> Please help any one 
> 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

[android-developers] Re: Need example on how to use MonkeyRunner from java

2012-04-19 Thread joebowbeer
A similar question was discussed here last year:

https://groups.google.com/d/topic/android-developers/rwXy22QBxOs/discussion

Also see the more recent blog post by Diego Torres Milano:

http://dtmilano.blogspot.com/2012/02/monkeyrunner-interacting-with-views.html


On Wednesday, April 18, 2012 3:26:50 PM UTC-7, gaurav wrote:
>
> Please let me know, if you have found the way.

-- 
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.os.StrictMode$InstanceCountViolation

2012-03-04 Thread joebowbeer
The StrictMode source code is available as a download via SDK Manager.

Note that the setClassInstanceLimit message you see in the log is
faked:

// Dummy throwable, for now, since we don't know when or where the
// leaked instances came from.  We might in the future, but for
// now we suppress the stack trace because it's useless and/or
// misleading.
private static class InstanceCountViolation extends Throwable {
    final Class mClass;
    final long mInstances;
    final int mLimit;
    private static final StackTraceElement[] FAKE_STACK = {
        new StackTraceElement("android.os.StrictMode",
"setClassInstanceLimit",
                              "StrictMode.java", 1)
    };

The detectAll method imposes limits on instances of activities,
cursors, and closable (e.g. InputStream) objects:

public Builder detectAll() {
return enable(DETECT_VM_ACTIVITY_LEAKS |
   DETECT_VM_CURSOR_LEAKS | DETECT_VM_CLOSABLE_LEAKS);
}

The instance limit for unknown activities seems to be created on the
fly:

Integer expected = sExpectedActivityInstanceCount.get(klass);
Integer newExpected = expected == null ? 1 : expected + 1;
sExpectedActivityInstanceCount.put(klass, newExpected);

My guess is that mobileofficeDispatcher is an Activity, and therefore
limited by the code above to 2 instances.


On Feb 29, 11:10 pm, Roopesh  wrote:
> Hi,
>
> On enabling StrictMode, getting following messages in StrictMode log.
> What does the message mean?
> The test was run on Samsung Galaxt Tab 10.1 with Android OS 3.1 with
> ThreadPolicy & VMPolicy set to detectAll().
>
> 02-05 04:13:45.390: ERROR/StrictMode(15009): class
> com.mo.android.mobileoffice.mobileofficeDispatcher; instances=3;
> limit=2
> 02-05 04:13:45.390: ERROR/StrictMode(15009): android.os.StrictMode
> $InstanceCountViolation: class
> com.mo.android.mobileoffice.mobileofficeDispatcher; instances=3;
> limit=2
> 02-05 04:13:45.390: ERROR/StrictMode(15009):     at
> android.os.StrictMode.setClassInstanceLimit(StrictMode.java:1)
>
> regards,
> Roopesh

-- 
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: DLL equivalent in android

2012-02-13 Thread joebowbeer
Something more recent posted by Fred Chung, Android Developer
Advocate:

http://android-developers.blogspot.com/2011/07/custom-class-loading-in-dalvik.html


On Feb 13, 5:48 am, Kostya Vasilyev  wrote:
> Oh, I agree that using those is most likely a bad idea.
>
> But, for the record, even though the technique is described in a
> thread from 2008, it still works today.
>
> -- Kostya
>
> 13 ÆÅ×ÒÁÌÑ 2012šÇ. 17:41 ÐÏÌØÚÏ×ÁÔÅÌØ Kristopher Micinski
>  ÎÁÐÉÓÁÌ:
>
>
>
>
>
>
>
> > 2012/2/13 Kostya Vasilyev :
> >> Yes, the flags have scary names as a warning, but using them with
> >> createPackageContext definitely does work (is 4.0.2 recent enough?)
>
> > That's not my point... My point is that I feel people are very prone
> > to use this when they really shouldn't be. š(Especially if you're
> > looking for a quick fix "DLL for Android," I'm guessing that this is a
> > horrible alternative to doing it with a service and IPC.)
>
> > kris
>
> > --
> > 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: how to distribute a Library Project WITHOUT source code (as jar file) as some sort of SDK?

2012-01-26 Thread joebowbeer
Mark Murphy writes:

> You have to rewrite your [library] code to avoid using R. values, as they 
> will be wrong.

The resource compiler was changed in r14 so that the identifiers in a
library project's R.java are no longer declared "final". This prevents
the constants from being inlined into library bytecode, and instead
forces these references to be resolved at runtime. In theory this
should allow your library to continue to use R. values. Though, as
explained in the r14 change docs, you won't be able to use resource
ids in switch statements.

On Jan 26, 6:57 am, Mark Murphy  wrote:
> It is possible to create an Android library project that does not
> include source code. The limitations are:
>
> -- You still have to ship the resources.
>
> -- You have to rewrite your code to avoid using R. values, as they
> will be wrong. You will have to look up all resource IDs using
> getResources().getIdentifier() and/or reflection.
>
> I have the instructions in _The Busy Coder's Guide to Advanced Android
> Development_ (http://commonsware.com/AdvAndroid), though the
> instructions are new enough that none of my free versions have them.
> Quoting some of the instructions from the current edition:
>
> "You can create a binary-only library project via the following steps:
> 1. Create an Android library project, with your source code and such –
> this is your master project, from which you will create a version of
> the library project for distribution
> 2. Compile the Java source (e.g., ant compile) and turn it into a JAR file
> 3. Create a distribution Android library project, with the same
> resources as the master library project, but no source code
> 4. Put the JAR file in the distribution Android library project's libs/
> directory
>
> The resulting distribution Android library project will have everything a
> main project will need, just without the source code."
>
> Personally, I'd just wait a bit. I am hopeful that the official
> support for library-projects-as-JARs will be available soonish.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Android Training in DC:http://marakana.com/training/android/

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


[android-developers] Re: Android codesearch replacement?

2012-01-19 Thread joebowbeer
Thanks. The android.jar source code can also be downloaded via SDK
Manager and integrated with an IDE.

I'm looking for a deeper search into android.git.kernel.org (aka
github.com/android). The aapt source, for example.

I thought that is what code search used to provide.

On Jan 19, 10:20 pm, Morrison Chang  wrote:
> Using the Android SDK Reference Search Chrome plug-in
>
> https://chrome.google.com/webstore/detail/hgcbffeicehlpmgmnhnkjbjoldk...
>
> Morrison
>
> On Jan 19, 2:36 pm, joebowbeer  wrote:
>
>
>
>
>
>
>
> > Now that Google code search is shut down, how are Android developers
> > compensating for their loss of queries like the following?
>
> >  http://www.google.com/codesearch#/&exact_package=android
> >  http://www.google.com/codesearch#cZwlSNS7aEw/
>
> > The announcement(*) says:
>
> > "If ChromiumOS or Android are important to you, reach out to whatever
> > contacts you have at Google *now* and let them know!"
>
> > I am reaching out.
>
> > (*)https://groups.google.com/group/google-code-search/browse_thread/thre...

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


[android-developers] Android codesearch replacement?

2012-01-19 Thread joebowbeer
Now that Google code search is shut down, how are Android developers
compensating for their loss of queries like the following?

 http://www.google.com/codesearch#/&exact_package=android
 http://www.google.com/codesearch#cZwlSNS7aEw/

The announcement(*) says:

"If ChromiumOS or Android are important to you, reach out to whatever
contacts you have at Google *now* and let them know!"

I am reaching out.


(*) 
https://groups.google.com/group/google-code-search/browse_thread/thread/fa2e2908c47df068

-- 
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: Adding Apache Commons To Android using the Netbeans IDE

2011-12-28 Thread joebowbeer
The relevant SO response is:

if ... you are building with ant - just put the jar in your libs
folder of your project. Done!

The NetBeans Android plugin delegates to the Ant build script when
possible. (This is a feature.)

On Nov 26, 7:28 am, Sam  wrote:
> Hi there. I'm trying to write an application that requires an FTP
> link. To do this I need to use the 'org.apache.commons.net.*' import,
> but I am having problems adding the library I downloaded from the
> apache website. I have tried adding it from the project properties
> menu, am I missing something. Any help would be greatly appreciated,
> also I am relatively new to android/java so it would help if
> explanations were step by step.
>
> I have viewed these web posts, and not been able to figure this 
> out:http://stackoverflow.com/questions/2146870/importing-org-apache-commo...
>
> Further info:
> The application I am developing uses android 2.2
> The Netbeans IDE editon is 7.0.1
> Commons Net 3.0.1

-- 
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: Problems when signing APKs with Java 7.

2011-12-16 Thread joebowbeer
Here is a bug report and patch to Ant's signjar task:

https://issues.apache.org/bugzilla/show_bug.cgi?id=52344

More related discussion and proposed workarounds at:

http://stackoverflow.com/questions/8036422/android-signing-with-ant

Joe

On Nov 17, 8:27 pm, Nikolay Elenkov  wrote:
> On Fri, Nov 18, 2011 at 1:20 PM, gjs  wrote:
> > Hi,
>
> > Yes I can confirm the same problems happen with jarsigner & jdk 1.7
> > and Windows 7, must use jdk 1.6 or prior.
>
> Here's the related ADT issue:
>
> http://code.google.com/p/android/issues/detail?id=19567

-- 
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 Development Environment?

2011-11-15 Thread joebowbeer
The NetBeans plugin (nbandroid.org) has the most stable support for
the new Android SDK Tools (r14+). The support is a fairly thin wrapper
on the Ant build script and properties files, but it seems to work,
which is more than I can say for the current state of Eclipse with ADT
15.

IntelliJ IDEA is not yet supporting the newest Android SDK Tools.

On Nov 11, 1:56 pm, Jones  wrote:
> What development environments are most Android developers using
> (Eclipse, IntelliJ, etc)?
>
> What development platform is most prevalent (Windows, OSX, Linux)?
>
> Thanks!
> Jones/

-- 
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: Library Projects with Resources to Jar using r14

2011-11-08 Thread joebowbeer
I'm also wondering about this.  What is temporary about the jar that
is currently created by the r15 tools?  Are there any snags involved
in just zipping the bin folder of the lib project and distributing
that?

http://android-developers.blogspot.com/2011/10/changes-to-library-projects-in-android.html

On Oct 26, 11:02 am, drasticp  wrote:
> When I saw the update notes for r14 regardinglibraryprojects, I was
> ecstatic. It's a dream come true to be able to export alibraryprojectas 
> aJARfile! From the latest release notes, it looks like
> things are coming along, however it appears that resources are still
> not bundled in the newJarfiles created in Eclipse.
>
> In the Android Developers Blog, Xavier Ducrohet wrote:
> "This solves the implementation fragility in Eclipse and will allow us
> to, later, enable distribution of libraries as a singlejarfile."
>
> Does anyone know what parts are still missing? Is there any way to
> hack the resources in? With the new resource indexes in R14 it seems
> there might be a manual way to get it done 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


[android-developers] FindBugs detector for Android

2011-10-28 Thread joebowbeer
I've shared the beginnings of a FindBugs plugin for Android:

https://bitbucket.org/joebowbeer/findbugsandroidplugin

To use: hg clone, mvn package, and copy the .jar to your FindBugs
plugin folder.

Currently, the plugin contains a single detector, which finds (non-
static) android.os.Handler inner classes that may leak memory.

Memory leaks are a recurring problem for long running processes.  This
detector could, for example, replace the following debug code in the
Handler constructor:

if (FIND_POTENTIAL_LEAKS) {
  final Class klass = getClass();
  if ((klass.isAnonymousClass() || klass.isMemberClass() ||
klass.isLocalClass()) &&
  (klass.getModifiers() & Modifier.STATIC) == 0) {
Log.w(TAG, "The following Handler class should be static or leaks
might occur: " +
  klass.getCanonicalName());
  }
}

Is anyone else writing custom detectors for Android apps?  I think
that a handful, at least, that would be very useful.

-- 
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: Testing a Library Project with SDK Tools r14

2011-10-22 Thread joebowbeer
Reported as:

http://code.google.com/p/android/issues/detail?id=21108

On Oct 21, 12:30 am, joebowbeer  wrote:
> I can't figure out how to test my library project using the r14 tools.
>
> I'm using the "self-contained project" method described at the bottom
> of Managing Projects page:
>
> http://developer.android.com/guide/developing/projects/index.html
>
> "Testing a Library Project [...] You can set up a set up a standard
> application project that depends on the library and put the
> instrumentation in that project. This lets you create a self-contained
> project that contains both the tests/instrumentations and the code to
> test."
>
> I have such a project and was previously able to test it with:
>
> # ant run-tests
>
> Before I updated the project, "default.properties" contained:
>
> android.library.reference.1=..
>
> and "build.properties" contained:
>
> tested.project.dir=.
>
> After updating the lib-project, I updated the test project:
>
> # android update test-project --path . --main .
>
> But after updating the test project, neither the previous command "ant
> run-tests" nor the updated command "ant debug installt test" will
> succeed.
>
> "ant debug installt test" fails:
>
> sdk\tools\ant\build.xml:484: subant task calling a target that depends
> on its parent target '-build-setup'.
>
> Then I noticed that the new property "project.is.test" had not been
> set by the update, so I added that to ant.properties, but then even
> "ant clean" fails:
>
> sdk\tools\ant\build.xml:372: subant task calling its own parent
> target.
>
> Is this method for testing library projects doable using the r14 tools?

-- 
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: Tracking issues in r14

2011-10-22 Thread joebowbeer
I created an issue for the problem I encountered with unit testing
library projects:

http://code.google.com/p/android/issues/detail?id=21108

A possibly related issue:

Unit testing with sdk tools r14?
http://groups.google.com/group/android-developers/browse_thread/thread/43380b35b0429b0d

Can you add these to known issues?

On Oct 21, 2:31 pm, Xavier Ducrohet  wrote:
> Hi all,
>
> There is a number of known issues in r14 that have workarounds. We are
> tracking them athttp://tools.android.com/knownissues
>
> I highly recommend you hit this link if you have problems. We are
> working on fixes.
>
> Xav
> --
> Xavier Ducrohet
> Android SDK Tech Lead
> Google Inc.http://developer.android.com|http://tools.android.com
>
> 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 at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Getting GlobalTime App to run.

2011-10-22 Thread joebowbeer
AndroidGlobalTime was the subject of an early android-developers blog
entry, where it was described as "a 3D world clock developed by an
engineer at Google and may serve as an illustrative example of how to
use the OpenGL ES APIs in your Android applications."

http://android-developers.blogspot.com/2008/05/androidglobaltime.html
http://code.google.com/p/apps-for-android/

It is also the object of my first bug report, when it failed to build
in SDK 1.0:

http://code.google.com/p/apps-for-android/issues/detail?id=18

I believe that you may find a workaround in the comments added to this
report. (Issue tracking in action!)

--Joe

On Oct 21, 12:58 pm, String  wrote:
> On Friday, October 21, 2011 7:33:28 PM UTC+1, Mark Murphy (a Commons Guy)
> wrote:
>
> What is this "GlobalTime App"? It looks like maybe it was from 2007,
>
> > before we had an Android SDK, or something.
>
> That's about right. It was a very VERY early code example, never widely
> distributed even at the time. And even at the time it was a challenge to get
> it to build; good luck doing so with the current SDK.
>
> String

-- 
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] Testing a Library Project with SDK Tools r14

2011-10-21 Thread joebowbeer
I can't figure out how to test my library project using the r14 tools.

I'm using the "self-contained project" method described at the bottom
of Managing Projects page:

http://developer.android.com/guide/developing/projects/index.html

"Testing a Library Project [...] You can set up a set up a standard
application project that depends on the library and put the
instrumentation in that project. This lets you create a self-contained
project that contains both the tests/instrumentations and the code to
test."

I have such a project and was previously able to test it with:

# ant run-tests

Before I updated the project, "default.properties" contained:

android.library.reference.1=..

and "build.properties" contained:

tested.project.dir=.

After updating the lib-project, I updated the test project:

# android update test-project --path . --main .

But after updating the test project, neither the previous command "ant
run-tests" nor the updated command "ant debug installt test" will
succeed.

"ant debug installt test" fails:

sdk\tools\ant\build.xml:484: subant task calling a target that depends
on its parent target '-build-setup'.

Then I noticed that the new property "project.is.test" had not been
set by the update, so I added that to ant.properties, but then even
"ant clean" fails:

sdk\tools\ant\build.xml:372: subant task calling its own parent
target.

Is this method for testing library projects doable using the r14 tools?

-- 
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: ViewHolder Pattern leaking a Context on retained Fragments

2011-10-05 Thread joebowbeer
As a temporary fix, you can use WeakReference to hold the references
to your views without leaking/retaining them.

This is similar to the GC-wary use of WeakReference in callbacks and
listeners: use WeakReference when you pass your object's
reference to another object whose lifetime may be longer than the
referenced object (YourObject).

That way, your object can be garbage collected even if some listener
or callback (or other holder) holds a weak reference to it.

Joe

On Oct 4, 6:06 am, luciofm  wrote:
> > > So, here is my question again, there is some way to use the ViewHolder
> > > pattern on this case?
>
> > It should work fine. Row widgets hold references to their ViewHolder
> > via setTag(). Those row widgets are discarded on a configuration
> > change, which in turn discards their ViewHolders. The list is newly
> > populated by the ListAdapter, creating all new ViewHolder instances
> > for the all-new row widgets.
>
> It seems to be the implementation of the HorizontalListView that I'm using 
> (http://www.dev-smart.com/archives/34) that apparently is not discarding the
> tagged rows (If I dont use the ViewHolder pattern, there is no leak).
>
> There is another implementation of Horizontal ListView available?
>
>
>
>
>
>
>
> > --
> > Mark Murphy (a Commons Guy)
> >http://commonsware.com|http://github.com/commonsguy
> >http://commonsware.com/blog|http://twitter.com/commonsguy
>
> > Android App Developer Books:http://commonsware.com/books
>
> > --
> > 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: how to implement sync using Funambol

2011-10-05 Thread joebowbeer
http://funambol.com/solutions/android.php
https://android-client.forge.funambol.org/

On Oct 4, 4:53 am, aparna rani  wrote:
> hiii
>
> i am implementing android application. In that i nee ti sync the mobile
> database and online server. i searched in google but i found using Funambol
> is possible. but i don't know start please give me some sample code for
> synchronization.
> 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: suspend a Thread

2011-10-04 Thread joebowbeer
There is a sample implementation of a PausableThreadPoolExecutor in
the ThreadPoolExecutor javadoc.

http://developer.android.com/reference/java/util/concurrent/ThreadPoolExecutor.html


On Oct 1, 8:42 pm, bob  wrote:
> How do you suspend a Thread on Android?  I have a background thread,
> and I need to write the onPause method.

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


[android-developers] Re: Getting the actual size of a FrameLayout

2011-09-28 Thread joebowbeer
Acticvity.onWindowFocusChanged( hasFocus == true ) is what I use in
the rare cases where I need it.

On Sep 28, 6:21 am, Philipp Comans 
wrote:
> Hi,
> I have a FrameLayout in my Activity of which I need to know the size in
> pixels at runtime.
> Although getWidth() and getHeigh() return 0 for any(?) ViewGroup without any
> children, I figured out that I can use the functions getMeasuredWidth()
> and getMeasuredHeight() to get the actual size on screen after
> the FrameLayout has become visible.
>
> As far as I know there is no Activity callback that gets called after
> everything in the Activity (including the FrameLayout) is visible to the
> user. Before that point in time however, getMeasuredWidth()
> and getMeasuredHeight() also return 0.
>
> I am wondering that the preferred way of getting the size of that view at
> runtime are. I came up with two possible solutions:
>
> Overwriting onWindowFocusChanged() in the Activity: this is a default
> Android callback that not only gets called after the Activity is visible but
> also after anything else has taken the focus. It seems to get me where I
> want but it seems not very elegant.
>
> Another option would be to make my Activity implement a custom interface
> called OnSizeChangedListener, then overwrite the onSizeChanged of the
> FrameLayout to notify the OnSizeChangedListener of any changes in size. This
> seems to only get called when the window size actually changes. However, I
> am a bit unsure if it is good practice to implement a new listener for this.
>
> What approach would you suggest?
>
> Thanks,
>
> Philipp

-- 
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: Activity has leaked IntentReceiver - Are you missing a call to unregisterReceiver() - Sprint Samsung Galaxy s2 (Android 2.3.4)

2011-09-27 Thread joebowbeer
In onCreateOptionsMenu, try returning true instead of calling super
and see if that is a
workaround.

On Sep 24, 5:05 pm, Glorious Red Leader 
wrote:
> I have not seen this error on the Droid Bionic, Motorola Photon 4g,
> HTC Evo 3d, or the Thunderbolt - only on the Sprint Samsung Galaxy sII
> Epic Touch 4G (android 2.3.4).
>
> This sample application will throw a "leaked IntentReceiver" error by
> following these steps:
>
> - Somehow aquire a Sprint Samsung Galaxy s2 Epic Touch 4g (the one
> with the 4.52" screen)
> - Launch application
> - Press "Launch Activity Two" button
> - Open menu, then open the sub menu (Food) - NOTE: You don't need to
> click on an option, simply viewing the submenu is sufficient
> - Press the phone's back button to close the submenu and menu
> - Press the phone's back button again to return to ActivityOne -
> eclipse will print the error below.
>
> If you simply open the menu and select a single option item (not a
> submenu) then press the back button you will not see the error.
>
> So my question is: Where is this registered IntentReceiver coming
> from, and how can I unregister it?
>
> Thank you for your time.
>
> # AndroidManifest.xml (Target version is 2.3.3)
>
> 
> http://schemas.android.com/apk/res/android";
>         package="com.test" android:versionCode="1" android:versionName="1.0">
>         
>         
>                 
>                         
>                                  android:name="android.intent.action.MAIN" />
>                                  android:name="android.intent.category.LAUNCHER" />
>                         
>                 
>                 
>         
> 
>
> # one.xml (layout for ActivityOne)
>
> 
> http://schemas.android.com/apk/res/
> android"
>         android:orientation="vertical" android:layout_width="fill_parent"
>         android:layout_height="fill_parent">
>                          android:layout_height="wrap_content" android:text="Hello this 
> is
> activity one" />
>                          android:layout_height="wrap_content" android:id="@+id/
> launch_activity_two"
>                 android:text="Launch Activity Two" />
> 
>
> # two.xml (layout for ActivityTwo)
>
> 
> http://schemas.android.com/apk/res/
> android"
>         android:orientation="vertical" android:layout_width="fill_parent"
>         android:layout_height="fill_parent">
>                          android:layout_height="wrap_content"
>                 android:text="Hello this is activity Two.  The only way to 
> leave is
> by pressing the back button on your phone.  If you open a submenu
> (press menu button then select a submenu) - then press the back button
> on your phone there will be an exception thrown." />
> 
>
> # menu/menu.xml
>
> 
> http://schemas.android.com/apk/res/android";>
>         
>                 
>                          android:title="Food is good" /
>
>                          android:title="Food is
> delicious" />
>                          android:title="Food is bad" />
>                 
>         
>         
> 
>
> # ActivityOne
>
> public class ActivityOne extends Activity {
>     /** Called when the activity is first created. */
>     @Override
>     public void onCreate(Bundle savedInstanceState) {
>         super.onCreate(savedInstanceState);
>         setContentView(R.layout.one);
>
>         // launches activity two
>         Button button =
> (Button)findViewById(R.id.launch_activity_two);
>         button.setOnClickListener(new View.OnClickListener() {
>                         @Override
>                         public void onClick(View v) {
>                                 Intent intent = new 
> Intent(getApplicationContext(),
> ActivityTwo.class);
>                                 startActivity(intent);
>                         }
>                 });
>
>         Log.v("Samsung Galaxy sII", "Created Activity One");
>     }
>
> }
>
> # ActivityTwo
>
> public class ActivityTwo extends Activity {
>
>     /** Called when the activity is first created. */
>     @Override
>     public void onCreate(Bundle savedInstanceState) {
>         super.onCreate(savedInstanceState);
>         setContentView(R.layout.two);
>         Log.v("Samsung Galaxy sII", "Created Activity Two");
>     }
>
>         @Override
>         public boolean onCreateOptionsMenu(Menu menu) {
>                 Log.v("Samsung Galaxy sII", "Creating options menu");
>                 MenuInflater inflater = getMenuInflater();
>                 inflater.inflate(R.menu.menu, menu);
>                 return super.onCreateOptionsMenu(menu);
>         }
>
>         @Override
>         public boolean onOptionsItemSelected(MenuItem item) {
>                 // Handle item selection
>                 switch (item.getItemId()) {
>                 case R.id.food_is_bad:
>                         Log.v("Samsung Galaxy sII", "Food is bad");
>                         return true;
>                 case R.id.food_is_good:
>                         Log.v("Samsung Gala

[android-developers] Re: Async Task, rotation and indeterminate progressbar in custom header.

2011-09-26 Thread joebowbeer
My apologies: I thought I was responding to a different thread,
concerning the rotating async task problem.

Responding to you question:

Yes. Maintaining the state (and async task itself) in the application
object is a reasonable way to handle this.  If you need persistence
across application/process instances, you'll need to persist progress
in shared preferences or another persistent store.

On Sep 26, 2:14 pm, joebowbeer  wrote:
> I've also solved this problem in the way you've described: by managing
> the task instance in the application object.  This does burden your
> application implementation with task details that logically are the
> responsibility of an activity or fragment.  In the interest of
> robustness, though, I do like to keep a tight grip on thread instances
> and centralized management via the application object accomplishes
> that.
>
> The other approaches described in this thread are:
>
> 1. Stop/cancel the task on rotation but remember what it was doing and
> restart it when the activity is restarted.
>
> 2. Don't stop the task on rotation but detach from it, retain its
> instance (onRetainNonConfigurationInstance), and reattach to it when
> the new activity is created.  (A generalized version of Mark's async
> task can be helpful here.)
>
> Joe
>
> On Sep 23, 6:29 pm, João Rossa  wrote:
>
>
>
>
>
>
>
> > The use case is that the user should always see the loading progressbar if
> > there's any background work being done in whatever activity the user is and
> > if the task was launched from another activity. I tried putting a reference
> > in the application class to the progressbar and then refresh it in the
> > activities in the oncreate and onrestart,that the way the task will always
> > have the refreshed reference on the postexecute method
> > Any inconvinients on this procedure?
>
> > regards,
>
> > On Fri, Sep 23, 2011 at 7:13 PM, blake  wrote:
> > > AsyncTasks are a nifty tool but they have a fairly limited specific
> > > set of uses.  The previous responses have pointed out a several
> > > problems with this code: you can't keep static refs to Activites or
> > > Views, multiple Activities can't share a progress bar, etc.
>
> > > I don't understand the use case, but I agree with Mark that, from the
> > > code you've supplied, this might be better done as an IntentService or
> > > as a pair of Fragments.
>
> > > I'm going to be giving a Webinar on the pitfalls surrounding
> > > AsyncTasks next week, on the 29th:
>
> > >http://oreillynet.com/pub/e/2061
>
> > > -blake
> > > Programming Android, FTW!
> > >http://oreilly.com/catalog/0636920010364
>
> > > --
> > > 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: Async Task, rotation and indeterminate progressbar in custom header.

2011-09-26 Thread joebowbeer
I've also solved this problem in the way you've described: by managing
the task instance in the application object.  This does burden your
application implementation with task details that logically are the
responsibility of an activity or fragment.  In the interest of
robustness, though, I do like to keep a tight grip on thread instances
and centralized management via the application object accomplishes
that.

The other approaches described in this thread are:

1. Stop/cancel the task on rotation but remember what it was doing and
restart it when the activity is restarted.

2. Don't stop the task on rotation but detach from it, retain its
instance (onRetainNonConfigurationInstance), and reattach to it when
the new activity is created.  (A generalized version of Mark's async
task can be helpful here.)

Joe

On Sep 23, 6:29 pm, João Rossa  wrote:
> The use case is that the user should always see the loading progressbar if
> there's any background work being done in whatever activity the user is and
> if the task was launched from another activity. I tried putting a reference
> in the application class to the progressbar and then refresh it in the
> activities in the oncreate and onrestart,that the way the task will always
> have the refreshed reference on the postexecute method
> Any inconvinients on this procedure?
>
> regards,
>
>
> On Fri, Sep 23, 2011 at 7:13 PM, blake  wrote:
> > AsyncTasks are a nifty tool but they have a fairly limited specific
> > set of uses.  The previous responses have pointed out a several
> > problems with this code: you can't keep static refs to Activites or
> > Views, multiple Activities can't share a progress bar, etc.
>
> > I don't understand the use case, but I agree with Mark that, from the
> > code you've supplied, this might be better done as an IntentService or
> > as a pair of Fragments.
>
> > I'm going to be giving a Webinar on the pitfalls surrounding
> > AsyncTasks next week, on the 29th:
>
> >http://oreillynet.com/pub/e/2061
>
> > -blake
> > Programming Android, FTW!
> >http://oreilly.com/catalog/0636920010364
>
> > --
> > 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: Download and attach andriod source to eclipse

2011-09-12 Thread joebowbeer
You can add Android sources to your Android projects in Eclipse by
installing the (unofficial) Android source feature from update site:

http://adt-addons.googlecode.com/svn/trunk/source/com.android.ide.eclipse.source.update/

After installing the Android source feature all your existing projects
as well as new created projects which is targeted for Android 2.3.4,
2.3, 2.2, 2.1, 2.0.1, 1.6 and 1.5 will have attached the source jar.

On Sep 11, 8:15 pm, Anky  wrote:
> Hi,
>
> I am wondering that andriod has come up with such a great framework
> but is lacking a good and easy way to attach the source code for
> reference. It took me 2 hours of web browsing to find out a 100%
> proven method to attach source. The documentations floating around are
> more oriented towards using Repo and GIT in a unix 
> environment.http://source.android.com/source/downloading.html
>
>  I am using Windows as OS. Many fellow mates have tried to explain and
> share the source location but it appears that each click to these repo
> links is not accessible. Can anyone suggest me a set of simple steps
> to get the access to the source? I am learning android and hence need
> to visit the base classes source to understand before I start working
> on this great framework.
>
> Here are few good articles that were worth helping a new android mate
> but the links from these website to refer the source repository
> location is appeared to be broken.
>
> http://www.satyakomatineni.com/akc/servlet/DisplayServlet?url=Display...
>
> http://geekycoder.wordpress.com/2009/07/03/how-to-download-latest-zip...
>
> Thank you for taking your time to read my problem.
>
> Regards,
> Anky

-- 
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: View.post* methods are not thread-safe

2011-08-09 Thread joebowbeer
Thanks for the info, Romain.

Fixed in 3.0?  Do you know in which platform version this bug first
appeared?  My searches didn't locate a previous bug report -- but my
apps did :-(

I'll revise my message: The View.post* methods are meant to be thread-
safe, but they aren't prior to 3.0

Joe

On Aug 9, 5:00 pm, joebowbeer  wrote:
> Correction: As the title indicates, I meant to write "View.post*"
> methods...
>
> On Aug 9, 4:48 pm, joebowbeer  wrote:
>
>
> > I filed a bug regarding inconsistent documentation of the Thread.post*
> > methods:
>
> >http://code.google.com/p/android/issues/detail?id=19143
>
> > I'm fine with always using a Handler, as the View documentation
> > stipulates, but the rest of the View documentation is scattered with
> > error-prone advise to call the post* methods from non-UI threads --
> > which has led to NPEs in my own experience.
>
> > So I wanted to post this to the list as well as file a bug.

-- 
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: View.post* methods are not thread-safe

2011-08-09 Thread joebowbeer
Correction: As the title indicates, I meant to write "View.post*"
methods...

On Aug 9, 4:48 pm, joebowbeer  wrote:
> I filed a bug regarding inconsistent documentation of the Thread.post*
> methods:
>
> http://code.google.com/p/android/issues/detail?id=19143
>
> I'm fine with always using a Handler, as the View documentation
> stipulates, but the rest of the View documentation is scattered with
> error-prone advise to call the post* methods from non-UI threads --
> which has led to NPEs in my own experience.
>
> So I wanted to post this to the list as well as file a bug.

-- 
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] View.post* methods are not thread-safe

2011-08-09 Thread joebowbeer
I filed a bug regarding inconsistent documentation of the Thread.post*
methods:

http://code.google.com/p/android/issues/detail?id=19143

I'm fine with always using a Handler, as the View documentation
stipulates, but the rest of the View documentation is scattered with
error-prone advise to call the post* methods from non-UI threads --
which has led to NPEs in my own experience.

So I wanted to post this to the list as well as file a bug.

-- 
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: hprof-conv error

2011-06-22 Thread joebowbeer
Could the hprof you grabbed already have been converted?

If the hprof file begins "JAVA PROFILE 1.0.3" then it uses the Android
extended format, and then you may need to use hprof-conv to convert it
to a more standard format before you can analyze it.

If it begins "JAVA PROFILE 1.0.2" or something else then it is already
in the more standard format.

However, I think DDMS and eMAT already work together now, so you may
not need to do any conversion.

The hprof binary format is defined here:
 
http://hg.openjdk.java.net/jdk7/jdk7/jdk/raw-file/tip/src/share/demo/jvmti/hprof/manual.html

Android extensions defined here:
 
http://android.git.kernel.org/?p=platform/dalvik.git;a=blob;f=tools/hprof-conv/HprofConv.c

Joe

On Jun 22, 5:31 am, Bacon021  wrote:
> I am using the eclipse MAT. and I have dump file from eclispe then i
> enter the android SDK to run the hprof-conv to convert the hprof file
> to our Android supported format, but the cmd notify me as "error
> expectiong 1.0.3". does anyone can help me close this  problem? Thanks
> a lot

-- 
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: Abrir un fichero html desde aplicación android

2011-05-02 Thread joebowbeer
> Es posible hacer lo que quiero

Si se puede

I found this snippet on stackoverflow:

public class ViewWeb extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.webview);
WebView wv = (WebView) findViewById(R.id.webView1);
wv.loadUrl("file:///android_asset/index.html");
}
}

Here's a recent tutorial:

http://www.androiddom.com/2011/03/displaying-static-web-page-inside-of.html

On May 1, 5:22 am, Javier  wrote:
> Hola, estoy programando un aplicación en Android y tengo el siguiente
> problema:
>
> La idea es generar una página html de inicio y a partir de ella
> navegar por página de internet. La página html de inicio la creo yo y
> la guardo en un fichero de texto. La página está bien creada ya que si
> la abro con mozilla, chrome o explorer funciona perfectamente.
>
> Bien, mi problema es el siguiente, al lanzar el navegador desde mi
> aplicación me da error ya que no le estoy pasando una URI si no
> localización de donde esta el fichero, de la siguiente manera:
>
> startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("/data/data/
> HelloAndroid/files/pagina.html")));
>
> Es posible hacer lo que quiero o desde una aplicación sólo puedo abrir
> el navegador de Android pasándole una página de internet?
>
> Muchas gracias de antemano.

-- 
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: missing last 7 or 8 bytes while writing to file from inputstream?

2011-04-13 Thread joebowbeer
You need to call os.close(), at least.  os.close() should call
os.flush().  If you don't close or flush, then some of the last bytes
written may remain in the output stream's buffer.

OutputStream.flush() doesn't do anything because it doesn't buffer
anything.

On Apr 13, 12:25 am, Hitendrasinh Gohil
 wrote:
> hi,
>
> i am just writing one file from other file,but last 7 or 8 bytes are
> missing.i am using below code to write the file.
>
> buf= new byte[4096];
>  int numRead = 0;
>             while ((numRead = is.read(buf))>0) {
>                 os.write(buf, 0, numRead);
>             }
>
> can anyone tell me what could be the reason?

-- 
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: Preprocess AndroidManifest.xml ?

2011-03-31 Thread joebowbeer
Preprocessing is doable.  The downside is that preprocessing is not
supported directly by the Eclipse ADT.  (Btw, I like the NetBeans
preprocessor and its support for configurations, and it would be great
to have first-class Android support in NetBeans as well.)

But I digress.

An option that is directly supported in Eclipse is Library Projects.
In theory, you can move all of your code and resources to a shared
library project.  Then create two client projects: one for Android
Market and one for Amazon Appstore.  These projects would use the
library project, but add their own custom AndroidManifest.xml.

On Mar 30, 12:22 pm, Kevin TeslaCoil Software 
wrote:
> With all these Markets, apks are starting to get more complicated. I'm
> taking the approach of a different APK for different Markets.
> There's some permissions I need in some cases and not in others. Like:
> com.android.vending.CHECK_LICENSE
>
> It doesn't hurt anything to have it on the Amazon store (And they
> haven't rejected for it), but it's unnecessary.
> I also have a direct-purchase option and I want to use,
> READ_PHONE_STATE. I don't want to include this permission when it's
> unnecessary for the Google Market or Amazon Appstore.
>
> The idea in my head is having an AndroidManifest.xml like:
>
> 
>     
> 
> 
>      android:name="android.permission.READ_PHONE_STATE" />
> 
>
> Then run AndroidManifest.xml through cpp. This would mean I could
> compile debug builds with Eclipse easily, and they'd just have all
> permissions. But when using Ant I could limit it to just one Market's
> permissions.
> (I'm handling actual java code with a static final int MARKET_TYPE
> deal that gets set by ant)
>
> Anyone know of anything like this that already exists? Anyone know why
> this is a horrible idea and I shouldn't pursue it?
>
> -Kevin

-- 
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: uses-feature glEsVersion

2011-03-30 Thread joebowbeer
I think your uses-feature element is missing the android:name
attribute.

On Mar 28, 3:54 pm, brian7t7  wrote:
> Hi all--
>
> Sorry if this has been addressed--I couldn't easily find anyone else
> with this issue.
>
> Anyway, I'm about to publish my first app.  In the manifest XML, I've
> declared:
>
> 
>
> (This app requires FBOs which are part of GLES 2.0)
>
> When I upload the signed APK file, that requirement doesn't show up as
> one of the filters.  The app's entry developer portal only notes the
> following:
>
> This apk requests 1 features that will be used for Android Market
> filtering:
>   * android.hardware.touchscreen
>
> I would have expected the glEsVersion to be noted there too.  I just
> want to verify that either I'm doing something wrong or that there is
> a problem with the website.
>
> Thanks,
> Brian

-- 
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: custom attributes in library projects

2011-03-16 Thread joebowbeer
Thanks for confirming my findings, Emanuel!

Sorry for not clarifying in my response that I had read the earlier
thread.

I also read that "this" was fixed recently, which is why I'm asking
for an update.

Joe

On Mar 16, 6:38 pm, Emanuel Moecklin <1gravity...@gmail.com> wrote:
> On Wednesday, March 16, 2011 3:42:58 PM UTC-4, joebowbeer wrote:
>
> > In my tests with the latest tools, the custom attribute's namespace
> > declaration in the library project needs to match the package
> > declaration of the including project.  Correct?
>
> It has to match the package declaration in AndroidManifest.xml otherwise the
> layout will not compile.
> If the package is the same as the including project then you are right but
> library projects make sense if you have at least two including projects
> (free and paid app e.g.) which will obviously have different package
> declarations if you want to publish them on Android market. With two
> including projects with different package declarations it's obviously not
> possible to match both.
>
>
>
> > As far as I can tell, this is a known limitation and the suggested
> > workaround is to copy the affected resources (e.g., main.xml in the
> > example above) into each of the including projects.
>
> See Xavier's post from July 2010. Please read the whole thread before
> repeating what others have written.
>
> Emanuel Moecklin

-- 
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: custom attributes in library projects

2011-03-16 Thread joebowbeer
In my tests with the latest tools, the custom attribute's namespace
declaration in the library project needs to match the package
declaration of the including project.  Correct?

As far as I can tell, this is a known limitation and the suggested
workaround is to copy the affected resources (e.g., main.xml in the
example above) into each of the including projects.

On Mar 16, 1:53 am, Clément Plantier  wrote:
> Issue 9656 says it's not possible to have custom attributes declared &
> used in library projects. This is fixed on SDK 11.
>
> About using an attribute that is declared in a library projet in
> multiple applications, I can't answer. Have you tried? What happens
> when you do it?
>
> On Mar 16, 6:26 am, joebowbeer  wrote:
>
> > What has been fixed and tested?
>
> > Issue 9656?
>
> >http://code.google.com/p/android/issues/detail?id=9656
>
> > Is it now possible to declare a custom attribute in a library project
> > and reuse it in multiple apps?
>
> > If so, what xmlns does one use when declaring this attribute?  The
> > namespace of the library, or what?
>
> > Thanks in advance.
>
> > Joe
>
> > On Mar 9, 3:48 am, "C. Plantier"  wrote:
>
> > > This has been fixed (tested with latest SDK tools 10, platform API
> > > 11).
>
> > > On Feb 24, 12:41 pm, Romain  wrote:
>
> > > > Hi,
>
> > > > Any chance this has been fixed - or a workaround is available?
>
> > > > Library projects seem to be the best approach to release multiple 
> > > > versions
> > > > of an app (ex: free/paid),
> > > > and I was really hoping there is a better solution than to duplicate 
> > > > all of
> > > > my custom layouts in both apps.
>
> > > > Many thanks,
>
> > > > Romain

-- 
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: custom attributes in library projects

2011-03-15 Thread joebowbeer
What has been fixed and tested?

Issue 9656?

http://code.google.com/p/android/issues/detail?id=9656

Is it now possible to declare a custom attribute in a library project
and reuse it in multiple apps?

If so, what xmlns does one use when declaring this attribute?  The
namespace of the library, or what?

Thanks in advance.

Joe

On Mar 9, 3:48 am, "C. Plantier"  wrote:
> This has been fixed (tested with latest SDK tools 10, platform API
> 11).
>
> On Feb 24, 12:41 pm, Romain  wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > Any chance this has been fixed - or a workaround is available?
>
> > Library projects seem to be the best approach to release multiple versions
> > of an app (ex: free/paid),
> > and I was really hoping there is a better solution than to duplicate all of
> > my custom layouts in both apps.
>
> > Many thanks,
>
> > Romain

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


[android-developers] Re: Error in build.xml using hudson

2011-03-01 Thread joebowbeer
local.properties

On Mar 1, 11:26 am, Sunil Lakhiyani 
wrote:
> Hello all,
>
> I am building app using hudson, but it throws me an error :
>
> *Smartphone/Project1/android/project1/build.xml:49: taskdef class
> com.android.ant.SetupTask cannot be found*
>
> *
> *
>
> Can any one tell me how to solve this error?
>
> 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: RecognizerIntent not working; “missing extra calling_package”

2011-01-18 Thread joebowbeer
>From what you describe this seems like a doc bug, at least.

FWIW, the AOSP implementation sets this as:

  private static final String EXTRA_CALLING_PACKAGE =
"calling_package";
  // ...
  intent.putExtra(EXTRA_CALLING_PACKAGE, "VoiceIME");

http://android.git.kernel.org/?p=platform/packages/inputmethods/LatinIME.git;a=blob;f=java/src/com/android/inputmethod/voice/VoiceInput.java

On Jan 18, 7:40 am, Isaac Waller  wrote:
> I'm having problems using the RecognizerIntent API on Android 2.2.
> When I call the API using this code:
>
>   Intent intent = new
> Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
>   intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
> RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
>   startActivityForResult(intent, REQUEST_CODE_VOICE_SEARCH);
>
> which looks like it should work, the search popup says "Unknown
> problem" on the device and in the logs it states:
>
> 01-17 14:25:30.433: ERROR/RecognitionActivity(9118):
> ACTION_RECOGNIZE_SPEECH intent called incorrectly. Maybe you called
> startActivity, but you should have called startActivityForResult (or
> otherwise included a pending intent).
> 01-17 14:25:30.433: INFO/RecognitionControllerImpl(9118):
> startRecognition(#Intent;action=android.speech.action.RECOGNIZE_SPEECH;laun 
> chFlags=0x80;component=com.google.android.voicesearch/.IntentApiActivit 
> y;B.fullRecognitionResultsRequest=true;S.android.speech.extra.LANGUAGE_MODE 
> L=free_form;end)
> 01-17 14:25:30.433: INFO/RecognitionControllerImpl(9118): State
> change: STARTING -> STARTING
> 01-17 14:25:30.443: ERROR/RecognitionControllerImpl(9118): required
> extra 'calling_package' missing in voice search intent
> 01-17 14:25:30.443: ERROR/RecognitionControllerImpl(9118):
> ERROR_CLIENT
> 01-17 14:25:30.443: ERROR/RecognitionControllerImpl(9118):
> ERROR_CLIENT
>
> It looks like the problem is the missing "calling_package" extra; on
> the RecognizerIntent page it states that this extra is:
>
> The extra key used in an intent to the speech recognizer for voice
> search. Not generally to be used by developers. The system search
> dialog uses this, for example, to set a calling package for
> identification by a voice search API. If this extra is set by anyone
> but the system process, it should be overridden by the voice search
> implementation.
>
> As far as I can tell, I don't need to override this extra, so why am I
> getting this error? How can I fix my code?

-- 
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: APK file package name

2010-12-03 Thread joebowbeer
If you need more information than aapt currently provides, check out
Google Code projects android-apktool and dedexer and/or dex2jar.

On Dec 1, 5:06 am, Bob Kerns  wrote:
> Ah, you beat me to the answer, excellent.
>
> But when checking my answer, I realized that there's no way that I can
> see to extract the original XML. 'xmltree' is a pain to decode, though
> I'm sure it's of great help to that one guy who maintains the XML
> encoding/decoding code!
>
> It would be easy to output equivalent XML with an 'aapt dump xml  to/apk> ', there have been a number of times
> I would have found this very helpful - mostly to be sure I was
> debugging what I thought I was debugging!
>
> What I'd really like to see would be a .apk inspector integrated into
> Eclipse.
>
> It'd be great if it could also dive into class.dex and at least tell
> us what's there. I can't find a way to do this now?
>
> On Nov 29, 10:45 pm, Dianne Hackborn  wrote:
>
>
>
>
>
>
>
> > aapt dump badging 

-- 
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: IllegalStateException in MediaPlayer (Redux)

2010-11-26 Thread joebowbeer
Do you have an error listener registered? Does it give you more
information?

According to the state diagram, stop() is not available in all states.
Perhaps you're calling stop() in an invalid state, causing the player
to transition to the Error state, at which point prepareAsync would
fail:

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

In my experience with media player, it's best not to assume that a
state transition has happened until one of the listeners tells you.

Also, if you have the luxury of creating a new MediaPlayer instead of
trying to stop and reuse the current player, I think you'll receive
fewer error reports.

On Nov 23, 1:16 am, Jason Polites  wrote:
> Hi folks,
>
> Some time ago I posted an issue relating to an IllegalStateException
> in the Media Player (http://groups.google.com/group/android-developers/
> browse_thread/thread/46c7c2cd4f4a6958/5551d47aac93632c)
>
> I have just launched the app into the "wild" and this error is
> flooding in.
>
> I just can't seem to fathom why.. here's the code:
>
> if(mp != null) {
>        mp.stop();
>        mp.prepareAsync();
>
> }
>
> (mp is a MediaPlayer instance BTW).
>
> According to the doco, prepareAsync is valid for {Initialized,
> Stopped} states.. but I just can't see how it could be in any state
> other than stopped??
>
> The trace is:
>
> java.lang.IllegalStateException
>       at android.media.MediaPlayer.prepareAsync(Native Method)
>       .. the line of code mentioned above follows.
>
> Is it possible that stop() is not synchronous?  Can't seem to see
> anything in the doco stating this.
>
> Anyone got any ideas?
>
> P.S.
>
> I'm seeing this on a wide range of devices, but all so far are version
> 2.1-update1
>
> --
> Droid Odyssey!  A new game for 
> Androidhttp://www.carboncrystal.com/droid-odyssey/

-- 
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: Comping Android APK from commandline (Win32)

2010-11-18 Thread joebowbeer
"android create project" will generate an ant build script for your
project.

It's all covered here:

http://developer.android.com/guide/developing/other-ide.html

I'm currently using Ant and Hudson CI in my automated builder, and
Hudson's Android Emulator plugin for automated unit tests.  (I'm also
using a custom TestRunner that generates test reports in the xml
format that Hudson understands.)

On Nov 18, 2:38 pm, MarkG123  wrote:
> Hi, I am trying to find a standalone toolset that can compile Android
> java project/source code to a finished APK.   Is there such a thing?
> I am not having much success finding anything...
>
> Currently I compile using Eclipse, but I want a minimal and standalone
> automated build system.
>
> 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: Using onCreateDrawableState

2010-11-17 Thread joebowbeer
Could you achieve the same result extending CompoundButton instead of
ImageView?  If so, it might be easier to do that. Though I'm not at
all sure what you're trying to do.

On Nov 16, 9:28 am, Bret Foreman  wrote:
> Leaving aside the lamentable wording of the documentation for this
> method, it's not really acting as I hoped for an ImageView. I call
> toggle() from the onClick method of the view but the view system does
> not redraw my drawable with the checked state. However, if I
> initialize  CHECKED_STATE_SET with android.R.attr.state_checked then
> the view is draw with the checked state.
>
> So apparently my call to setImageState is not updating the state of
> the ImageView. The documentation for setImageState is totally blank in
> the case of an ImageView. What does this mean?
>
> Here's my code:
>
>         private static final int[] CHECKED_STATE_SET =
> {android.R.attr.state_empty};
>
>                 @Override
>                 public boolean isChecked() {
>                         int[] ds = getDrawableState();
>                         return ds[checkedItemIndex] == 
> android.R.attr.state_checked;
>                 }
>
>                 @Override
>                 public void setChecked(boolean isChecked) {
>                         int[] ds = getDrawableState();
>                         if( isChecked ) {
>                                 
> ds[checkedItemIndex]=android.R.attr.state_checked;
>                         } else {
>                                 
> ds[checkedItemIndex]=android.R.attr.state_empty;
>                         }
>                         setImageState(ds,false);
>                         refreshDrawableState();
>                 }
>
>                 @Override
>                 public void toggle() {
>                         setChecked( !isChecked() );
>                 }
>
>                 @Override
>                 public int[] onCreateDrawableState(int extraSpace) {
>                         int[] drawableState = 
> super.onCreateDrawableState(extraSpace +
> CHECKED_STATE_SET.length );
>                         checkedItemIndex = drawableState.length - 
> CHECKED_STATE_SET.length;
>                         mergeDrawableStates( drawableState , 
> CHECKED_STATE_SET );
>                         return drawableState;
>                 }

-- 
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: Extending Application class and broadcast receivers

2010-11-08 Thread joebowbeer
Is there any difference in lifetime/scope between a custom Application
and a singleton class?

My understanding, based on previous postings in this group, is that
the class loader (singleton) has the same lifetime as its process, and
that a single process may be reused by subsequent instances of an app.
Is this correct? If so, then the singleton may "live" longer than the
analogous custom application instance, right?

Another apparent advantage of the custom Application is the
onLowMemory method. Is this actually useful in practice? As I recall,
Application.onTerminate is not called reliably.

On Nov 1, 3:02 pm, Dianne Hackborn  wrote:
> Yes the application object is always created before any other of your
> components in the process.
>
> There is no need to use the application class to implement singletons (that
> part of the docs is totally wrong, I just put in a change to get rid of it).
>  I suggest avoiding that entirely and just write a singleton without it.
>
> On Mon, Nov 1, 2010 at 3:49 PM, Federico Paolinelli wrote:
>
>
>
>
>
>
>
>
>
> > In a book I read, the author suggests to extend the application class
> > in order to have a place to be used as a singleton. In this way, it is
> > easy to make some initialization stuff in it onCreate().
>
> > Now my question: if my application has also some broadcast receivers
> > declared in the manifest, and the application was not started
> > explicitly, or it was but then the os reclaimed it resources back,
> > what will be happening if the broadcast receiver is triggered? Will
> > the onCreate of the application class be called first?
>
> > Thanks in advance,
>
> > Federico
>
> > --
> > 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 > cr...@googlegroups.com>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.

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


[android-developers] Re: Mistake in official Sample ?

2010-11-08 Thread joebowbeer
Reported in March 2008, reviewed and accepted in May 2008, and still
in the queue?

http://code.google.com/p/android/issues/detail?id=580

Would it help if someone submitted a patch?

On Nov 8, 5:29 am, Omie  wrote:
> http://developer.android.com/resources/faq/commontasks.html#opennewsc...
>
> Scroll down to "Returning a Result from a Screen" and look at code sample :
>
> Shouldn't that be requestCode to switch() ?
>
> // Listen for results.
> protected void onActivityResult(int requestCode, int resultCode, Intent data){
>
>     // See which child activity is calling us back.
>     switch (*resultCode*) {
>
>         case CHOOSE_FIGHTER:
>             // This is the standard resultCode that is sent back if the
>
>             // activity crashed or didn't doesn't supply an explicit result.
>             if (resultCode == RESULT_CANCELED){
>
>                 myMessageboxFunction("Fight cancelled");
>             }
>
>             else {
>                 myFightFunction(data);
>
>             }
>         default:
>             break;
>
>     }
>
>
>
>
>
>
>
> }

-- 
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: Releasing Updates To My App - Is It Patching Or Replacing?

2010-10-28 Thread joebowbeer
The update replaces the .apk (including assets and resources) but
preserves the existing SharedPreferences and database.

If you want the updated app to upgrade the existing database, check
out the "onUpgrade" method in SQLiteOpenHelper.

http://developer.android.com/reference/android/database/sqlite/SQLiteOpenHelper.html

On Oct 26, 1:01 pm, F Thomas  wrote:
> If I publish an update to my app on the Android Market, will the app
> only "patch" (or only update changes to current application) or will
> it just replace the old application with the updated one?
>
>  The reason is because for my app I need the user to retain some
> information (such as a database) on their phone that is gathered from
> the user on the app's first setup and not have to ask the user to
> repopulate this data on every update.

-- 
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: Accessing Shared Preferences of another Application

2010-10-25 Thread joebowbeer
You can do this if the other application created the shared
preferences to be world_readable:

  SharedPreferences prefs =
createPackageContext("com.acme.app",
0).getSharedPreferences("myprefs", 0);

http://developer.android.com/reference/android/content/Context.html#createPackageContext(java.lang.String,
int)
http://developer.android.com/reference/android/content/Context.html#getSharedPreferences(java.lang.String,
int)


On Oct 24, 8:43 pm, Android Humanoid  wrote:
> Hi Everyone,
>
> Can anyone help me in accessing the shared preferences of another
> application.
>
> Thanks & Regards.

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


[android-developers] Re: mediaplayer's onCompletionListener never called on playing 3gpp/amr audio files

2010-10-25 Thread joebowbeer
I have observed this and other problems in older versions of the media
player (see Issue 398).

FWIW, at that time an effective workaround was to create another
thread to poll the progress. If the media clip failed to progress
during the polling period, then you can assume it completed.

Joe

On Oct 24, 1:07 pm, Anil  wrote:
> Has no one else observed this problem?
>
> On Oct 12, 2:29 pm, Anil  wrote:
>
>
>
>
>
>
>
> > FYI, 3gpp/amr files are created when you are recording with the cell
> > phone microphone.
>
> > On Oct 12, 1:49 pm, Anil  wrote:
>
> > > I also tried
> > >                 player.setLooping(false);
>
> > > On Oct 12, 1:11 pm, Anil  wrote:
>
> > > > In order to be notified when the clip finishes playing, I use the
> > > > callback:
>
> > > >                 player.setOnCompletionListener(new 
> > > > OnCompletionListener() {
> > > >                         @Override
> > > >                         public void onCompletion(MediaPlayer mp) {
> > > >                                 Toast.makeText(getApplicationContext(), 
> > > > "media player. play
> > > > complete", Toast.LENGTH_SHORT).show();
> > > >                         }
> > > >                 });
>
> > > > Unfortunately it is never called - I am playing 3gpp/amr audio files.
>
> > > > Is there another way to do this?
> > > > thanks,
> > > > Anil

-- 
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: Uploading an app to the Market for testing

2010-10-22 Thread joebowbeer
It would be nice if there were a way to use market filters for this
purpose:

  http://developer.android.com/guide/appendix/market-filters.html

The idea being to publish an app that is filtered-out by every handset
but your own.

The  filter seems like a potential candidate.

I've used  filtering successfully in the market, but it
required some assistance from the OEM.

Joe

On Oct 21, 11:59 am, MB  wrote:
> You would have to quickly publish and then un-publish the app  to test
> LVL in your app.
> This is the only way I could figure out.
> If you figure out something better please share it with the group.
>
> This is what I had to do for testing LVL even with the sample LVL
> code.
>
> --MB.
>
> On Oct 21, 8:49 am, Bret Foreman  wrote:
>
>
>
>
>
>
>
> > I've just added LVL and server-based licensing into my (as-yet
> > unpublished) app. It appears that the license testing requires that
> > the app exist in the Android Market. Is there a way to "publish" an
> > app to the Market but keep it hidden while I test?

-- 
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: isUserAMonkey throws exception

2010-10-18 Thread joebowbeer
DeviceAdminSample in the Android-8 ApiDemos calls this method in some
cases. Does this sample work in your installation?

On Oct 18, 10:10 am, Bret Foreman  wrote:
> By the way, the isUserAMonkey method is missing from the
> ActivityManager in the SDK version 8 install I have. Is it possible
> that this method was removed due to unreliable 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] Re: Get all images taken by the camera?

2010-10-18 Thread joebowbeer
The "native" camera app generally behaves like a, well, digital
camera, and saves its images to a child folder of the DCIM directory.
(DCIM stands for Digital Camera IMages.) You can filter for these
images by adding a selector to your query.  Something along these
lines:

  MediaColumns.DATA + " like '%/DCIM/%'"

(If the content is a file, the DATA column holds the full path to the
file.)

On Oct 16, 7:58 pm, Chris - Diddo Team  wrote:
> Hi all!
>
> Is it possible to get a list/cursor of all images taken by the
> camera?  I would like to somehow be notified when the camera takes a
> picture, ie when the database of images changes.
>
> Currently I can use a contentobserver with the
> MediaStore.Images.Media.External_Content_URI, but that fires off a
> notification if any photo is added to the SD (ie a photo is download,
> another app adds one...)...is there any way to do this?
>
> Thanks so much 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: Keeping the monkey out of the preferences

2010-10-12 Thread joebowbeer
The DeviceAdminSample tests if the user is a monkey:

http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/DeviceAdminSample.html
http://developer.android.com/reference/android/app/ActivityManager.html#isUserAMonkey()

I'd override onPreferenceTreeClick and/or onPreferenceChange in your
PreferenceActivity and insert the test there,

On Oct 11, 5:58 pm, Bret Foreman  wrote:
> My preferences section contains user names and passwords that, if
> trashed, render the rest of the app non-functional. How can I keep the
> testing monkey's grubby fingers out of the preferences?

-- 
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: Problem with Android WebView-based browsers accessing protected resources through Oracle Access Manager (OAM)

2010-10-06 Thread joebowbeer
Data point: In my experience, embedded WebView browsers are able to
SSO successfully using the Higgins SAML IdP.

In case you haven't noticed, there's a new method in Froyo for
injecting initial headers:

  loadUrl(url, extraHeaders)

Might this help?

On Oct 5, 8:45 am, Tim  wrote:
> We have a website that makes use of OAM for single sign on (form-based
> authentication). When we submit credentials to WebGate / Access Server
> the authorization succeeds, however after the authentication is
> performed, the form action (as configured in the Authentication Scheme
> - with passthrough:no) returns a server error instead of redirecting
> to the originally requested URL.
>
> If we use Mini Opera, we are able to get authenticated and forwarded
> properly.
>
> This problem happens on numerous Android phones (versions ranging from
> 1.5-2.2), as well as the Emulator provided with the SDK.
>
> This is proving to be a real problem as the default browser on Android
> phones is not able to get access to our sites(and this is the only
> browser that is having this problem).
>
> I have created a WebView-based custom browser with the hope of seeing
> a client-side error and tried trapping every possible errornone
> show up
>
> I have tried to trace all of the http requests and found only a single
> difference in the requests... the http header for Connection:keep-
> alive is not sent by the Android WebView.
>
> I have provided some tracing info below...
>
> Has anyone run into this problem? Has anyone solved this?
> Any insight to this issue would be greatly appreciated.
> Thanks,
> Tim
>
> Request RAW Data-
>
>  - POST
>    http: // MYSERVER/security/ATLAFunction HTTP/1.1 Host:
> 10.84.32.71:
>    Accept-Encoding: gzip
>    Accept-Language: en-US
> Cookie:ObSSOCookie=loggedoutcontinue
>    Accept-Charset: utf-8, iso-8859-1,utf-16, *;q=0.7
> Referer:http: //MYSERVER/tpf/login.html
>    User-Agent: Mozilla/5.0 (Linux; U; Android 2.2; en-us; sdk Build/
> FRF42) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/
> 533.1
>    Origin: http: // MYSERVER
>    Accept:application/xml,application/xhtml+xml,text/html;q=0.9,text/
> plain;q=0.8,image/png,*/*;q=0.5
>    Content-Type: application/x-www-form-urlencoded
>    Content-Length: 27
> uname=auser&pwd=appas
>
> Raw Response Data -
>
>  - HTTP/1.1 503 Service Temporarily
>    Unavailable Date: Tue, 05 Oct
>    2010 14:26:12 GMT Set-Cookie:
>    ObSSOCookie=II%2F4n5pFreT6B6hOAumv6pI6CZh6l04VhyXHrCzuRUT5hDEHMK
> %2FJCX659uyCkxgIyJ8ywB3BKrHxorsCwZwivpn91t9Mu
> %2FCKT7PrY23S518xoBeOam26tr%2B0pSfCbo
> %2FZXLmFIxjHFOPHPGxi5tHrOlUroXXA9Fe0GZz3SbJLMgAkCw0euuAVewOHKIjoDh8MwAdGtL4 lo
> %2BmHhk5kB316iFJ4Aljr7cQYpAp1r%2BVGD9FbLkYl4ekY5hrlNfwYS
> %2BVjnR0uSIFjc0toiKkGN33z7%2FiElh2Ue2iWQrpCRcgFpxE%3D;
>    httponly; path=/; Cache-Control:
>    no-cache Pragma: no-cache
>    Content-Length: 312 Connection:
>    close Content-Type: text/html;
>    charset=iso-8859-1
>
>        "-//IETF//DTD HTML 2.0//EN">
>    
>    503 Service Temporarily
>    Unavailable
>    
>    

Service Temporarily >    Unavailable

>    

Sorry!The server is >    currently unable to handle the >    request due to a temporary >    overloading or maintenance of the >    server.

>     -- 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: Uri from FilePath?

2010-09-25 Thread joebowbeer
A bit more information:

The DATA column in the MediaStore provider contains the file path, and
it is possible to create a LIKE selection that selects content from a
specific folder -- using a content: Uri not a file: Uri.

LocalDataSource looks like the place to start.

However, I suggest you start with a simpler example. Gallery3D is not
easily modified in this way.

On Sep 25, 1:40 am, joebowbeer  wrote:
> The cooliris Gallery3D code?
>
> http://android.git.kernel.org/?p=platform/packages/apps/Gallery3D.git
>
> How is the image cursor created? I assume it's obtained from a
> MediaStore query. But if you change to a file uri, the MediaStore will
> no longer handle the query...
>
> I think you can obtain the desired results with a MediaStore query and
> the original uri if you add a 'selection' that filters on
> mySubDirectory:
>
>   contentResolver.query(uri, null,
>       MediaColumns.DATA + " like '%/mySubDirectory/%'",
>       null, null);
>
> On Sep 24, 10:19 pm, niko001  wrote:
>
>
>
> > [I have asked this question on Stackoverflow, but haven't gotten any
> > replies in 2 days]
>
> > Hi,
>
> > I am using the Gallery3D-Code for a test-app but want it to only
> > display images from a sub-folder on the SD, not all of the images that
> > are stored on it. To do this, I tried to change
>
> > public static final Uri STORAGE_URI =
> > Images.Media.EXTERNAL_CONTENT_URI;
>
> > to
> > public static final String ROOT_DIR =
> > Environment.getExternalStorageDirectory().toString() + "/
> > mySubDirectory";
> > public static final Uri STORAGE_URI = Uri.fromFile(new
> > File(ROOT_DIR));
>
> > but I guess this is transforming a content://-Uri to a file://-Uri and
> > this may be a problem?
>
> > In any case, it doesn't work :-(! Instead of just showing images from
> > the ROOT_DIR-directory and its sub-directories, it shows no images at
> > all ("Gallery empty"). Could anyone point me in the right direction as
> > to what I am doing wrong?
>
> > Thanks for your help,
> > Nick

-- 
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: Uri from FilePath?

2010-09-25 Thread joebowbeer
The cooliris Gallery3D code?

http://android.git.kernel.org/?p=platform/packages/apps/Gallery3D.git

How is the image cursor created? I assume it's obtained from a
MediaStore query. But if you change to a file uri, the MediaStore will
no longer handle the query...

I think you can obtain the desired results with a MediaStore query and
the original uri if you add a 'selection' that filters on
mySubDirectory:

  contentResolver.query(uri, null,
  MediaColumns.DATA + " like '%/mySubDirectory/%'",
  null, null);


On Sep 24, 10:19 pm, niko001  wrote:
> [I have asked this question on Stackoverflow, but haven't gotten any
> replies in 2 days]
>
> Hi,
>
> I am using the Gallery3D-Code for a test-app but want it to only
> display images from a sub-folder on the SD, not all of the images that
> are stored on it. To do this, I tried to change
>
> public static final Uri STORAGE_URI =
> Images.Media.EXTERNAL_CONTENT_URI;
>
> to
> public static final String ROOT_DIR =
> Environment.getExternalStorageDirectory().toString() + "/
> mySubDirectory";
> public static final Uri STORAGE_URI = Uri.fromFile(new
> File(ROOT_DIR));
>
> but I guess this is transforming a content://-Uri to a file://-Uri and
> this may be a problem?
>
> In any case, it doesn't work :-(! Instead of just showing images from
> the ROOT_DIR-directory and its sub-directories, it shows no images at
> all ("Gallery empty"). Could anyone point me in the right direction as
> to what I am doing wrong?
>
> Thanks for your help,
> Nick

-- 
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 search dialog - SingleTop

2010-09-24 Thread joebowbeer
I see a declaration for .Search but not .MySearchableActivity, so
shouldn't your meta-data reference .Search instead?

On Sep 23, 3:30 pm, RayMan  wrote:
> I'm adding search to my app following the instructions found 
> here:http://developer.android.com/intl/de/guide/topics/search/search-dialo
>
> When I make my main activity searchable, then I can search it. But, I
> found the multiple search screens after multiple searches to be
> annoying since I have to press back through each one. The instructions
> also addressed this by suggesting I create a separate search activity
> with android:launchMode="singleTop". According to the instructions, if
> I add the following Meta tag to my Application in the manifest, then I
> can get the searchable activity from any screen.
>                   android:value=".MySearchableActivity" />
> However, when I try this, the searchable activity does not start when
> I press the search button. If I make my searchable activity the main
> activity, it works. What am I missing?
>
> Here's my searchable activity in the manifest:
>     
>         
>             
>         
>                             android:resource="@xml/searchable"/>
>     

-- 
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: "Proguard, Android, and the Licensing Server", or...

2010-09-23 Thread joebowbeer
At face value, the blog entry is responding to those on this list who
have been asking for help adding Proguard to their build process.

Whether Proguard is worth the effort and expense (e.g, maintaining
symbol maps for decoding stack dumps) is another matter. Proguard can
significantly compact and to a lesser extent optimize the app, which
can be helpful in some situations. Proguard can also obfuscate to some
extent, which will impede anyone trying to reconstitute the app --
but, it should be stressed, will not by any stretch of the imagination
prevent them.

If you don't need to trim bytes, inline methods, or impede piracy, you
need never address the beast.

Joe

On Sep 22, 9:59 pm, JP  wrote:
> Just read the latest Android Developer blog 
> post.http://android-developers.blogspot.com/2010/09/proguard-android-and-l...
> Quite the beast. And Proguard cannot even be used with confidence
> ("it’s still possible that in edge cases you’ll end up seeing
> something like a ClassNotFoundException").
>
> Is it just me getting irritated where this seems to be going?
> In my more active days developing, pretty graphic slang was applies to
> efforts like this: "Turd layering". Meaning: More dependencies, more
> procedure, more sources of error, and it doesn't even work "right". In
> of itself, adding innocent looking steps to a release procedure (for
> some relatively obscure benefit) might be marginally worthwhile, but
> in the bigger picture, releasing an app increasingly becomes a burden.
> Dare you miss a step. Or try to teach somebody else how to go through
> a release and verify it. Or you want to go and rebuild a development
> environment. Or lose the ominous reference file (mapping.txt)...
>
> Anybody care to disagree and convince me this all nice and dandy and
> we don't have to literally run for the hills?

-- 
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: projecting the Android screen

2010-09-20 Thread joebowbeer
I don't think the Moto Droid does this, but if you have one of the
Samsung Galaxy S handsets (Vibrant, Captivate, etc) you can get
composite video out (and stereo audio) using a camcorder cable.  The
HTC Evo has HDMI out.

On Sep 20, 10:32 am, DanH  wrote:
> Some Nokia phones let you plug a special adapter into the audio port
> and get a VGA output.  I suppose it's purely a matter of the phone
> mfgr being motivated to provide the facility.
>
> On Sep 20, 11:20 am, Bret Foreman  wrote:
>
>
>
> > I have a Motorola Droid phone and I want to demo an app on it. The
> > demo will be to a largish group so I'd like to connect the phone to an
> > inFocus or similar SVGA projector. Does anyone know of a USB dongle to
> > do 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: Mechanism to ensure request comes from my app

2010-09-17 Thread joebowbeer
Keep in mind that other apps can access your app's resources and
assets, and in fact anyone can access your apk and obtain anything
hidden therein.

I wish Android provided a way that a server could determine if a
request was generated by some app 'package id' signed by a given key
-- but this is not available as far as I know.

On Sep 17, 12:03 am, William Ferguson 
wrote:
> If I have my app fetching content from my server, what mechanism
> should I use on my server to ensure that its my app making the
> request?
>
> Is there any way that I can sign the request to using my app's
> signature to show its come from my app and not from a stolen version
> or copycat? I suspect the answer is no, but I'm looking for
> suggestions.
>
> William

-- 
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: Application-wide resources.. how to achieve?

2010-09-17 Thread joebowbeer
Your singleton's lifetime is that of the process (via its class
loader), but a process can be reused, right? That is, can't the same
process may be reused for subsequent instances of an application?

On Sep 17, 9:28 am, Dianne Hackborn  wrote:
> A little other perspective:
>
> First, there is no need to use Application except in cases where you need a
> global Context.  I generally prefer to have shared resources simply placed
> in singletons in my process, which anyone can directly access:
>
> public class SharedStuff {
>     private static final Object sLock = new Object();
>     private static final SharedStuff sInstance;
>
>     public static SharedStuff getInstance() {
>         synchronized (sLock) {
>             if (sInstance == null) sInstance = new SharedStuff();
>             return sInstance;
>         }
>     }
>
> }
>
> Then anyone can access this wherever they want.  I think this is much
> cleaner and more modular than trying to hang stuff off application, as it
> avoids having one central place where I need to enumerate the global
> resources for the entire code in the application (including shared
> libraries).
>
> If your global data needs to do stuff with the context (such as register
> receivers), just pass it a Context and let it pull the Application Context
> out:
>
>     public static SharedStuff getInstance(Context caller) {
>         synchronized (sLock) {
>             if (sInstance == null) {
>                 sInstance = new SharedStuff(caller.getApplicationContext());
>             }
>             return sInstance;
>         }
>     }
>
> If it will be doing active stuff while your app is running that you want it
> to stop when not running, have methods each activity calls when it
> resumes/pauses or starts/stop to keep track of how many active clients it
> has.
>
> As for ContentProvider, they are only *needed* for sharing your data with
> others *outside* of your app.  If you are not doing that, there is no need
> to use one.  Often it can be convenient to have one for data that is only
> used within the app when it is for example going to be presented with a list
> view, since the framework has lots of facilities to help work with content
> providers.  But if it's not convenient...  don't use it.  And at any rate,
> they are almost always used with a SQLite database, so if you don't have a
> database I just wouldn't consider one at all.
>
>
>
>
>
> On Fri, Sep 17, 2010 at 8:41 AM, Jason  wrote:
> > ok great.  Sounds like the ticket.
>
> > Thanks for your help.
>
> > On Sep 18, 1:39 am, Bret Foreman  wrote:
> > > By the way, the Android-centric name for the pattern you want is
> > > "Content Provider". You can search the documentation for that phrase.
> > > SQLite is an example of a content provider where you normally create
> > > an Adapter that wraps around the raw SQLite API to present an
> > > application-specific API to the rest of your code. Content providers
> > > are where any substantial persistent state is supposed to reside. Then
> > > you just instantiate the adapter in your onCreate and access the state
> > > you need.
>
> > --
> > 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 > cr...@googlegroups.com>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.

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


[android-developers] Re: After onActivityResult event State Is Gone (Droid Phones)

2010-09-17 Thread joebowbeer
Using the Application should work in this instance, however, why not
use setResult(resultCode, data) to return a result from the child
activity?

http://developer.android.com/reference/android/app/Activity.html#setResult(int,
android.content.Intent)

You can add the url to the data (Intent) that is returned:

  data.putExtra("url", url)

On Sep 17, 7:57 am, GregAZ  wrote:
> I have a problem that's only affecting Droid phones. I end up not
> being able to access global variables after an onActivityResult event.
>
> While looking into this I came 
> across:http://stackoverflow.com/questions/708012/android-how-to-declare-glob...
>
> I follow those directions, but still the value is NULL.
>
> On my HTC Hero everything I've tried works. On Droid phones everything
> is NULL or an empty string.
>
> What I need is the URL from the webview. In the onPageFinished I've
> been putting the URL into a global variable. The app has the correct
> URL in that method because that's when I pop open the imagepicker.
> After that is when the global variable value is gone. I also can't
> read the webview (I can on my Hero, can't on Droid's) after hitting
> the onActivityResult event. GetUrl() returns NULL for them, works fine
> for me. Everything also works fine in the simulator. I've 1.5, 2.1,
> and 2.2 in the simulator.
>
> How else can I store the info I need to retrieve?

-- 
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: Apkbuilder problems with new android SDK tools revision 7

2010-09-17 Thread joebowbeer
I recommend you use the 'android' tool in r7 to generate a new
build.xml and then carefully incorporate any pieces from the old
script that are needed.

Alternatively, the android tool has an option to update an old
project. Let us know if that works.

On Sep 17, 8:06 am, Claudio Veas  wrote:
> Thanks Lance, unfortunatelly this has passed to another problem. I did
> something similar to what you describe and at the moment the build is
> SUCCESSFULL, which we can be happy. But now we have another problem
> which makes us sad again. The problem is that when I install the apk
> file in the phone the phone shows me a popUp with the message saying
> that the application cannot be installed. For some reason, some times,
> the file classes.dex, is not included in the apk file generated even
> when   the dex / file attribute is set, and  this file is added the
> package does not work.
> Im really new at ant Tasks and stuff, let me know if there is another
> documentation other than the ant_rules that I can read, like android
> SDK tools revision 7 release notes.
> Thanks for all your help and please excuse my english.
> Claudio
>
> n Sep 15, 2:04 am, Lance Nanek  wrote:
>
>
>
> > You are missing the new resourcefile attribute on apkbuilder. Also,
> > the value you are using for apkfilepath looks weird as well. Did you
> > just copy it from what you were using for the old basename attribute?
> > It probably won't break due to that, but if you want the same behavior
> > as before you should append "-debug.apk" or "-unsigned.apk" to the
> > value you are passing to the replacement attribute depending on if you
> > are signing or not.
>
> > On Sep 14, 10:32 am, Claudio Veas  wrote:
>
> > > Hello Group, Im having a problem with my ant task that I use to
> > > compile my project. The build.xml that I was using with revision 6 of
> > > the SDK stopped working after the upgrade of the SDK tools to revision
> > > 7 and I havent been able to figure why this happen, all I know is that
> > > certain task attributes where deprecated and some warnings came up but
> > > when executig apkbuilder, a NulPointerException is thrown and I have
> > > not been able to see why.  BTW, I already fixed the warnings of the
> > > deprecated tasks so that was not the problem.
>
> > > -package-debug-sign:
> > > [apkbuilder] Creating android-build and signing it with a debug key...
>
> > > BUILD FAILED
> > > ..\build.xml:349: The following error occurred while executing this
> > > line:
> > > ..\build.xml:206: java.lang.NullPointerException
>
> > > Line 349 is
>
> > >    
> > >           <-- This one
> > >     
>
> > > and Line 246 is
>
> > >     
> > >         
> > >         
> > >         
> > >              > >                     outfolder="${out.absolute.dir}"
> > >                     apkfilepath="${ant.project.name}"
> > >                     signed="@{sign.package}"
> > >                     verbose="${verbose}"> <-- This one
> > >                 
> > >                 
> > >                 
> > >                 
> > >             
> > >         
> > >     
>
> > > I really hope you can help me. If you know why revision 7 of the sdk
> > > has this problems or at leas if you know how I can go back to revision
> > > 6 I would really apreciate ir.
> > > Thanks in advance
> > > Claudio Veas

-- 
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: Child activity lifetime in background

2010-09-15 Thread joebowbeer
Have you tried adding "alwaysRetainTaskState" to your Activity
declaration?

http://developer.android.com/guide/topics/manifest/activity-element.html#always

"When this attribute is 'true', users will always return to the task
in its last state, regardless of how they get there."

On Sep 14, 11:40 pm, viktor  wrote:
> Hi,
>
> I have next problem, I have got parent activity and few sub-
> activities, if app goes to the background by pressed HOME button for
> long time, all children will be killed, and my app restart from parent
> activity.
>
> For example: A1 - parent, A2,A3,A4 - sub-activities. A1-->A2-->A3(top), from 
> A3 I go to the background (HOME). wait 30-40 min and
>
> restart app.
>
> Only A1 displayed.
>
> Could you please explain how to resolve my problem?
>
> 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: Custom Account / Sync adapter: inability to edit contacts?

2010-09-14 Thread joebowbeer
See http://code.google.com/p/android/issues/detail?id=5988

On Sep 14, 3:09 am, BoD  wrote:
> So apparently the answer is no... :(
>
> BoD
>
> On Sep 14, 10:37 am, Kostya Vasilyev  wrote:
>
>
>
> > I believe there was some info on this in the old thread.
>
> > --
> > Kostya Vasilyev --http://kmansoft.wordpress.com
>
> > 14.09.2010 12:21 пользователь "BoD"  написал:
>
> > > custom contacts are assumed to be sufficiently different from standard
> > ones,
> > > and so the built-in...
>
> > How disappointing.
> > Is there a mechanism to inject your own contact editing Activity into
> > the Contact app?
>
> > BoD
>
> > PS: I did use search thank you very much - the only related threads I
> > found were unanswered as I mentioned, maybe you could point me to the
> > relevant thread?
>
> > On Sep 14, 10:01 am, Kostya Vasilyev  wrote:
>
> > > This came up on this list before...
> > > 14.09.2010 11:48 пользователь "BoD"  написал:
>
> > > Anybody please?
>
> > > I saw this question was asked several times in the past but never
> > > answered...
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" g...

-- 
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: Behaviour of launchMode=“ singleTask” not as described?

2010-09-12 Thread joebowbeer
singleTask is one of four launch modes, but its appealing name and
description belies the fact that it is not recommended for general
use:

http://developer.android.com/guide/topics/manifest/activity-element.html

I suspect you can achieve your desired result using a general-purpose
launch mode ("standard" or "singleTop"), and, instead, clearing
ActivityB's taskAffinity and/or adding FLAG_ACTIVITY_NEW_TASK to the
intent that launches ActivityB.

On Sep 10, 11:56 pm, Olly  wrote:
> singleTop behaves as documented for me (i.e. creating a new Activity at
> the top of the stack, or reusing one if there is already an Activity
> of that type at the top of the stack). I'm pretty sure singleTask is
> documented incorrectly though. I'm just wondering whether I've got it
> wrong, since this is completely fundamental (its in the "Android
> fundamentals" document, so how has no-one else picked up on it?
>
> On 11 Sep, 04:30, joebowbeer  wrote:
>
>
>
> > I agree that the documentation is confusing and possibly wrong.
>
> > For the second behavior, that of discarding the intent and bringing
> > the task with the specified activity to the foreground, you should use
> > "singleTop" instead (despite what the documentation says).
>
> > On Sep 10, 4:00 pm, Olly  wrote:
>
> > > I've been learning Android and have come across an issue with
> > > launchMode="singleTask". The documentation states that when this
> > > attribute is used, the Activity is always launched into a new task as
> > > the root Activity. Secondly, the documentation states that if an
> > > Intent is targeted at such an Activity when there are Activities
> > > sitting above it in its task stack, such Intents are discarded
> > > (although the task is still brought to the foreground).
>
> > > I've been playing around with this, and the behaviour I observe is
> > > completely different. In particular: - Activities with
> > > launchMode="singleTask" are not always the root Activity in a task
> > > stack. They are just plonked ontop of the existing stack with the same
> > > affinity. - When an Intent is targeted at such an Activity and there
> > > are other Activities above it in the stack, the Intent is not
> > > discarded. Instead the Activities above it in the stack are discarded.
> > > The Intent is then delivered via onNewIntent to the Activity as
> > > normal.
>
> > > Can someone confirm that this is the actual behaviour? If so, why are
> > > the documents incorrect? If not what have I done wrong. . . Here is a
> > > simple way to observe the behaviour:
>
> > > 1. Create a simple main.xml containing two buttons b1 and b2.
> > > 2. Create the following Activity:
>
> > > public class ActivityA extends Activity {
>
> > >     @Override
> > >     public void onCreate(final Bundle savedInstanceState) {
> > >         super.onCreate(savedInstanceState);
> > >         setContentView(R.layout.main);
>
> > >         Button lButton = (Button) findViewById(R.id.b1);
> > >         lButton.setOnClickListener(new OnClickListener() {
> > >                         @Override
> > >                         public void onClick(View arg0) {
> > >                                 Intent lNextIntent = new 
> > > Intent(ActivityA.this,ActivityA.class);
> > >                                 startActivity(lNextIntent);
> > >                         }
> > >         });
>
> > >         Button lButton2 = (Button) findViewById(R.id.b2);
> > >         lButton2.setOnClickListener(new OnClickListener() {
> > >                         @Override
> > >                         public void onClick(View arg0) {
> > >                                 Intent lNextIntent = new 
> > > Intent(ActivityA.this,ActivityB.class);
> > >                                 startActivity(lNextIntent);
> > >                         }
> > >         });
> > >     }
>
> > > }
>
> > > 3. Create the second Activity:
>
> > > public class ActivityB extends ActivityA {
>
> > > }
>
> > > 4. The manifest:
>
> > > 
> > > http://schemas.android.com/apk/res/android";
> > >       package="ojw28.activitytest"
> > >       android:versionCode="1"
> > >       android:versionName="1.0">
> > >     
> > >          > >                   android:label="@string/app_name">
> 

[android-developers] Re: Need to communicate with android browser

2010-09-10 Thread joebowbeer
Aleksander Kmetec describes one method:

http://lexandera.com/2009/01/extracting-html-from-a-webview/

Register a custom JavaScript interface, install a custom WebViewClient
that overrides onPageFinished, and therein  inject a piece of
JavaScript code into the page that calls back into your interface.


On Sep 8, 10:47 pm, Kristopher Micinski 
wrote:
> Hi all,
>
> For a while now I have been trying to communicate with the android
> browser. Let me describe my situation:
> I need to, when a user clicks views a page (downloads a page,
> actually!), be able to get the HTML content of this page, or at the
> very least, the URL of this page. I then need my app to go and do some
> work with the contents of this page.
>
> I have tried quite a bit of solutions. I tried storing info from the
> page into a cookie, but you can't access the cookie store from an
> external application (I don't think.) My app runs as a separate
> application with a service and a thread that handles a daemon which
> "scavenges" data from a number of different sources.
>
> The short version of this:
> We need to be able to "harvest" data from some sites a user visits on
> the browser. I need this to be possible, and I've heard people say
> things like "oh, just run a local proxy," but that seems a bit much,
> and I'm not sure that's even possible on the Android.
>
> Any ideas would be appreciated,
> Kris

-- 
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 android support more than one sdcard?

2010-09-10 Thread joebowbeer
On Sep 10, 2:01 pm, Kostya Vasilyev  wrote:
> That's the Samsung Galaxy S (GT-I9000) I mentioned earlier in this thread.
> There are also several carrier-branded versions.
>

Nice handset.  1 million were sold in the US in the first 45 days.
Probably 2 million by now.

If you avoid the explicit path and use the getExternalStorageDirectory
method, are there any problems on Galaxy S handsets?

-- 
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: Behaviour of launchMode=“ singleTask” not as described?

2010-09-10 Thread joebowbeer
I agree that the documentation is confusing and possibly wrong.

For the second behavior, that of discarding the intent and bringing
the task with the specified activity to the foreground, you should use
"singleTop" instead (despite what the documentation says).

On Sep 10, 4:00 pm, Olly  wrote:
> I've been learning Android and have come across an issue with
> launchMode="singleTask". The documentation states that when this
> attribute is used, the Activity is always launched into a new task as
> the root Activity. Secondly, the documentation states that if an
> Intent is targeted at such an Activity when there are Activities
> sitting above it in its task stack, such Intents are discarded
> (although the task is still brought to the foreground).
>
> I've been playing around with this, and the behaviour I observe is
> completely different. In particular: - Activities with
> launchMode="singleTask" are not always the root Activity in a task
> stack. They are just plonked ontop of the existing stack with the same
> affinity. - When an Intent is targeted at such an Activity and there
> are other Activities above it in the stack, the Intent is not
> discarded. Instead the Activities above it in the stack are discarded.
> The Intent is then delivered via onNewIntent to the Activity as
> normal.
>
> Can someone confirm that this is the actual behaviour? If so, why are
> the documents incorrect? If not what have I done wrong. . . Here is a
> simple way to observe the behaviour:
>
> 1. Create a simple main.xml containing two buttons b1 and b2.
> 2. Create the following Activity:
>
> public class ActivityA extends Activity {
>
>     @Override
>     public void onCreate(final Bundle savedInstanceState) {
>         super.onCreate(savedInstanceState);
>         setContentView(R.layout.main);
>
>         Button lButton = (Button) findViewById(R.id.b1);
>         lButton.setOnClickListener(new OnClickListener() {
>                         @Override
>                         public void onClick(View arg0) {
>                                 Intent lNextIntent = new 
> Intent(ActivityA.this,ActivityA.class);
>                                 startActivity(lNextIntent);
>                         }
>         });
>
>         Button lButton2 = (Button) findViewById(R.id.b2);
>         lButton2.setOnClickListener(new OnClickListener() {
>                         @Override
>                         public void onClick(View arg0) {
>                                 Intent lNextIntent = new 
> Intent(ActivityA.this,ActivityB.class);
>                                 startActivity(lNextIntent);
>                         }
>         });
>     }
>
> }
>
> 3. Create the second Activity:
>
> public class ActivityB extends ActivityA {
>
> }
>
> 4. The manifest:
>
> 
> http://schemas.android.com/apk/res/android";
>       package="ojw28.activitytest"
>       android:versionCode="1"
>       android:versionName="1.0">
>     
>                            android:label="@string/app_name">
>             
>                 
>                  android:name="android.intent.category.LAUNCHER" />
>             
>         
>          android:launchMode="singleTask">
>         
>     
> 
>
> 5. Launch the application. Press button b1 a couple of times, see what
> happens to the task stack using "adb shell dumpsys activity". Multiple
> instances of ActivityA are now in the task stack as expected.
>
> Now press button b2. According to the documentation this should launch
> an ActivityB instance is a NEW task, as the root Activity of that
> task. Use adb to look at the stack. What actually happens is ActivityB
> gets put ontop of the current stack, which isn't the documented
> behaviour.
>
> Now press button b1 a couple more times. Then press b2 again. Since
> the single instance of ActivityB isn't at the top of the stack, the
> documentation states that this intent should be ignored. The observed
> behaviour is that all ActivityA instances above the ActivityB instance
> are discarded from the stack, after which the intent is delivered to
> the instance of ActivityB as normal (via onNewIntent - you can
> override this method and add a break point to observe 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 clear static variable values when will i close my application in android

2010-09-01 Thread joebowbeer
There are several alternatives listed at
http://developer.android.com/guide/appendix/faq/framework.html#3

I like to maintain global state in a subclass of
android.app.Application.

I share your concerns about static variables, particularly in Android
because the process classloader may outlive any of its activities or
services.

On Aug 31, 10:59 am, siva  wrote:
> Thanks for reply,no chance to clear static variable?what alternative
> solutions for that
>
> On Aug 31, 10:50 pm, Mark Murphy  wrote:
>
>
>
> > On Tue, Aug 31, 2010 at 1:46 PM, siva  wrote:
> > > Thanks ,can u explain,i am fresher in android,i want to clear static
> > > variable value,please give solutions
>
> > Delete the static data members. Then you do not have to clear them.
> > Mutable static data members have been considered an anti-pattern in
> > Java for a decade or so.
>
> > Rather than worrying about clearing the data members, worry about
> > where the data really should live. Does it belong in a database?
> > Should it be managed by a Service? Do you want a subclass of
> > Application? Etc.
>
> > --
> > Mark Murphy (a Commons 
> > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> > Android Development Wiki:http://wiki.andmob.org

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


[android-developers] Re: Using Bouncy Castle with an Android app

2010-08-30 Thread joebowbeer
By the way, the bouncycastle sources are currently in libcore:

http://android.git.kernel.org/?p=platform/libcore.git;a=tree;f=security

On Aug 27, 3:55 pm, fba  wrote:
> Has anyone managed to use Bouncy Castle in one of their apps?   I need
> to be able to do detailed manipulations of x509 certificates (generate
> CSRs, generate key pairs, convert between different certificate
> formats, etc.), and BC seems the best way to do that.
>
> I have tried putting the bcprov library in to my project, and then
> just using BC like I normally would.   When the app is installed, a
> large number of "DexOpt: not verifying"... messages pop up.  I suspect
> this is because BC is already used in Android.  However, when I make
> calls to certain methods in certain classes, I get errors like this :
>
> java.lang.ClassCastException: org.bouncycastle.asn1.DERSequence
>
> I suspect this is because of ambiguity between the classes that are
> included in the OS, and the ones in my project.
>
> Is there any way to get around this?  Maybe tell my program to use the
> BC library that is included with it and ignore the one included in the
> OS?
>
> Or, could I get around this by making sure that I am using the same
> version that is included in the OS?   (Or, in a nutshell, is the
> ClassCastException likely to be a problem because the parameters
> defined for the same method names don't match?)
>
> Thanks for any help!

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


[android-developers] Re: Using Bouncy Castle with an Android app

2010-08-30 Thread joebowbeer
By the way, bouncycastle is currently in libcore:

http://android.git.kernel.org/?p=platform/libcore.git;a=tree;f=security

On Aug 30, 2:49 pm, joebowbeer  wrote:
> If there's a conflict at runtime then you may not need to include the
> BC classes yourself.  Just add BC to your bootclasspath for building.
> Seems a bit fragile, though, even if it works...
>
> Can you access the needed functionality via the java.security
> framework?
>
> Joe
>
> On Aug 27, 3:55 pm, fba  wrote:
>
>
>
> > Has anyone managed to use Bouncy Castle in one of their apps?   I need
> > to be able to do detailed manipulations of x509 certificates (generate
> > CSRs, generate key pairs, convert between different certificate
> > formats, etc.), and BC seems the best way to do that.
>
> > I have tried putting the bcprov library in to my project, and then
> > just using BC like I normally would.   When the app is installed, a
> > large number of "DexOpt: not verifying"... messages pop up.  I suspect
> > this is because BC is already used in Android.  However, when I make
> > calls to certain methods in certain classes, I get errors like this :
>
> > java.lang.ClassCastException: org.bouncycastle.asn1.DERSequence
>
> > I suspect this is because of ambiguity between the classes that are
> > included in the OS, and the ones in my project.
>
> > Is there any way to get around this?  Maybe tell my program to use the
> > BC library that is included with it and ignore the one included in the
> > OS?
>
> > Or, could I get around this by making sure that I am using the same
> > version that is included in the OS?   (Or, in a nutshell, is the
> > ClassCastException likely to be a problem because the parameters
> > defined for the same method names don't match?)
>
> > Thanks for any help!

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


[android-developers] Re: Using Bouncy Castle with an Android app

2010-08-30 Thread joebowbeer
If there's a conflict at runtime then you may not need to include the
BC classes yourself.  Just add BC to your bootclasspath for building.
Seems a bit fragile, though, even if it works...

Can you access the needed functionality via the java.security
framework?

Joe

On Aug 27, 3:55 pm, fba  wrote:
> Has anyone managed to use Bouncy Castle in one of their apps?   I need
> to be able to do detailed manipulations of x509 certificates (generate
> CSRs, generate key pairs, convert between different certificate
> formats, etc.), and BC seems the best way to do that.
>
> I have tried putting the bcprov library in to my project, and then
> just using BC like I normally would.   When the app is installed, a
> large number of "DexOpt: not verifying"... messages pop up.  I suspect
> this is because BC is already used in Android.  However, when I make
> calls to certain methods in certain classes, I get errors like this :
>
> java.lang.ClassCastException: org.bouncycastle.asn1.DERSequence
>
> I suspect this is because of ambiguity between the classes that are
> included in the OS, and the ones in my project.
>
> Is there any way to get around this?  Maybe tell my program to use the
> BC library that is included with it and ignore the one included in the
> OS?
>
> Or, could I get around this by making sure that I am using the same
> version that is included in the OS?   (Or, in a nutshell, is the
> ClassCastException likely to be a problem because the parameters
> defined for the same method names don't match?)
>
> Thanks for any help!

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


[android-developers] Re: AT&T Samsung Captivate > mExternalStorageAvailable == false;

2010-08-19 Thread joebowbeer
I think /sdcard is the "external" storage root:
Environment.getExternalStorageDirectory().

This memory can be unmounted but it can't be removed (without a
screwdriver).

The "removable" sdcard is /sdcard/sd.  On the Samsung Vibrant (TMO)
this 2GB micro is where the Avatar movie is stored and not much else.

Photos may be stored at either /sdcard/DCIM/Photos or /sdcard/sd/DCIM/
Photos depending on the user's setting.

Joe

On Aug 19, 11:17 am, john brown  wrote:
> Stephen,
>
> > For theSamsungGalaxy phones, the internal flash memory is mounted at
> > /sdcard, and the external SD card is mounted at /sdcard/sd
>
> Your comment explains why /sdcard/Android/data/lms/mp would fail
> if I had indeed copied the files to /sdcard/sd/Android/data/lms/mp
>
> But my memory is that
> android.os.Environment.getExternalStorageDirectory() returns "/
> sdcard"
> on BOTH the Moto droid and the Samsung Captivate.
>
> Unfortunately, I have limited access (time) to that phone since it is
> in use as a "in case of emergency call 123-4567" type
> situation. So I will have to wait to test this possible solution.
>
> Thanks, John Brown
>
> On Aug 19, 11:00 am, Stephen Lau  wrote:
>
>
>
> > For theSamsungGalaxy phones, the internal flash memory is mounted at
> > /sdcard, and the external SD card is mounted at /sdcard/sd
>
> > cheers,
> > steve
>
> > john brown wrote:
> > > Hello,
>
> > > I have my application running on a Motorola droid. We have
> > > successfully used it in the intended enviornment for 2 days collecting
> > > 340 readings. The app is not full featured but it is running. The data
> > > storage is complete and we store, create, delete... small data files
> > > on the sdcard. Our design team prefers, in this application, the small
> > > files on the external storage sdcard and does not want to use sqlLite.
>
> > > My beta tester purchased aAT&TSamsungCaptivate (SamsungSGH-i897).
> > > It seems to have two sdcards. In an earlier thread on this list, they
> > > were referred to as an "internal sdcard" and an "external sdcard". Our
> > > test unit has both installed. I am having trouble accessing the
> > > external storage sdcard. I utilized the code from
> > >http://developer.android.com/guide/topics/data/data-storage.htmlto
> > > determine if the sdcard is installed and readable and writeable. The
> > > code is:
>
> > >      public static boolean cksdcard(){
> > >            boolean mExternalStorageAvailable = false;
> > >            boolean mExternalStorageWriteable = false;
> > >            String state = Environment.getExternalStorageState();
> > >            if (Environment.MEDIA_MOUNTED.equals(state)) {
> > >                    // We can read and write the media
> > >            System.out.println("in cksdcard, MEDIA_MOUNTED");
> > >                    mExternalStorageAvailable = true;
> > >                    mExternalStorageWriteable = true;
> > >            }
> > >            else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
> > >                    // We can only read the media
> > >            System.out.println("in cksdcard, MEDIA_MOUNTED_READ_ONLY");
> > >                    mExternalStorageAvailable = true;
> > >                    mExternalStorageWriteable = false;
> > >                    }
> > >            else {
> > >                    // Something else is wrong. It may be one of many 
> > > other states,
> > > but all we need
> > >                    //  to know is we can neither read nor write
> > >            System.out.println("in cksdcard, Something else is wrong");
> > >                    mExternalStorageAvailable = false;
> > >                    mExternalStorageWriteable = false;
> > >            }
> > >            return mExternalStorageWriteable;
> > >      }
>
> > > This code returns False which means it is neither readable or
> > > writeable. It prints the else - "in cksdcard, Something else is
> > > wrong".
>
> > > The app will not run on theSamsungCaptivate because it cannot access
> > > the data files on the sdcard.
>
> > > Strangely, when I mount the device on the desktop computer, windows
> > > explorer shows two (2) connected usb drives which it calls E: and F:.
> > > E: is blank. I can copy the files to F:\Android\data\lms\mpT..
> > > with windows explorer. Windows explored does not show /sdcard
> > > anywhere, it is probably using an Alias?
>
> > > android.os.Environment.getExternalStorageDirectory() returns "/sdcard"
> > > on BOTH the Moto droid and theSamsungCaptivate.
>
> > > ''adb shell" works on theSamsungCaptivate. "ls -l /sdcard" returns
> > > "access denied" or something like that. "ls -l" does show /sdcard in
> > > the root directory with the following attributes: "d-" which
> > > means the owner, group, and user (everybody) have no rights at all.
>
> > > Any suggestions how I might get read and write access to the sdcard on
> > > theAT&TSamsungCaptivate?
>
> > > Thanks, John Brown
>
> > --
> > stephen lau | st...@grommit.com |http://whack

[android-developers] Re: ERROR IN "C:\Users\lenovo\Desktop\android-sdk_r06-windows\android-sdk-windows>>SDK Setup.exe"

2010-08-16 Thread joebowbeer
I've never seen it work for anyone, and I've seen it fail for many.

"force http" is one of the gotcha workarounds that we spell out in our
internal wiki for developers setting up the android sdk.

On Aug 9, 9:25 pm, Bob Kerns  wrote:
> Has this (https) ever worked for anyone, ever?
>
> On Aug 9, 4:05 pm, Kwan Cheng  wrote:
>
> > I think you can fix it by turning "force http" its on the getting started
> > page
>
> > On Aug 9, 2010 4:46 PM, "izzet.ulas"  wrote:> I've 
> > been taking "Failed to fetch URL
>
> >https://dl-ssl.google.com/android/repository/repository.xml,
>
> > > reason: Connection timed out: connect" error for 2 weeks. I am getting
> > > crazy.. =(( What shoul I do? Please help...
>
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to android-developers@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > android-developers+unsubscr...@googlegroups.com > >  cr...@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: Compiling and obfuscating by command line...

2010-08-09 Thread joebowbeer
After local.properties, the next problem sounds like your script is
missing a "setup" call.




It's not too difficult to incorporate Proguard, and the payback can be
significant in some situations.

For a sample template, see the "optimize" target in the zxing source:

http://code.google.com/p/zxing/source/browse/trunk/android/build.xml

Joe

On Jul 31, 7:38 am, sblantipodi  wrote:
> Wow, thanks this maked me goes forward to next error :)
> thanks...
>
> Target "package-resources" does not exist in the project
> what does it means, how can I specify package-resources?
>
> Thanks.
>
> On Jul 30, 11:34 pm, Miguel Morales  wrote:
>
>
>
> > Make sure you have the included files such as:
> > 
>
> > Which should have:
> > sdk.dir=/path/to/sdk_root
>
> > 
> > Which should have:
> > sdk-location=/path/to/sdk_root
>
> > and
> > 
>
> > Which should have:
> > target=android-3 ##or whatever
>
> > On Fri, Jul 30, 2010 at 12:00 PM, sblantipodi
>
> >  wrote:
> > > done, same problem... :(
>
> > > On Jul 30, 7:46 pm, Mark Murphy  wrote:
> > >> If this is a normal Android project, run android update project -p
> > >> ..., where ... is the path to your project, and it will create or
> > >> repair your local.properties file.
>
> > >> On Fri, Jul 30, 2010 at 1:31 PM, sblantipodi
>
> > >>  wrote:
> > >> > I have listed it in the main.xml, the problem seems that ant doesn't
> > >> > find the SDK...
> > >> > if you found my error on google
> > >> > "taskdef class com.android.ant.SetupTask cannot be found"
> > >> > you will find dozens of people with my same problem,
> > >> > but I can't find a solution yet...
>
> > >> --
> > >> Mark Murphy (a Commons 
> > >> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> > >> _Android Programming Tutorials_ Version 2.9 Available!
>
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to android-developers@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > android-developers+unsubscr...@googlegroups.com
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
>
> > --http://developingthedream.blogspot.com/,http://diastrofunk.com,http:/..., 
> > ~Isaiah 55:8-9

-- 
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 preprocessor, //#ifdef...

2010-08-04 Thread joebowbeer
Android will generate an Ant build.xml which is fairly easily
extended, and the NetBeans Mobility Ant Extensions will run fine
outside of NetBeans.

So you could insert a target that uses the NetBeans preprocessor to nb-
prep the sources prior to compiling.

http://wiki.netbeans.org/MobilityAntExtensions

So far, however, it hasn't generally been worth the trouble because
Android is not as splintered (yet) as J2ME.

On Jul 31, 8:25 am, sblantipodi  wrote:
> Hi all,
> I noticed that there is no way to use preprocessor in android with
> netbeans using the
> //#ifdef syntax,
>
> is there some sort of preprocessing in eclipse using android?
> I haven't understood if this is a lack of netbeans or it is a lack of
> android.

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


[android-developers] Re: how to detect if a phone is running HTC sense UI

2010-08-03 Thread joebowbeer
There are also subtle differences in the way some of the standard apps
work, such as Contacts (aka People).  The handling of "Phone" contacts
is different in HTC Sense, for example.

This difference exists whether the HTC Sense Launcher is selected or
not.

On Aug 3, 10:08 am, "Jonas Petersson"  wrote:
> On 08/03/2010 06:31 PM, Dianne Hackborn wrote:
>
> > I would really like to know why people want to know they are running
> > with Sense UI.  Is it just for notifications?  Are there other things?
>
> > We really don't want apps to be dealing with this stuff.
>
> Personally, I would very much like to agree.
>
> However, speaking on behalf of my Swedish users it would seem that there
> is a significant portion (you may call them misinformed) that want my
> application to look like "the standard applications" which for a
> significant portion is Sense (Desire and Hero sell like mad around here).
>
> My interpretation is that they are used to phones (say Nokia) where a
> globally selected theme is applied to just about everything but games. A
> number of users have very boldly stated that they withhold one star
> until this "bug is fixed".
>
> As there (currently) is nothing like that, it is somewhat tempting to
> explicitly alter the UI for a few of the most common styles around. I've
> personally elected not to do that so far, but I can understand why some
> might.
>
>                         Best / Jonas

-- 
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: Possible to gather application logs at runtime?

2010-07-19 Thread joebowbeer
The Log API writes to a small circular buffer that is shared by all
apps. If you want to capture more information, consider a different
route, such as java.util.logging, which by default writes to Android's
Log, but additional handlers (such as file handlers) can be
configured.

However, beware of Issue 6929:

http://code.google.com/p/android/issues/detail?id=6929

On Jul 19, 6:59 am, Jin Chiu  wrote:
> To facilitate diagnostics while the app has been deployed, does
> Android provide any API to facilitate runtime logging? It would be
> ideal if the app could retrieve all the messages it wrote to the
> Logging System via the Log API functions.

-- 
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: about library projects

2010-07-08 Thread joebowbeer
A "refresh" of your dependent project should suffice, rather than a
full clean, but it's still a pain.  AFAIK this is one of the problems
with linked src in Eclipse, and that's what the library projects
essentially are.

Concerning the .svn checkins, I'd expect that you'd ignore all of bin
and gen and the other artifact directories.

On Jul 6, 10:16 pm, nick  wrote:
> Hi,
>
> I've split my application into a library project and app project, it
> mostly works but there are some annoying issues. Hopefully someone has
> an idea how to avoid them. Here goes.
>
> This is really basic, and maybe I am missing something, but why isn't
> the app project automatically rebuilt after I change the library
> project? I've checked the library project in the 'Project References'
> of the app project, but that seems to have no effect. No after each
> change I make to the library project, I need to remember to clean the
> app project to get new code into the apk. Needles to say, I forget all
> the time...
>
> Second one might be a bit more involved, but hopefully there is an
> easy fix. I have my projects into a subversion repository, but the app
> project builder (Android pre-compiler) seems to copy all the source
> from the library project, including the .svn folders, to the app/bin
> project. As a result of this, I get loads of files checked into the
> commit dialog, and I have uncheck all and then hunt down the files I
> actually changed. Is there any way to configure it to ignore .svn
> files when copying source? I realise that it has to merge source from
> both projects to create the final apk, but .svn files are surely not
> needed.
>
> Maybe I should bite the bullet and move the whole thing to Maven+Masa,
> but it is (still) a fairly simple project so I'm trying to avoid
> unneeded complexity.
>
> Any ideas?

-- 
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: notification/broadcast for sent sms

2010-07-04 Thread joebowbeer
Issue 2261 requests this feature:

http://code.google.com/p/android/issues/detail?id=2261

Given that the provider is accessible (if permissions are granted),
and there is already a change notification and broadcast on reception,
I wonder why there isn't a change notification or broadcast when a
message is sent.

On Jul 4, 10:09 am, Saurav  wrote:
> Thank you for ur reply! Indeed.
> Point is i'm not sending the sms. the sms is sent by the user using
> some other app or the default messaging app. So, basically, my hands
> are tied. Like the sms_receive broadcast, is there something for sms
> sent? i just need to know when a sms is sent.
>
> On Jul 4, 1:56 pm, Mark Murphy  wrote:
>
>
>
> > On Sun, Jul 4, 2010 at 3:28 AM, Saurav  
> > wrote:
> > > Could anyone enlighten me on this subject? Please!
>
> > Send theSMSwith SmsManager, and then you can register a
> > PendingIntent to be notified when it issent.
>
> > --
> > Mark Murphy (a Commons 
> > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> > Android Consulting:http://commonsware.com/consulting

-- 
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: https://dl-ssl.google.com/android/repository/repository.xml

2010-07-04 Thread joebowbeer
If I run "SDK Setup.exe" and turn off the "force" option in Settings,
then I still have problems with https.

On Jul 4, 6:49 pm, Indicator Veritatis  wrote:
> I had trouble with the HTTPS repository once upon a time way back
> when, but now I have been using it with no problems for quite some
> time now. If you are still having trouble with it, I have to wonder if
> you have broken SSL support, or too old a version of either Eclipse or
> the ADT.
>
> On Jul 3, 3:10 am, joebowbeer  wrote:
>
>
>
> > You are not alone.  The https link has never worked for me on Windows.
>
> > Try http instead of https.  That works for me.  There's a Setting to
> > force this to happen.
>
> > Search this forum for similar reports.  Also see:
>
> >http://developer.android.com/sdk/eclipse-adt.html#troubleshooting
>
> > On Jul 2, 3:31 am, Raj  wrote:> Hi,
>
> > > When i dowloaded the Android for windows getting the Error "https://dl-
> > > ssl.google.com/android/repository/repository.xml" during the
> > > installation. Kindly let me the root cause for the problem as i
> > > couldn't complete the installation.
>
> > > Thanks,
> > > J.Gopi

-- 
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: https://dl-ssl.google.com/android/repository/repository.xml

2010-07-03 Thread joebowbeer
You are not alone.  The https link has never worked for me on Windows.

Try http instead of https.  That works for me.  There's a Setting to
force this to happen.

Search this forum for similar reports.  Also see:

http://developer.android.com/sdk/eclipse-adt.html#troubleshooting

On Jul 2, 3:31 am, Raj  wrote:
> Hi,
>
> When i dowloaded the Android for windows getting the Error "https://dl-
> ssl.google.com/android/repository/repository.xml" during the
> installation. Kindly let me the root cause for the problem as i
> couldn't complete the installation.
>
> Thanks,
> J.Gopi

-- 
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: User comments available in the developer console!

2010-07-01 Thread joebowbeer
The user comment are is not the same as a support forum, and I
wouldn't want to do anything that will make users hesitant to comment.
The vitality of the market depends on it.

Isn't there already a way for users to initiate two-way communication
with the developers? By way of the app's support email address?

That said, I wish the comments were tagged with the user agent or some
other way to tell what device and platform was used. If they have SMS
problems, I'd want to know if they're using a Droid (Issue 5669), if
they have problems finding their photos, I'd want to know if they're
using an Incredible (/emmc), etc. This information would also help
other users who are deciding whether to install the app on their
handset.

Joe

On Jun 29, 11:35 pm, "Maps.Huge.Info (Maps API Guru)"
 wrote:
> I just noticed a new link in the developer console for comments!
>
> When clicked, it shows the comments the users have posted. No way to
> answer them but at least you can see them outside the device.
>
> Thanks Android people! Great to see this.
>
> -John Coryat

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


[android-developers] Re: Retrieve Image size for HTC devices

2010-06-26 Thread joebowbeer
Is inputStream.available() guaranteed to work in this case?  I read
that input streams for assets and resources are defined to work in
this way, but I wouldn't assume that this also applies to sdcard
files.

The alternative I'd try is:

  ParcelFileDescriptor fd = contentResolver.openFileDescriptor(uri,
mode);
  try {
fileSize = fd.getStatSize();
  } finally {
fd.close();
  }

Joe

On Jun 15, 3:17 pm, sazilla  wrote:
> Hi all,
>
> In my application I need to read Images filesizebefore reading and
> send them through the network.
> Actually it uses the MediaStore provider in order to read theSIZE
> field of the Images.
> All works as expected except for someHTCdevices (e.g. Legend and
> Desire) where the returnedSIZEvalue is not correct (it seems that
> only after a device reboot it stores the correct sizes).
> For that reason I applied a workaround for such devices that makes use
> of the InputStream.available() method in order to get the realImagesize.
> I know that it is not the best way to do that but I didn't find
> alternatives.
>
> Can somebody help me on that issue?
> Carlo

-- 
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: READ_PHONE_STATE and WRITE_EXTERNAL_STORAGE automatically required?

2010-06-21 Thread joebowbeer
Good coverage at:

http://stackoverflow.com/questions/1747178/android-permissions-phone-calls-read-phone-state-and-identity

Apps targeting 1.5 will always request these permissions implicitly.

But what about apps *targeting* 1.6 whose minSdkVersion includes 1.5?




On Jun 21, 1:27 am, Viktor Linder  wrote:
> My app does not require the READ_PHONE_STATE and
> WRITE_EXTERNAL_STORAGE permissions (there's no clause about this in
> the manifest), but it seems they are implicitly added by the SDK when
> minSdkVersion is set to 3.
>
> Will the user on a 1.6 or higher phone be queried about these
> permissions when downloading my app from the market, or is it only
> when downloading it through the browser?
>
> This is a bit of a catch 22 - I support 1.5 and I want to reach this
> userbase, yet I do not want to scare potential users by requiring
> these extra permissions (which my app doesn't require; it doesn't
> write to the sd card nor use the phone function).
>
> Anyone in this group have experience dealing with this issue?
>
> All answers appreciated!
>
> Best regards,
> Viktor Linder

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


[android-developers] Re: Set result of svnversion to tag android:versionName

2010-06-20 Thread joebowbeer
In an Ant build, you can use replaceregexp to modify the manifest:

  

You can pass the svnversion in the Ant command line, or use SvnAnt to
grab the revision within Ant.


On Jun 19, 3:44 pm, Sebastian Müller  wrote:
> Hi
>
> Is there any possibility to set the result of the command svnversion into
> the tag android:versionName of the Android manifest file??
>
> 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: Need some Generics Experts inputs

2010-06-09 Thread joebowbeer
ActivityInstrumentationTestCase2 is parameterized by the Activity
under test, as illustrated in the tutorial:

http://developer.android.com/resources/tutorials/testing/helloandroid_test.html

Without parameterization, this base class would not be able to provide
a getActivity method that returned the activity under test:

http://developer.android.com/reference/android/test/ActivityInstrumentationTestCase2.html

The use of  bounded type is explained in the Java
tutorial:

http://java.sun.com/docs/books/tutorial/java/generics/bounded.html

Also check out the PECS rule for bounded wildcard types. In Effective
Java, 2nd Ed.

Joe

On Jun 8, 9:02 pm, Raja Nagendra Kumar 
wrote:
> Hi,
>
> I see in android some special syntax (may be I am unaware of usage of
> generics this way)
> such as
>
> public static abstract class ActivityInstrumentationTestCase2 extends android.app.Activity>  extends android.test.ActivityTestCase
>
> I am unable to know the exact meaning of
> ActivityInstrumentationTestCase2
>
> i.e the need and its implications of 
>
> Could any one help what this means and where else to hunt for Java
> Generics support related to such kind of class declaration
>
> Regards,
> Nagendra

-- 
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: Interdependent Android Projects

2010-05-24 Thread joebowbeer
There is now a Android Library project type in the Eclipse plugin:

http://developer.android.com/guide/developing/eclipse-adt.html#libraryProject

Library projects are implemented using linked source directories.  The
apks themselves are not linked:

http://groups.google.com/group/android-developers/browse_thread/thread/b4a5d751346655b

Android Test projects are linked to other (instrumented) projects.
Check out the unit test project samples in the SDK.

On May 21, 6:00 pm, saphiroth  wrote:
> Hello all,
> I was wondering if its possible to reference one android project from
> another android project. I have two projects, test1 and test2. I have
> added test2 in the project properties of test1 under the projects tab.
> Unfortunately it keeps throwing a NoClassDefFoundError. Also, would
> the second android project (test2) be installed as a separate apk on
> the phone or would it be part of the encapsulating android project
> (test1) ?
>
> Thanks 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 
> 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: what is the point of an internal broadcast receiver that is invoked explicitly by its classname?

2010-05-23 Thread joebowbeer
I believe these receivers can also be invoked through
pendingIntent.send()

See PendingPntent.getBroadcast()

On May 20, 8:10 pm, Satya Komatineni 
wrote:
> It is possible to create  tag with just a classname and no
> intent filters. The documentation indicates that in this case the
> receiver is considered internal to that package.
>
> The way that receiver is invoked is through 
> sendBroadcast(explicit-class-intent)
>
> How is this different from directly calling that functionality as part
> of the execution line,
>
> I do see that the ANR has a higher tolerance for a broadcast receiver
> including the internal ones.
>
> Is there another benefit? (I am sure I am missing something..)
>
> Clarification is much appreciated
> Satya
>
> --
> 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: Screen off suspends the Thread

2010-05-06 Thread joebowbeer
This is by design.  Time stops for sleeping threads when the handset
is not awake.

However, the AlarmManager never sleeps -- well, in most
implementations:

http://community.developer.motorola.com/t5/Android-App-Development-for/AlarmManager-ELAPSED-REALTIME-WAKEUP-amp-RTC-WAKEUP-won-t-wake/td-p/4987

On May 6, 4:27 am, Raj  wrote:
> Hi All,
> I have a created a thread in my application, and have a sleep for 5sec
> in the run() function. This sleep function returns properly after 5
> secs only if the device screen is turned ON. In case the device screen
> goes to Hibernate, sleep function returns after around 2-3
> minutes(instead of 5 sec).
>
> Have any one faced this issue earlier?
>
> Regards,
> Raj
>
> --
> 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: How to fix "java.lang.IllegalThreadStateExeception: Thread already started."

2010-05-06 Thread joebowbeer
In standard Java (not specific to Android), I would accomplish this by
scheduling a repeating TimerTask on a Timer.

Android provides a few other options, including postDelayed and
AsyncTask.

In this case, I would try to implement the progress indicator using
Android's animation framework.

Joe

On May 6, 12:10 am, MSChoi  wrote:
> I made an application which has a thread for a notification
> progressbar.
>
> First time I started the thread, it works fine.
> But Second time I tried to start the thread again, the application
> stop with the exception.
>
> How can I solve this problem?
> Please give me any clue.
>
> [==My thread code below==]
> private class ProgressThread extends Thread {
>         Handler mHandler;
>         final static int STATE_DONE = 0;
>         final static int STATE_RUNNING = 1;
>         int outIncreamentPercent;
>         int mState;
>
>         ProgressThread(Handler h) {
>                 mHandler = h;
>         }
>
>         public void run() {
>                 int i = 0;
>                 setState(STATE_RUNNING);
>                 while (mState == STATE_RUNNING) {
>
>                         if (i > MAX_LOOP_COUNT) {
>                                 setState(STATE_DONE);
>                         } else {
>                                 if (i % 100 == 0) {
>                                         outIncreamentPercent = (int) 
> (((float) i / MAX_LOOP_COUNT) *
> 100);
>                                         
> rv.setProgressBar(R.id.customProgressBar,
> 100,outIncreamentPercent, false);
>                                         
> mNotificationManager.notify(NOTIFICATION_ID,notification);
>
>                                         try {
>                                                 Thread.sleep(100);
>                                         } catch (InterruptedException e) {
>                                                 // TODO Auto-generated catch 
> block
>                                                 e.printStackTrace();
>                                         }
>                                 }
>                         }
>                         i = i + LOOP_INCREMENT;
>                 }
>                 super.run();
>         } /* sets the current state for the thread, * used to stop the thread
> */
>         public void setState(int state) {
>                 mState = state;
>         }
>
> }
>
> --
> 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: How to create Android library in Eclipse?

2010-05-05 Thread joebowbeer
Are any of these workarounds compatible with Android test projects?

How do you prevent the Android library project, which is used by the
instrumented project as well as the test cases, from being added to
Test.apk and then failing at runtime with the cryptic "class resolved
by unexpected dex" error?

Joe


On May 4, 3:14 am, Max Gilead  wrote:
> There's even more hackish but perfectly working solution AND you get all the
> Android project niceties with it :)
>
> 1. Create regular Android project
> 2. Manually remove Android nature from .project file
> 3. Done :)
>
> Cheers,
> Max
>
> 2010/5/4 Mario Zechner 
>
>
>
>
>
> > Actually, i do something a bit nasty to get a seperate Android library
> > project. In your SDK folder you have several android jars for the
> > different Android versions. I simply create a Java project and add the
> > lowest Android version jar i want to support as a dependency et voila
> > you have a nice Android library project.
>
> > On 4 Mai, 08:11, Menion  wrote:
> > > 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 > > > >  cr...@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 > > >  cr...@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 > >  cr...@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 > cr...@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 
> 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/

[android-developers] CalendarSyncAdapter always sending event notifications

2010-05-05 Thread joebowbeer
To those developers who are playing with the unpublished Calendar API,
has anyone found a way to workaround the line of code in the
CalendarSyncAdapter that forces attendees to be notified when an event
is updated?

http://android.git.kernel.org/?p=platform/packages/providers/CalendarProvider.git

 --- CalendarSyncAdapter.java ---

// For now, always want to send event notifications
event.setSendEventNotifications(true);
 ---

Joe

-- 
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: Not calling OnStop when an incoming call is received

2010-05-01 Thread joebowbeer
On Apr 28, 8:02 pm, Ned Fox wrote:
> I have an application that is silencing the ringer while it is open,
> then when it closes it unsilences it. Currently I am doing these two
> things in OnStart and OnStop. The only problem (and it's a big one) is
> that when a phone call comes in, it stops my application (calling
> OnStop), then rings at its normal volume.
>
> Is there any way to get around this? I tried using onCreate and
> onDestroy, but I want to restore the original volume setting as soon
> as the program is closed, which onDestroy doesn't seem to do. Thanks!
>

Have you tried hooking onResume/onPause instead?

-- 
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: About Image taken time in Media Scanner.

2010-04-27 Thread joebowbeer
I think this bug may be related:

http://code.google.com/p/android/issues/detail?id=7369

The Camera assigns DATE_TAKEN=currentTimeMillis when it inserts the
photo
in the MediaProvider, but then the MediaScanner subsequently reads the
EXIF
info from the photo and updates the DATE_TAKE.

Problem is: the EXIF date doesn't have millis, just seconds. (Nor does
it
have a timezone, but that shouldn't be an issue if the phone and its
camera
share the same clock.)

On Apr 26, 9:27 pm, skan95 wrote:
> Dear all.
>
> Currently, Eclair 2.1 might have a problem when calculating image
> taken time during media scanning.
> When an image is captured in Camera, the taken time is written
> correctly in media DB.
> But if the device is booted, the image taken time is changed from
> original taken time to the time added as timezone.
>
> # \frameworks\base\media\java\android\media\ExifInterface.java.
>
>     public long getDateTime() {
>         String dateTimeString = mAttributes.get(TAG_DATETIME);
>
>         Log.e(TAG, "DATETIME " + dateTimeString);
>
>         if (dateTimeString == null) return -1;
>
>         ParsePosition pos = new ParsePosition(0);
>         try {
>             Date date = sFormatter.parse(dateTimeString+"Z", pos);
>             if (date == null) return -1;
>              Log.e(TAG, "Date = "+date + ", getTime = "+date.getTime());
>             return date.getTime();
>         } catch (IllegalArgumentException ex) {
>             return -1;
>         }
>     }
>
> 04-27 13:16:59.690: ERROR/ExifInterface(1531): DATETIME 2010:04:26
> 22:44:15
> 04-27 13:16:59.690: ERROR/ExifInterface(1531): Date = Tue Apr 27
> 07:44:15 Asia/Seoul 2010, getTime = 1272321855000
> ==> 9 hours is added to the original taken time.
>
> But, if same code is used in application, the return value is
> different from the value gotten from framework.
>
>     ExifInterface exif = null;
>     private static SimpleDateFormat sFormatter;
>     @Override
>     public void onCreate(Bundle savedInstanceState) {
>         super.onCreate(savedInstanceState);
>         setContentView(R.layout.main);
>
>         try{
>                 exif = new ExifInterface("/sdcard/DCIM/Camera/IMG001.JPG");
>         }catch(IOException ex){
>
>         }
>
>         if(exif != null){
>                 String date = exif.getAttribute("DateTime");
>             sFormatter = new SimpleDateFormat(":MM:dd HH:mm:ss");
>             ParsePosition pos = new ParsePosition(0);
>             try {
>                 Date dateFormat = sFormatter.parse(date, pos);
>                 Log.e(TAG, "Date = "+dateFormat + ", time =
> "+dateFormat.getTime());
>             } catch (IllegalArgumentException ex) {
>
>             }
>         }
>     }
>
> 04-27 11:36:32.165: ERROR/TimeZoneTest(6954): Date = 2010:04:26
> 22:44:15
> 04-27 11:36:32.175: ERROR/TimeZoneTest(6954): Date = Mon Apr 26
> 22:44:15 Asia/Seoul 2010, time = 1272289455000
>
> So, if SD card is detached and attached again, the taken time is
> changed as timezone time.
>
> If anyone knows or experiences, let me know how to deal with this
> case.
>
> 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] Market update of an app installed from another source?

2010-04-23 Thread joebowbeer
I haven't seen this answered anywhere so I thought I'd ask.

Can an app that was installed from an unknown source be updated from
the Market?  For example, if a private beta  is conducted off-market,
will the beta users be able to update from the market after the app is
published?  Or will they have to uninstall the beta version before
installing the market version?

I'm assuming that the certificate and package name of the beta app
match those of the market app.

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


  1   2   >