Article reading application - WebView or TextView? - android

I am trying to create a reader-type application for a particular website, so reading experience is essential. Of course I want to preserve article formatting as author inteded (via basic html tags (p, br, img) - no CSS so far).
The problem is that I am having hell of a time displaying this in a textview the way I want with Html.fromHtml method. And dont even get me started on images, theyre all over the place.
Ive always been taught that webview is a no-no for native experience and its performance sucks, but then I learnt that Google Currents app uses it, and it even allows text justification, which is always nice for reading.
So .. what would you do? Hack that TextView into behaving or stick with WebView? Would it be so bad? Is there a way to figure out what the popular reading apps like The Verge are using?
Thanks!

I wrote the BGR app, among others, and I think you should go web view. I personally think that its a bad choice when people use it for a whole app, or to do the work that an app should be doing, but web views exist for formatting, so use it.

Related

Display algebraic equations that look as nice as Tex in TextViews in Android Studio?

I spent like a half hour researching and many suggestion are either years oudated/no longer existent, and me being a programming beginner who doesn't know how to do more advanced things than basics like adding text/buttons/etc. and basic programming logic into Android Studio activies, I'm totally lost. Some suggestions mention inserting HTML with JavaScript references but I haven't found a guide that explains how to do it, and those making the suggestions listed some cons, too. E.g. How would I display 5^2 (without the '^' and the '5' in superscript form), '1/2' in neat fraction form, etc., in a TextView or whatever other text component? I searched through the Android developer reference as well but didn't see anything that 'intuitively' stood out to me, for the lack of a better word.
You could achieve this by using WebView and JS. An example of such library for Android is: https://github.com/KaTeX/KaTeX.
I think you can use MathJax for doing that. Please refer to this GitHub repository.
MathJax

What tools are better to create a mobile app with a db, buttons, forms

I'm a noob self learning programmer and i'm wondering how can i make an application for mobile. As an example, so you can understand what i need (and easier for me to explain), think of an application where the user can store products and related information by filling forms (an icon, price, name, features, weight...) and then consult stored information.
For me it looks like the best way to create it is by using web related tools like HTML, CSS, MySQL...
The problem i find is that i don't know how to create a web shaped application and then turn it into a mobile app.
I'm sorry if i didn't explain the best way, but hope you guys get my point are able to put me in the right way!
Thanks a lot in advance!!
P.S. Beyond HTML and CSS and a little MySQL i have basic knowledge of JS, C++ and C#.
As a newbie, it's better to do the correct choice at the beginning.
For Android development, the entry point is the developer portal: https://developer.android.com/
The app you've thinking of is quite classic: You won't have troubles to find some tutorials on the web.
You can do that with either SQLite or Firebase Realtime Database, you choose.
I guess, the easiest way will be creating responsive website and then include that in your app as a WebView. However, this might give users the feel that you're just loading the website in a WebView if you don't include some features like, maybe, push notifications, update checker, theme changer, something like that.
You can alos find a lot of easy tutorials and templates to build a WebView app.
P.S.: I myself have made an Android app of my friend's blog by first making a website and then using WebViews.

Displaying rich content with images, videos and text. custom solution or webview?

I can't deside what is the best approach for an Android App i'm building on a Parse server.
In this app i will have a lot of content that will be like blog posts, with many images, videos and text.
I was thinking of creating a layout with code and add all those content elements on the fly from the ParsePlatform database.
I can also have those post on a wordpres site and show them with a webview
Is webview a better approach? Those are my concerns:
I guess parse is way faster than a blog website.
If the website for some reason stop working the app will have null
content. if the parse database has a problem the user might not be
able to login.
What is the best and correct approach? i feel that webview is not a good idea. how other big applications with rich content in many screens does this?
If it's heavily rich, and seems like a web page, I think it's best to use a web page.
If you choose it, consider optimizing and making it look fine on mobile. Maybe even make it have material design, if possible.
Choosing webView has its own disadvantages, but you get a viewer out of the box, without a lot of messing around with parsing and possible memory issues.

Hyperlinks working while viewing page from web browser on PC but not on Mobile (Android)

To begin, my web programming knowledge is very dated. I learned some html/java back in high school about 15 years ago and for fun have decided to put it to use and help a friend make an offline web based html database for a collection of his data that up until now he's kept in nothing but word and excel docs. So there is nothing fancy here. I'm mainly just formatting and linking pages. And make a ton of use out of tables. Lame, I know.
Anyway, here's the issue I've run into...
I'm pretty much done. I've just been going and fixing mistakes here and there. Grunt work. Every so often I've tried to display it on my Samsung Galaxy Note 2 and been rather pleased with the results. I'm not using any program that alters the display for mobile or anything. Just straight html/java with a bit of css I've started to learn while taking on this project. So sometimes I have to pinch to zoom and make the page fit on my mobile device, but I'm not too worried about it.
The problem I've come across is that a series of the pages with tables on them don't appear to work correctly. Each table has links to anchor points further down the same page. On PC, these links function properly. But for some reason on my phone when I tap on those links they don't respond at all. Not every page with tables has this issue I should note, only a small cluster.
All I'm using for code is an 'a href' tag in the table leading to an 'a name' anchor further down the page.
Any ideas?
You might be using HTML5, a tags don't have a name attribute.
try using:
id="titleofyourchoice"
instead of:
name="titleofyourchoice"

Bad Idea to create HTML content in android app?

I'm creating an app that needs to display a table, with say, 30 columns and 30 rows. I want the user to be able to use swiping to move around the table/spreadsheet. The idea is that probably the entire table will not be visible on the screen, and if it is, it will hardly be readable, so there will have to be some max-columns-on-screen value. Each cell in the table must be capable of being a different color than the rest.
So far, I've looked into TableLayout. This doesn't seem to support different colors or swiping... actually, it does support different colors via .xml, but this isn't changeable at run time, and seems like it would be very messy anyway.
WebView looks to be an option, as I am proficient with HTML/CSS but can't find many resources about creating HTML and CSS content on the fly with android - only loading it; although I can imagine writing a file with the data and then loading it, and deleting the file. Not sure if any of this is good performance wise.
What direction should I head, before I start heading in the wrong direction? :-)
Yes, it is possible (and not difficult) to support different colors and gesture in the tablelayout rows.
I think it is always a wiser choice implementing the native components, once it has a better performance and it has a better layout adjust to different android versions.
Either method can solve the problem, so it's a judgment call based on your goals and requirements.
On the plus side for Android native views:
They are pre-compiled and easier to parse than HTML, so they will load faster, scroll more quickly, and require less memory.
If you intend to write a lot of Android apps you will need to learn them.
If you took this route, a typical approach to draw multiple columns would be a ViewPager with sliding tabs. See for example the Google Play Store app.
It's not the case that coloring native views dynamically is impossible or messy; it's not hard at all but it takes time to learn how, which brings me to the plus side for HTML/webview:
A programmer with expertise in HTML will solve problems faster by just using HTML.
Layouts designed in HTML for an Android web view can be re-used on other platforms.
Again, it's not really hard to load dynamic HTML into a web view. There are a few tricks you will need to learn but that's it.

Categories

Resources