tags:

views:

44

answers:

2

i used the code below for my listview and textview .

Code:

textcontent.setText(Html.fromHtml(item.get_text()));
textcontent.setAutoLinkMask(Linkify.WEB_URLS);

XML:

<TextView
                android:id="@+id/txtview"
                android:autoLink="web"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:text="put your link here"/>

the link looks like url and i can click it but it generate this exception

android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag.

any idea how to solve this problem ?

A: 

Are you sure the click caused that exception not something you want to launch?

As I see you need to add the flags to the intent (not sure what is your intent though)

intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Pentium10
didnt solve it, but thanks for the answer .
Fevos
If so, maybe give us more from the Exception log, let's see the stack trace.
Pentium10
i have the List adapter in other class than the main Activity class and then i create object from the list adapter class from the main activity class and pass to it the context is that maybe the cause of the problem ?
Fevos
ListAdapter flareAdapter = new ListAdapter(LayoutInflater .from(getApplicationContext()), Items);
Fevos
+1  A: 

Don't pass application context to ListAdapter constructor. Pass your main activity instead.

ListAdapter flareAdapter = new ListAdapter(LayoutInflater.from(activity), Items);

Even if you create adapter in some other class you should pass main activity reference anyway.

Fedor
thanks for the hint , this is what i did and it worksContext aContext ;aContext = this;ListAdapter flareAdapter = new ListAdapter(LayoutInflater.from(aContext), Items);
Fevos