I followed a tutorial on a site to install a RSS Parser in my application. Now, the Reader looks great; however I want to program it so that when a Link is in clicked on, the URL is opened in a webview activity. Is this Possible? I will post the code that makes the RSS feed visible to the reader.
public class MessageList extends ListActivity {
private List<Message> messages;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.rss);
loadFeed();
}
;
private void loadFeed(){
try{
BaseFeedParser parser = new BaseFeedParser();
messages = parser.parse();
List<String> titles = new ArrayList<String>(messages.size());
for (Message msg : messages){
titles.add(msg.getTitle());
}
ArrayAdapter<String> adapter =
new ArrayAdapter<String>(this, R.layout.row,titles);
this.setListAdapter(adapter);
} catch (Throwable t){
Log.e("IML News",t.getMessage(),t);
}
}
}
First of all you should look at this : http://developer.android.com/reference/android/text/style/ClickableSpan.html
Then i found you a tutorial:
http://www.androidengineer.com/2010/08/easy-method-for-formatting-android.html
Read it and you’ll learn how to format your text in textviews like in Html. You’ll be able to make clickable links.
Then when a link is clicked just open a webview like usually.
Ask if you want more 😉