4

i am creating a listview. in that list each item has text view. and in text views i am defining linkify texts based on data from the web service..

now when i click on that linkify text i am getting error like

09-21 20:27:38.031: ERROR/AndroidRuntime(766): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=\"ticbeat.com/socialmedia/fa…" (has extras) 

please help me solving this problem.. any answer with solution will highly appreciated.

Update:

Code:

if(urlentities[position]!=null && dpurlentities[position]!=null)
            holder.twtdata.setText(Html.fromHtml(timelines[position].replace(urlentities[position],"<a href=\\\""+dpurlentities[position]+"\">"+urlentities[position]+"</a>")));
MKJParekh
  • 34,073
  • 11
  • 87
  • 98

2 Answers2

8

Look like you need to put http:// at the beginning of that URL. Without the protocol specifier Android appears to assume "content://" is the intended url type.

Moog
  • 10,193
  • 2
  • 40
  • 66
0

Linkify by default opens the default browser (new activity). I'm guessing you pass getBaseContext() as context to the TextView(Context context). You have to pass the activity as Context for that to work by default. If you are concerned about memory leaks you can try getApplicationContext() but haven't tested it.

The best way to handle that is to create a listener at the TextView fired on onclick() of the span . Your activity (the one that created the textView() catches that listener and then the activity opens the browser. Here you can see how to make your own listener

Another way to do that is to implement a WebView in you layout and all you have to do from the textView is to show that webView with the link clicked. getBaseContext() can do that.

weakwire
  • 9,284
  • 8
  • 53
  • 78
  • i am using Custome Adapter to fill data in List, and calling adapter like this adapter = new EfficientAdapter(MainActivity.this); but still getting the same error..do i need to define anything that how the link should execute...I UPDATED MY QUESTION TO SHOW CODE..PLZ CHECK ONCE – MKJParekh Sep 22 '11 at 04:56
  • thank you my problem was my mistake..but that knowledge of passing context to adapter also was really very helpful – MKJParekh Sep 22 '11 at 06:41