1

I have an android app which pulls text data from a SQLite database (located in /assets/ folder). The problem is, if i store a hyperlink, say http://example.com in my SQLite database, it is rendered as normal text in my android app. It's not clickable. How can i pull a clickable hyperlink from SQLite database and show it in my app?

1
  • call setMovementMethod(LinkMovementMethod.getInstance()); on the textview loading the link?
    – G_V
    Nov 6, 2014 at 13:40

3 Answers 3

0

If it's a TextView, include the following in the definition:

android:autoLink="web"
1
  • i am newbie to StackOverflow, voteup requires 15 reputation. Don't mind, will you just upvote my question for now ;)
    – Ufaq Khan
    Nov 6, 2014 at 13:58
0

Use Linkify for transforming text containing links into text with clickable links.

0

The URL stored in your SQLite DB is just text like you mentioned. If I understand your question what you want is to trigger the browser and open the URL you have stored in your DB?

If so, you can simply query the URL from the SQLite DB and do the following to display it in the default browser.

String url = 'http://example.com';  // Get it from your DB as you are doing now.
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
startActivity(intent);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.