Skip to main content

Posts

Showing posts with the label honeycomb

TextView setScaleX()/setScaleY() and setTextIsSelectable(true) selection

I have TextView and want to use setScaleX()/setScaleY() to make the text zoomable. But when I try to select some text by calling someTextView.setTextIsSelectable(true); and TextView has zoom other than 1.0f the text selection markers apprear in wrong place, it seems that the selection is shown in the old place of selected text.

getActionBar() returns null

I'm having an odd problem. I am making an app with targetsdk 13. In my main activity's onCreate method i call getActionBar() to setup my actionbar. This works fine when running on the Android 3.2 emulator, but when using Android 3.0 and 3.1 the getActionBar() method returns null. I find this extremely odd, and i cannot see any reason why it would do so. Is this a bug with the emulators or is there something i need to do, in order to ensure that my application has an actionbar? SOLUTION: I think I've found a solution for this problem. I wasn't using the setContentView to set a layout for the activity. Instead I was using fragmentTransaction.add(android.R.id.content, mFragment, mTag) to add a fragment to the activity. This worked fine in 3.2, but in earlier honeycomb versions the action bar is apparently not set if you don't use the setContentView in the onCreate() method. So I fixed it by using the setContentView() method in my onCreate() method and ju

How do I fix Html.fromHtml link focus visibility problems (in ICS and Honeycomb)?

To get a TextView to display (and act friendly with) Html strings my code looks something like: // itemHtml is a String of HTML defined above TextView itemContent = (TextView) findViewById(R.id.itemContent); itemContent.setText(Html.fromHtml(itemHtml)); itemContent.setMovementMethod(LinkMovementMethod.getInstance()); If the Html string has a link, TextView results in links that are clickable and focusable. When the user focuses on a specific link (e.g. by using the d-pad), the link text changes in some significant way to show that focus was obtained. The problem is that when I test this same pattern using devices with a d-pad using Honeycomb (e.g. a Google TV) or Ice Cream Sandwich flavors of Android, the link in the text shows no noticeable indication that the link has focus. I know it is getting focus, because when you then hit enter it does the specified action. You can even move around between various links in the text; you're just left guessing which link you're

Loaders in Android Honeycomb

I'm trying to figure out how to use Loaders in Android 3.0 but can't seem to get it to work. The docs only describe using CursorLoader but I'm using AsyncTaskLoader. From the docs it seems that you should only need to implement AsyncTaskLoader.loadInBackground() but it never gets called after getLoaderManager().initLoader() and then creating the loader in the callback. I can see debug messages saying Created new loader LoaderInfo{4040a828 #0 : ArticleDataLoader{4036b350}} so it seems like it is created successfully. Is it possible that loaders are currently broken in the SDK or is there some method you need to call after creating the loader? (they don't do that in the CursorLoader example). EDIT: Seems like calling forceLoad() on the Loader returned from initLoader() starts the loading at least but this means you can't handle rotations correctly :(

Android dialog not showing on Honeycomb

I'm creating an AlertDialog in my Activity (which is set in Portraid mode in manifest file and in onCreate() ). When I'm testing my application on device there is no problem, but when I test in on Android Emulator 3.0 and I'm in landscape mode, in the beginning it's loading my application for a few milliseconds in landscape mode (I can see that in LogCat messages which I've added to my activity), enter in onResume() method of my activity and shows it on Portrait mode. But during this all I can see in my LogCat an error : Activity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@408512e0 that was originally added here I know why I receive this, but I don't know how exactly I can fix this. Here is how my Alert Dialog looks like : public AlertDialog createDialog(){ final CharSequence[] items = {getString(R.string.phone_memory)+" - "+memorysize+" "+getString(R.string.free_space)+" ", getString(R.st