Guys I am trying to add large text with a website link like (https://stackoverflow.com/questions/ask) in my textview Located in database
I tried adding it directly like this image :
picture of my value in databse

But it appeared in the application on the form Textview not clickable like this image :
output app

protected void onPostExecute(String result) {
// Parse les données JSON
String id;
String solution;
try {
JSONArray jArray = new JSONArray(result);
for (int i = 0; i < jArray.length(); i++) {
JSONObject json_data = jArray.getJSONObject(i);
id= json_data.getString("alltext");
solution = json_data.getString("title");
prob.setText(solution);
sol.setText(id);
// Résultats de la requête
}
} catch (JSONException e) {
Log.e("log_tag", "Error parsing data " + e.toString());
}
}
Just like Buttons and ImageViews we can add onClickListeners to TextViews by simply adding the attribute android:onClick="myMethod" to your TextView XML tag. The other way, TextView tv = (TextView) this.
To call linkify in android, we have to call linkify. addLinks(), in that method we have to pass textview and LinkifyMask. Linkify. WEB_URLS: It going make URL as web url, when user click on it, it going to send url to default web browsers.
android.text.method.LinkMovementMethod. A movement method that traverses links in the text buffer and scrolls if necessary. Supports clicking on links with DPad Center or Enter.
Set the AutoLink to web in TextView it will automatically detect the links
<TextView
android:autoLink="web"
android:text="This is Google http://www.google.com"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With