[android-developers] Does a phone have to be unlocked before rooting or custom ROM installation will work?

2012-05-26 Thread HippoMan
I have purchased and successfully rooted a few of Android devices in the past, and I have also installed custom ROM's on most of them after rooting ... such as the Cyanogen ROMs. However, each time in the past, I had performed these actions on an unlocked device. Now, I'm thinking of purchasing a

[android-developers] Re: Determining in advance how much text will fit into a given TextView?

2010-12-18 Thread HippoMan
On Dec 18, 4:54 am, Kostya Vasilyev kmans...@gmail.com wrote: [ ... ] Use this instead of measureText, to avoid calculating width for the same text over and over again (from current position to the end of the string). Thank you very much. -- You received this message because you are

[android-developers] Re: Determining in advance how much text will fit into a given TextView?

2010-12-17 Thread HippoMan
Yes, but I can only apply this math if I know how the text will be word-wrapped. This means that I have to word-wrap it myself and then do the calculations. The problem with this is that I may not wrap the text the same way that the TextView (or other subsidiary object) wraps it. I'm sure I can

[android-developers] Re: Determining in advance how much text will fit into a given TextView?

2010-12-17 Thread HippoMan
Thank you! Now I think I more or less understand the basic principles that are outlined in that article, and I'm pretty sure that I'll fill in any remaining gaps in my knowledge as I dig in and apply these principles to my own case. I'll post my results or any questions I might have if I hit any

[android-developers] Re: Determining the subset of text that is visible in a TextView

2010-12-14 Thread HippoMan
Hello. Sorry for the late reply. For some reason, your response didn't show up in the same thread as my question, and I only noticed it now. I have already looked through the TextView source code. The drawing of the text in the view is not done within that object. A subsidiary object handles this

[android-developers] Determining in advance how much text will fit into a given TextView?

2010-12-14 Thread HippoMan
In a different thread, I asked if there was a way to query some object to define what subset of a long piece of text is actually being shown within a given TextView. Based on the scant feedback I received in response to this query, I have come to the conclusion that android probably does not

[android-developers] Re: Determining in advance how much text will fit into a given TextView?

2010-12-14 Thread HippoMan
I've already looked at the TextView source, as well as the source of the Paint object and other objects. I haven't been able to find anywhere where the data I'm looking for is stored, or at least returnable. But there are many android objects to look through, and as I mentioned, I'm trying to

[android-developers] Re: Determining in advance how much text will fit into a given TextView?

2010-12-14 Thread HippoMan
PS: Is there perhaps a better object to use for this purpose than a TextView? -- 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

[android-developers] Re: Displaying unicode in a TextView?

2010-12-02 Thread HippoMan
Ah, yes. I see that I just happened to luck out, as the file.encoding property on my device must be (currently!) set to utf-8. Thanks. This begs another, related question: how do I know what encoding to use, in the first place ... for a TextView in the Android environment? If I cannot count on

[android-developers] Re: Displaying unicode in a TextView?

2010-12-02 Thread HippoMan
PS: I am writing Android-specific code. The class I am using will never work outside of the Android environment, for reasons that go beyond the issue of character encoding. So does this mean that in my case, I _should_ do the moral equivalent of this? String content = new String(bytes,

[android-developers] Re: Displaying unicode in a TextView?

2010-12-02 Thread HippoMan
Yes. I should have written this after drinking my morning coffee. On my way to work, I woke up a little and remembered that this encoding pertains to the _source_ (in my case, the epub bundle) and not the _destination_ (the TextView). Luckily, I know something about the source: epubs are supposed

[android-developers] Re: Displaying unicode in a TextView?

2010-12-02 Thread HippoMan
Yes. I should have written this after drinking my morning coffee. On my way to work, I woke up a little and remembered that this encoding pertains to the _source_ (in my case, the epub bundle) and not the _destination_ (the TextView). Luckily, I know something about the source: epubs are supposed

[android-developers] Re: Displaying unicode in a TextView?

2010-12-01 Thread HippoMan
Thank you. I have checked the items that I am displaying, and all of them contain tags like this: meta http-equiv=Content-Type content=text/html; charset=utf-8/ In every case, the charset is specified as utf-8 or UTF-8. Apparently, this is not sufficient to cause the text to be interpreted

[android-developers] Re: Displaying unicode in a TextView?

2010-12-01 Thread HippoMan
Thank you very much. 1) I am not explicitly setting any unicode character code in the TextView. I display data that exists within e-books that are stored in epub format. I do not alter this data at all. I display it as is. Most of this displays OK, but quotes look like the following garbage ...

