How can I limit how much is shown in WebView? - android

I am working on an application that uses WebView to display multiple documents that are hosted online. Preferably, I'd like to have it set so that no scrolling is required. Instead, a "Next" button could be used to bring up a "new page" that would be a continuation of the text.
For example, one of the documents this application would read can be found at
http://www.missionstclare.com/english/May/whole/morning/24m.html
Is there a way to easily break the document up so that it only shows what would fit in the viewport?
Note: This is for an android app using eclipse.

There is no easy, out-of-the-box way to do it.
If you are running the server, then you can check for the user agent and serve a smaller page to the device.
If you are not, you will need to use an URLConnection, retrieve the text, parse it, and display chunks of it in the WebView.

Related

Open local video on Android device, from a QR code

Background
Some teams in my company's facilities are using Android tablets for multiple operations. We would like to allow them to access video demos from their tablets, when they are at specific places in the facility, without having to search through the tablet for the right video. So we thought of QR codes (printed on paper, stuck to the wall). Problem is: for security reasons, we can't allow the devices to access any network.
Question
So the idea is to store the videos locally, and have the QR code route to the local file. I thought this would be easy but it doesn't appear to be.
I have generated QR codes like file:///path/to/my/file.mp4, also trying to play with intents, like this:
file:///path/to/my/file.mp4#Intent;scheme=file;action=android.intent.action.VIEW;type=video/mp4;end.
(+ variants including intent://, using scheme=file, targeting images instead of videos...)
In the best cases, the browser opens, closes, and I receive "Cannot display file. Invalid PDF", and in the worst cases, "Sorry, the application could not be launched. The bar code content may be invalid.".
I also tried variants (images instead of videos, URL vs plain text QR codes, several code scanner applications), all with the same result. I have searched through SO, but most questions are about doing this programmatically in an application, while I would like to avoid designing an app just for this.
What am I doing wrong? Is there no way to do this that way?
Note: I had absolutely no knowledge about Android and intents before trying to solve this case, there may be smarter workarounds. Any hint is appreciated.
Given the network requirement within your company, it seems building a simple application is the easiest solution(maybe because I am an app developer).
So your app would need only 2 screens. QR code Scanner and a View that shows the video.(once you click done, go back to scanning)
The app can have all the videos you need prebuilt in the app itself and the QR codes can be the names of those videos.
Okay, I don't know if you are using web page or any android app for this fature, for web page you need to create your own scanner or integrate ready made solution i found 1 here, you will need setTimeinterval so it scans bar code once, Once barcode is found you will need to call your ajax method to fetch complete URL of that video, once any item is returned, you need to display it in iframe.
Hope it works for you.

How to change Wordpress content when accessing using a specific URL

I have a Wordpress webpage working great, now I've been asked to develop an Android application with a simple web view that would load the webpage but when using the app it have to change some web behaviors.
Usually you go to the Home, and you have categories like: Services, last deals, projects...
The idea when using the app is going direct to the login page and change the menĂº categories, so some pages would be hidden and another ones would appear.
I've seen the #media way to do it, but I don't want to apply all these changes by resolution, but for type of device.
I checked this out: https://wordpress.org/plugins/simple-mobile-url-redirect/ but then when I redirect to the custom URL and I do the changes, I don't know how to preserve them, while navigating to other pages.
Is there any way of preserving that "mobile session"? or would it be a good choice to create a sub domine and replicate the webpage for mobile? (www.mobile.webpage.com)
I understand your situation and the best idea would be to generate screens using your own code. IN order to get the data from WordPress, you can call WP-Rest handles to get the data.
Alternatively if you only want to load webview, your web team will need to do custom code in order to facilitate your request. The idea is to send query variables to the website when calling from mobile app. Once the url is called, the WP code needs to set up transient/session/cookie and display custom result if transient/session/cookie is set.
I am sorry, I can't find the exact code that I used for somewhat similar work but if your web team has ever dealt with transient or custom session, they should be able to do this without any issue.

How can I capture the whole web page in an Android phone while using its browser?

When I visit a web page using Android browser I can capture the visible part of the web page making a screenshot of the whole screen, but I need capture the whole web page, including the part of the web page that is outside the screen, I mean, not just the visible part of the page.
What I want is something like the option "Capture Entire Page" of Awesome Screenshot plugin. Pls, exclude all the programming method for do this, I want a already made tool easy to use for a newbie Android. The idea is allow common users reports layout bugs easily. So, what tool can I use to accomplish that?
A VALID REPLY IS SUCH TOOL NOT EXIST, but pls, put some reference.
You can use the Dolphin browser and Screen Cut add-on to capture full webpages on an Android phone. You do not need root access.
You cannot use any standard android method to get screenshot of entire screen (including non visible portion). But if you have root access, you can read the framebuffer to get the entire contents using this method
https://play.google.com/store/apps/details?id=com.leavjenn.longshot
This does exactly what you want. I have tested it.

displaying user info from website inside Android application

Hey I'm building an app that will allow a user to log into a site (mygranturismo.net) and then will display their personal info, (cars owned, trophies earned, level status, etc) in a layout on the screen. i need to be able to get this info and place certain bits right where i want, also some may be clickable links to other info inside the site. I don't want to simply link to the site, i want to access certain parts and display then in my custom app. an example would be the difference between twitter on Android vs twitter on a pc browser. Any help would be much appreciated.
It sounds like what you're describing is a native mobile application to work with an existing website that's not optimized for mobile. If you own the website, you can create private pages for simplified data retrieval. If it's a website that you don't own, you will need to read the raw HTML and extract the useful info from it. How you do it is up to you, but it will involve string searches and cut/paste of info from the HTML text. The danger in doing this is that if the website owner changes the layout of his pages it will probably break your application.

Any disadvantages to using WebView as opposed to TextView in Android

I am making an app a bit like a dictionary, where a user clicks on a word and get a display of an image and an explanation of that word. I know that WebView allows me to use html formatting but I have read that it takes a lot of memory. Is there any disadvantage to using a WebView in this way or should I use a TextView?
WebView works well on my phone, an HTC Wildfire.
TextView works fine if you only want to display text -- or only very simple formating.
If you want to display something more advanced, WebView will definitely allow you to do more, as it allows one to use Full-HTML.
Of course, this requires more power... but, still, if you are only using one WebView at a time on your screen/activity, it cannot be worse than when using the browser application -- and that one works fine, doesn't it ?

Categories

Resources