Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which one is better between TextView or WebView?

Currently I'm about to display HTML data into my application with fragment. I'm confused of which one I need to use to get better performance between TextView or WebView. I mean, for rendering speed and memory issue.

Know that Html.fromHtml() is available for TextView to display HTML formatted data but I want to try WebView instead of TextView. But don't know rendering speed and memory issue.

like image 499
PPShein Avatar asked Dec 13 '12 10:12

PPShein


People also ask

What is alternative of WebView in android?

Alternatives to WebView If you want to send users to a mobile site, build a progressive web app (PWA). If you want to display third-party web content, send an intent to installed web browsers. If you want to avoid leaving your app to open the browser, or if you want to customize the browser's UI, use Custom Tabs.

What is the use of TextView?

A TextView displays text to the user and optionally allows them to edit it. A TextView is a complete text editor, however the basic class is configured to not allow editing.

Can I use WebView?

If you want to deliver a web application (or just a web page) as a part of a client application, you can do it using WebView . The WebView class is an extension of Android's View class that allows you to display web pages as a part of your activity layout.


2 Answers

WebView internally provides different functionality for the display Html data. Also you can use JavaScript in WebView.

While TextView when you are use Html.fromHtml() then its support only few Html tags. So I think its better to use WebView.

I just mentioned JavaScript functionality but There are other functionality like (Zoom Functionality, Image from web, etc..) All supports in WebView.

like image 155
user370305 Avatar answered Oct 21 '22 05:10

user370305


depends for what you wish to use it.. if you are loading website and want all the features of that website to be available you should use webview. If you are only displaying one html snippet you should use textview

like image 27
kjurkovic Avatar answered Oct 21 '22 05:10

kjurkovic