[android-developers] Re: Displaying unicode in a TextView?

2010-12-01 Thread HippoMan
PS: I forgot to add that after I build this map, I just do the following to display the text within my TextView: // this.section is a String which holds the name of the // ebook section that I want to view. It must be a key // to the above-mentioned LinkedHashMap containing the //

[android-developers] Re: Displaying unicode in a TextView?

2010-12-01 Thread HippoMan
OK. I figured it out after thinking more about what you said in your item 3. I need to convert the bytes that come out of the zip file into correct unicode. I changed the method as follows, and now it renders the characters properly: private boolean readEpubFile() { FileInputStream f

[android-developers] Re: Displaying unicode in a TextView?

2010-12-01 Thread HippoMan
... but I should actually use a ByteArrayOutputStream to avoid breaking up unicode characters that might span the 65536-byte boundary of my input buffer: private boolean readEpubFile() { FileInputStream f= null; ZipInputStream z= null; byte

[android-developers] Re: Displaying unicode in a TextView?

2010-12-01 Thread HippoMan
I should clarify that I now don't need to do this: String content = new String(bytes, UTF-8); This is because java's default is unicode. I get the same result with or without the second argument to the String constructor. I now see that my original error resulted because I was converting to

[android-developers] Re: Displaying unicode in a TextView?

2010-11-30 Thread HippoMan
Thanks. I'll check the content variable later today or tomorrow and post back here. In the mean time, I'm wondering if perhaps this isn't a unicode issue, after all. Upon closer examination, it seems that the only characters that appear as garbage in the data I'm examining are quote characters

[android-developers] Displaying unicode in a TextView?

2010-11-29 Thread HippoMan
I am parsing epub books, and I want to render the pages inside of a TextView. I am able to get the book content, and I display it as follows. Assume bookContent is a String which contains the text from an epub book section, and assume that this.view is a reference to my TextView ...

[android-developers] Displaying unicode in a TextView?

2010-11-29 Thread HippoMan
I am parsing epub books, and I want to render the pages inside of a TextView. I am able to get the book content, and I display it as follows. Assume bookContent is a String which contains the text from an epub book section, and assume that this.view is a reference to my TextView ...

[android-developers] Determining the subset of text that is visible in a TextView

2010-11-19 Thread HippoMan
Assume I have a block of text that is too long to fit into a standard TextView. When I put that text into the TextView via the setText() method, it gets truncated. Is there any way that I can then query this TextView or some other component in order to find out the subset of the text which is

[android-developers] Determining the subset of text showing in a TextView?

2010-11-19 Thread HippoMan
Assume I have a block of text that is too long to fit into a standard TextView. When I put that text into the TextView via the setText() method, it gets truncated. Is there any way that I can then query this TextView or some other component in order to find out the subset of the text which is

[android-developers] Re: Morphing TextView background images?

2010-04-16 Thread HippoMan
Thank you very much. I am wanting changeable text to appear in the images. Is it possible to superimpose text on an ImageView? If so, then this will provide the exact functionatlity that I'm looking for. -- You received this message because you are subscribed to the Google Groups Android

[android-developers] Re: Morphing TextView background images?

2010-04-16 Thread HippoMan
I should clarify that I want the text to be wrapped and centered on the images, just like the effect I would get by setting the following attributes on my TextView: android:layout_width=fill_parent android:layout_height=fill_parent android:gravity=center_vertical|center_horizontal I

[android-developers] Re: Morphing TextView background images?

2010-04-16 Thread HippoMan
I just tried your suggestion using two TextViews within a FrameLayout. It works perfectly, so I don't have to worry about manually wrapping text within an ImageView. Here's the logic: In my onOptionsItemSelected() method, after a menu click: * TextView 1 is currently in the front * Put a new

[android-developers] Re: Generating a static HashMap from resources?

2010-04-15 Thread HippoMan
Yes, I forgot that ever since Java 5 (or maybe earlier?), the Java Memory Model definition specifies that classes are ininitialized just in time; i.e., not until they are first accessed. I mulled this over for a while, and in the end, I still opted for code generation. Although the code

[android-developers] Re: Generating a static HashMap from resources?

2010-04-15 Thread HippoMan
Yes, I forgot that ever since Java 5 (or maybe earlier?), the Java Memory Model definition specifies that classes are ininitialized just in time; i.e., not until they are first accessed. I mulled this over for a while, and in the end, I still opted for code generation. Although the code

[android-developers] Morphing TextView background images?

2010-04-15 Thread HippoMan
I'd like to change the background image of a TextView by morphing it into the new image. What I mean by this is that I want the old image to fade out at the same time the new image is fading in, so that it looks like the old image is transforming itself into the new image. I know how to cause the

[android-developers] Re: Generating a static HashMap from resources?

2010-04-13 Thread HippoMan
Thanks, but your suggestion won't work for me, because I can't statically access the values of arrays defined as resources. These arrays can only be retrieved via an already created Context object through the use of getResources().getStringArray(). Recall that I am looking to use these values to

[android-developers] Re: Generating a static HashMap from resources?

2010-04-12 Thread HippoMan
My main reason is that I want to have public static final mapped values available to a number of classes. This way, I can instantiate other static final fields using some of the mappings in this HashMap. I can't do that if I have to decode an XML file at run time. If I could dereference

[android-developers] Out of memory and no useful stack trace

2010-04-11 Thread HippoMan
My android app is getting an Out of memory error without a useful stack trace. It occurs after I have repeatedly re-invoked its main logic through a menu interaction, which leads me to believe that there's a memory leak somewhere. I say that the stack trace isn't useful because it doesn't include

[android-developers] Generating a static HashMap from resources?

2010-04-11 Thread HippoMan
In my app, I'd like to define some static resources in an xml file which can be accessed via a HashMap. I know I can do this at run time in a manner similar to the one which is described here:

[android-developers] Re: Generating a static HashMap from resources?

2010-04-11 Thread HippoMan
OOPS: I wrote aadb, above, but I meant to type aapt. -- 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] Re: Out of memory and no useful stack trace

2010-04-11 Thread HippoMan
Thanks to both of you. I'm now going to try what each of you suggested. -- 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] Re: How to force my TextView to get measured?

2010-04-11 Thread HippoMan
Does anyone have any ideas or suggestions about this? I know I can subclass TextView and then override the onMeasure() method to retrieve the view's measured dimensions. However, onMeasure() gets called _after_ I make a call to setBackgroundDrawable() on my TextView object. I want to get the

[android-developers] Re: How to force my TextView to get measured?

2010-04-11 Thread HippoMan
Does anyone have any ideas or suggestions about this? I know I can subclass TextView and then override the onMeasure() method to retrieve the view's measured dimensions. However, onMeasure() gets called _after_ I make a call to setBackgroundDrawable() on my TextView object. I want to get the

[android-developers] Re: Auto-centering and auto-clipping TextView background?

2010-04-11 Thread HippoMan
I'll look into 9-patch images. I'm sure the learning curve will be worthwhile. 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

[android-developers] Timing out an AsyncTask?

2010-04-09 Thread HippoMan
I know how to use AsyncTask in a standard manner to manage operations that are in the background in relation to a UI thread. However, I want to run a task in the background which might run for a very long time under certain circumstances. In these cases, I would like to force the background task

[android-developers] Re: Timing out an AsyncTask?

2010-04-09 Thread HippoMan
Of course I know about cancel(). When I mentioned the use of get(long timeout, TimeUnit unit), I thought it would be obvious that I would then invoke cancel() to terminate my overly-long-running task. But then, my UI thread would block while I'm waiting, as I stated above, which is not desirable.

[android-developers] Re: Timing out an AsyncTask?

2010-04-09 Thread HippoMan
OK. Thank you. So how do I interface to my UI from the new thread that I start? Once the long-running task completes (assuming it finishes before my time- out period), I want to notify my UI thread so it can take appropriate action. If this was a short-running task, I could have easily used the

[android-developers] Re: Timing out an AsyncTask?

2010-04-09 Thread HippoMan
OK. I'm going to make a wild guess as to how I might do this. Could someone comment on the reasonableness of this approach under Android? ... 1. As part of my Activity class, define a message type called, for example, MESSAGE_LONG_RUNNING_TASK_RESULT. 2. As part of my Activity class, define a

[android-developers] Re: Timing out an AsyncTask?

2010-04-09 Thread HippoMan
Thank you, social hub. Our messages crossed. I think that the message handler I describe in my previous post is the same one that you are referring to. -- 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] Auto-centering and auto-clipping TextView background?

