Using "android:textAppearance" on TextView/EditText fails, but "style" works-ThrowExceptions

Exception or error: This is a sample TextView in XML, which will properly apply the style TextContactContactName to the TextView. <TextView android:id=”@+id/name” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_toRightOf=”@id/photo” android:layout_alignTop=”@id/photo” android:paddingLeft=”10dp” android:text=”First Last” style=”@style/TextContactContactName” /> Now, I have some other things to set on this element, which are not text related. As such I tried to move the TextContactContactName …

Android – ListView doesn't receive OnItemClick for textview with clickable links-ThrowExceptions

Exception or error: I have a ListView that contains a TextView in each row besides a number of other views. The TextView renders html content which may contain links. The below code appears in the list adapter. m_textview.setMovementMethod(LinkMovementMethod.getInstance()); m_textview.setText(Html.fromHtml(myhtmlcontent)); This causes the listview to no longer receive on click events though. I decided to put …

android – Application context for SharedPreferences?-ThrowExceptions

Exception or error: Can I use ApplicationContext for working with SharedPreferences and starting, for example, RemoteService? Logically, I think that I can. Are there any nuances in such an approach? How to solve: as Gunnar Karlsson mentioned ContextWrapper’s getApplicationContext() usage its pretty clear that you should only use Activity or Service Context to register/unregister your …

java – AsyncTask and Contexts-ThrowExceptions

Exception or error: So I’m working out my first multi-threaded application using Android with the AsyncTask class. I’m trying to use it to fire off a Geocoder in a second thread, then update the UI with onPostExecute, but I keep running into an issue with the proper Context. I kind of hobbled my way through …

Android TextView: Getting "W/StaticLayout: maxLineHeight should not be -1. maxLines:1 lineCount:1" when setting text-ThrowExceptions

Exception or error: I’m setting some text on a TextView every 0.5 seconds based on a timer. Everytime, when the timer runs and the text is set, I’m getting this warning message being spammed in my console. W/StaticLayout: maxLineHeight should not be -1. maxLines:1 lineCount:1 XML Code: <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” xmlns:tools=”http://schemas.android.com/tools” android:layout_width=”match_parent” android:layout_height=”match_parent”> <TextView android:id=”@+id/title_text” …

android – Rich text in a textview-ThrowExceptions

Exception or error: I need create an “Info” for my program. I’d like fill the info text with several colors, style, fonts, ecc. I found this: http://www.chrisumbel.com/article/android_textview_rich_text_spannablestring is there another way (better easy) to do this? thanks! How to solve: Upon reading your question title, I was prepared to give you a link to that …

android – How can I focus on a collapsible action view EditText item in the action bar (when it is expanded) and force the soft keyboard to open?-ThrowExceptions

Exception or error: I am using Jake Wharton’s excellent ActionBarSherlock library and have a collapsible search action view. I want to popup the soft keyboard when the search action view is expanded. We can read a recommended way of doing this in a DialogFragment in the “Using DialogFragments” blog post by Google (altered a bit …