I have a TextView
in my ArrayAdapter
that may contain some hyperlinks. For those links I use Linkify
:
public View get
Looking at the exception in the log, it seems that you used the application context when you allocate your ArrayAdapter
. For example, if your code looks similar to the following:
listView.setAdapter(new ArrayAdapter(context,
android.R.layout.simple_list_item_1,
data) {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// ...
}
});
You must have initialized the context variable above with the application context, like this:
Context context = getApplicationContext();
To avoid the error, you should have initialized it with your Activity
instance instead:
Context context = this;
Or, if your code is in a Fragment
:
Context context = getActivity();