2010-04-04 Thread HippoMan
Is there a way to tell Android to do the following when setting the background image for a TextView? 1. Scale the image so that it's just large enough to fill the the entire viewing area without any black borders, while still maintaining its aspect ratio. This might require clipping once the

[android-developers] How to force my TextView to get measured?

2010-04-02 Thread HippoMan
I have an Activity that makes use of a TextView that's defined in a standard manner in layout/main.xml. In my app, I want to get the dimensions of the drawing area in order to decide how I am going to draw into it. If my TextView is referenced as this.tv, I know I can get these dimensions by

[android-developers] Re: super.onResume() at beginning or end of method? Does it matter?

2010-04-01 Thread HippoMan
Thanks to all. I also have generally been sticking with the pattern that's described here. I guess that will be mostly safe, taking Bob Kerns' exception into account. And thanks to Bob Kerns for submitting that issue. I hadn't realized that there was no known contract for this. I hadn't found

[android-developers] super.onResume() at beginning or end of method? Does it matter?

2010-03-31 Thread HippoMan
In general, does it matter in an Activity if I put the call to super.onResume() at the beginning or the end of my own onResume() method? In other words, I can do this ... @Override public void onResume() { super.onResume(); // do my stuff } ... or this ... @Override public void

[android-developers] Re: Programmatically setting a new default ringtone without the ringtone picker

2010-03-29 Thread HippoMan
I can't see why your default ringtone is reset on each reboot. Did tou try TapSound freely available on Android Market ? The second tab simply set your ringtone from any .mp3 on your sdcard. I don't know why this happens, either. The ringtone I use is one of the standard ones which comes with

[android-developers] Re: Programmatically setting a new default ringtone without the ringtone picker

2010-03-29 Thread HippoMan
On Mar 29, 5:32 am, HippoMan hippo.mail...@gmail.com wrote: Is there no way to set the default ringtones programmatically, without using the ringtone picker? ... nor with any application that requires human interaction? -- You received this message because you are subscribed to the Google

[android-developers] Re: Programmatically setting a new default ringtone without the ringtone picker

2010-03-29 Thread HippoMan
On Mar 29, 5:32 am, HippoMan hippo.mail...@gmail.com wrote: [ ... ] I don't know why this happens, either. [ ... ] I should add that I am not using any app which affects sounds or ringtones, at least not that I know of. -- You received this message because you are subscribed

[android-developers] Re: Programmatically setting a new default ringtone without the ringtone picker

2010-03-29 Thread HippoMan
I figured out a way to do this. This is a stripped down version (no error checking, etc.). I set the default ringtone and notification to my preferred values from out of the standard set that comes with my N-1. Then, I make sure that the volume is set to the maximum on ringtones, notifications,

[android-developers] Setting new default ringtone without using RingtonePicker?

2010-03-28 Thread HippoMan
I'd like to programmatically set a new default ringtone without using RingtonePicker. In other words, there is a certain ringtone that is already installed on my system, and I want to programmatically set it to be my default ringtone without any human interaction. The reason I want this is

[android-developers] Programmatically setting a new default ringtone without the ringtone picker

2010-03-28 Thread HippoMan
I'd like to set a new default ringtone without using the ringtone picker. In other words, there is a certain ringtone that is already installed on my system, and I want to programmatically set it to be my default ringtone without any human interaction. The reason I want this is because every time

[android-developers] Additional code generation after aapt runs?

2010-03-21 Thread HippoMan
I'd like to do some additional code generation after the R.java file has been created by aapt. Specifically, I want to auto-generate some helper methods to retrieve items from R.java. Is there any way put my own, custom utility in place which will generate this extra code as part of every Android

[android-developers] Re: Additional code generation after aapt runs?

2010-03-21 Thread HippoMan
On Mar 21, 1:28 pm, Kumar Bibek coomar@gmail.com wrote: I don't think so it is possible. Thank you, but after much digging around, I figured out that this is indeed possible. Here's what I did (under MacOSX; it should work the same under Linux, but there will no doubt be slight differences

[android-developers] Re: Additional code generation after aapt runs?

2010-03-21 Thread HippoMan
On Mar 21, 4:13 pm, Bob Kerns r...@acm.org wrote: [ ... ] Instead, I'd just use an xslt ant task to generate your helper class -- call it X -- and make it import R. If you like, you can even make it a subclass (and give it inner classes that are subclasses of R's inner classes). [ ...

[android-developers] Re: Additional code generation after aapt runs?

2010-03-21 Thread HippoMan
On Mar 21, 7:34 pm, Bob Kerns r...@acm.org wrote: Actually, mine runs as part of the normal build process too. Using ant builder instead of a program builder gives you full cross-platform compatibility. We're both adding builders, just different types. Either one will work fine. But I

[android-developers] Re: Additional code generation after aapt runs?

2010-03-21 Thread HippoMan
On Mar 21, 8:48 pm, HippoMan hippo.mail...@gmail.com wrote: Also, I can't figure out how to get my auto-generated class to refresh in the IDE after it gets re-created. I have to select Refresh or hit F5 in order for any changes to be noticed. If I use ant, will I be able to force the refresh

[android-developers] Re: Additional code generation after aapt runs?

2010-03-21 Thread HippoMan
Never mind. I just didn't have proper Refresh settings. I fixed them, and now everything refreshes the way it's supposed to. -- 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] Re: Functional retrieval of strings?

2010-03-19 Thread HippoMan
Let me get this straight - you would rather have a runtime exception that you just catch and ignore than a compile time error that will quickly identify your problem and allow you to fix it on the spot? Why exactly would you prefer this? I want to change the behavior of my app by means of

[android-developers] Re: Functional retrieval of strings?

2010-03-19 Thread HippoMan
Resources has getIdentifier() for this. However, this is significantly less efficient than just using the R static data member. Use it if you have to (and cache the lookups), but avoid compile errors doesn't strike me as a great reason to do so. Thank you. As I described in more detail in my

[android-developers] Functional retrieval of strings?

2010-03-18 Thread HippoMan
I know that I can retrieve a string within an Activity as follows: this.getString(R.string.foobar) (assuming that I have previously defined a string named foobar). However. I'm wondering if there also might be an alternate way to retrieve this same string in a functional manner, without an

[android-developers] Enabling code for earlier OS versions under the 2.1 SDK?

2010-03-15 Thread HippoMan
Under the 2.1 SDK, is there a way to test for the phone's OS version within the app, and to enable or disable features based on this OS version? In other words, I'd like to do the moral equivalent of this ... if (os_level 1.6) { // code goes here } else if (os_level 2.1) { // code goes

[android-developers] doInBackground and varargs?

2010-03-15 Thread HippoMan
I understand how varargs work and the java mechanics for using them within the doInBackground() method of AsyncTask. However, I'm not clear about why varargs are used here and under what circumstances there will be more than one argument passed to this method. I have some specific questions: 1.

[android-developers] Re: doInBackground and varargs?

2010-03-15 Thread HippoMan
OK. I got it. I missed the fact that several arguments could be passed to execute. Everything else is now clear to me. Thanks for the explanation. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to