Android - webview removing header and footer displaying only selected contents - android

i need to convert a complete website into an android app. But I don't want the header, menu and footer in every page to be displayed.
Is there any way I can just take the content of the webpage alone and display in web view.?
Thanks.

If you are using joomla...i have a solution that worked for me....
Go to template settings, hide the logo, menu and footer section
In your app you wll not see any header, footer and logo

Do you have control over the website's source? If yes, it is much easier to write a css-file for mobiles (and use JS to detect the UserAgent) than to do any of that work in the mobile app itself.
However, if you really want to mess with the page on your device, you can extract the html-source, change it (delete the header+menu+footer), and load that changed source into the webview.

Related

WebView vs Chrome Custom Tab

I am building an app where in a Detail Activity I have to show a web page.
I was going to use WebView, but then I saw Chrome Custom Tab.
What do you guys think it's better to implement and why?
If you just want to show a certain page then I would suggest you use chrome custom tabs. You can style the toolbar in a way it resembles your app style and they are intended for showing content without you having to worry much about anything else.
if you want to have full control over what the user is doing inside this website you have to use a webview. (you can prevent the user clicking links on the webview, you could intercept data the user inputs into controls on the website...)
But this can also be a negative aspect since the user really has to trust you that you don't log his data or even fiddle with it.
summary: "The WebView is good solution if you are hosting your own content inside your app. If your app directs people to URLs outside your domain, we recommend that you use Chrome Custom Tabs"
-> If it isn't your website you probably should go with custom tabs.
https://developer.chrome.com/multidevice/android/customtabs#whentouse
Webview : If you want your own content which has click listeners and data interception you need to go to webview. But It wont share the state with the browser.
Chrome Custom tab : If You are just redirecting to a url, i prefer chrome custom tab. But it has little cons too. We wont change its title text color where we can change the titlebar color. The text color will be chosen by the theme color only. And We can add actions, but we cant change the overflow menu icon or the entire actions displayed in the overflow action.
Even though the limitation are not a big deal. I recommend chrome custom tab over webview.

How to create book app for android?

I want to build a simple book app for android that contains 100 pages of text-only content using android studio.
First activity to enter , 2 buttons for navigating to next and previous page and page number indicator. Also when page indicator clicked, a window pops up for entering specific page number.
Which way is better for this purpose ? Database or HTML method ?
Is there any source code or tutorial resources ?
I have done this using HTML method. What I did is I created HTML files for all the pages, then zipped all the pages.
After that unzipped it into android file system then using WebView I am able to view all the pages like a book app does.
I have added next page, previous page, and search button also.

android : Customize dropdown's radiobutton open from webview

I am developing android application which is based on the webview.
The page loaded in the WebView has dropdown. When I click on the drop down, a dialog appears(it is the native Android dialog).i want to apply my them for that dropdown dialog item. i have searched but solution not found for that.
FYI, I have implemented it in the native activity but not able to implement it in webview.I want dropdown alert like displayed in below image.
Please help me, if anyone knows related to this issue.
You need to understand the concept of a Webview. It is just like a browser which you are loading inside your activity. Your other activities in the app can not interact with the webview. If you want to change the style of your dropdown for android's webview, use Media Queries in your website which will change the view of your website when loaded for smaller devices

How do you create the Browser layout (search bar on top, webview on bottom)?

I'm trying to mimic the default android Browser app layout, which has a "search_bar" on top and then a "webview" right below it. The user can scroll both items up, all the while the scroll bar only appears to the right of the webview (not both the webview and the search bar).
I've tried putting both the webview and the searchbar into a scrollview, but this shows the scrollbar next to the search_bar.
If you need to mimic the exact layout of default browser have a look at it's source code:
Where can I find Android source code online?
If you need only browser source have a look here:
https://android.googlesource.com/platform/packages/apps/Browser
From what I can see (a quick look at it) it is more complicated layout, but you may start analysing it from:
Browser\res\layout\browser_subwindow.xml
which directly includes WebView. This file is directly loaded by Tab... Go ahaed and analyse it on your own it is pretty simple as it is a regular Android application.
Hope it helps.

Android - Creating own buttons in webview, retrieving certain contents from website into webview

I'm currently doing a application (project) on android. I would like to know how to create my own buttons in webview, or creating a tab bar in webview. Also, I would want to retrieve certain contents from a website (or rather, from livejournal, to be specifc), like, I do not want the buttons that are in livejournal itself, I just want certain contents, maybe like some live journal posts. Is there any way I could do this?
Thank you so much in advance!
Instead of putting tabs in the WebView you should put the WebView in Tabs. As for pulling information from LiveJournal there are two possibilites. They either have a public api that you can access to get the data you want and use that to populate your app or they don't. If they don't your only recourse would be to pull in the raw html and try to parse it. At that point you might was well just use the webpage as is.

Categories

Resources