Is htmlview too elementar? - java

This is certainly a very basic question, please excuse me if this is well known.
I made a Java app that generates a HTML file 'fileout' to be viewed locally (essentially a page with thumbnails that open bigger images with some javascript (not really needed); both thumbnails and images are in my sdcard). Then my app calls an intent to open the page, in the usual way:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(fileout), "text/html");
startActivity(intent);
The problem is that the app calls HtmlView, that behaves too restrictive: no back action to open another image, horrible title bar (I want full screen), not really good rendering of thumbnails, etc. So my question is:
Is there a way to configure Htmlview? How configurable is it? Does it understand javascript?
Moreover, if you think I would be better served with the default browser, how do I tell the app to open the browser instead of htmlview?
Sorry for the several-in-one questions, but they are all linked.
Thanks!
L.

Do you mean WebView rather than HtmlView? While WebView is fairly configurable and you could make it into a reasonable browser experience, it's a bit of work to do so. WebView does support JavaScript, but you have to enable it. As for "not really good rendering of thumbnails", that's rather vague. All in all, unless you have some specific need to run it in your own view, I would tend to prefer to just open the file in a browser if that experience is acceptable. Your current code should actually already do so... Perhaps the app selector popped up and you set it to use your app by default?

You can use WebView that will load html file you want and js hand by hand. This will allow you not to leave your activity or application at all.
WebView can be configured as you want it.
Idea:
Start new activity that will run with no title bar/windows fullscreen.
Read:
http://developer.android.com/reference/android/view/Window.html
for setting different window flags.
In your activity set content view to some WebView
Read:
http://developer.android.com/reference/android/webkit/WebView.html
Pay attention on .setJavaScriptEnabled(true);

Related

how can I make TV webapp using springboot with tizen?

I want to make a samsung smart tv app with tizen.
I've made an webpage using springboot.
I tried making the app using that webpage codes I made, but I've got to know Tizen doesn't support java but html, css,and javascript only.
So I used meta http-equip="refresh", and let index.html go to my webpage url,
but there were long loading time, and ugly ui for a waiting page..
also remote control's pointer was weird. (not focusing on a certain button, but there is a cursor)
is there no way to solve this problem?
I've tried to find a way but I couldn't. please help me...
It seems that you are making a redirect to your website (hosted in internet).
Maybe would be better starting reading the basic concepts about Samsung Smart TV apps here
If you try to open external content (hosted websites) into your app the TV will use its web browser to open it.

How to show dialog when app is in background in android app like collect app

image
I am sharing a link from another app like youtube to my app but Now it opens my app and then saves the link. My need is to not save the link without opening the app
There are two solutions:
You don't need dialog or anything like it. Just make the activity fully transparent, process data and finish it. Optionally, you can show Toast as a feedback. It would look and feel like everything is processed in the background.
You need dialog or some kind of UI. For this, you can use floating windows that you can show over other apps. Many apps use this approach such as Pocket, etc. There is complete guide on how to do it: https://localazy.com/blog/floating-windows-on-android-1-jetpack-compose-room

How Do I Make Android WebView Load Page Modal Elements?

I'm trying to make a really simple app for a friend to display his bar's ordering website in an app for when they reopen with the social distancing measures in place. The web app already exists, so this is really a simple matter of displaying the content in a WebView.
I've got the page loading, the content is visible, the styling is done - The only problem is that it doesn't seem to be loading all the elements. There's a line of filters at the top which just display as 3 dots (i.e. loading), and when I click any of the items on the menu, nothing happens. There should be a window pops up asking for a table number etc... If I open this in the Chrome browser on my phone, rather than a webview in the app it works perfectly so I know it isn't the website.
I've done the following;
setJavaScriptEnabled(true);
setJavaScriptCanOpenWindowsAutomatically(true);
setSupportMultipleWindows(true);
I've also turned off safe browsing in the manifest in case that was blocking anything. I have also given the app permissions to use the internet. I can't figure this one out at all and nothing online seems to be helping!
Admittedly I'm a tester (automated, but still), so coding isn't my best suit. I may be missing something really simple here. Any ideas?
Scratch that. For anyone who's interested, I needed to add this line;
setDomStorageEnabled(true);
For such a simple thing it proved impossible to find info on, I just enabled everything until something worked! So hopefully you don't have to do the same if you're looking at this.

A JavaScript that clicks automatically over a flash object on document ready?

I got a flash document I CAN'T modify, that starts its animations only when pressing a button it has on it. I tried EVERY script I found on the internet but nothing worked. I need to simulate the click on that button so the flash animation can start! Is this possible?
If there are no APIs (which give you access to the elements),
you cannot interact with the Flash UI, because the Flash content has its own context, where JavaScript has no access to it.
You can try to decompile your flash file and get FLA-project of it. There it is possible to make required changes and create new swf.
There are many swf decompilers, but there is no 100% guarantee for successful decompilation (especially for big and complicated flash applications)

Posting/clicking buttons java

i have some basic knowledge of java (made little programs to help everyday life) Now the thing is i want to make a program that posts offers on a site every 2-3 minutes. I have never done anything with java related to the internet and web pages and even after browsing the internet i am clueless. How would i go about setting up a connection to a certain page click a certain button on that page and then fill in 3 boxes with information and post the offer?
Here is what i have to click:
Here is the form i have to fill in:
You have to learn a bit more about how HTML form works, but basically browser sends a POST request to the webserver with the values from the form.
Chrome's Developer Tools, Firefox's web developer toolbar has a functionality what can help you to discover what request is sent to the server when you post a single form. Of course you have to fill the values with your heart content
If you already know what content you want to send, you can post it relative easily, it is described well with examples in this StackOverflow answer https://stackoverflow.com/a/4206094/182474.
But I strongly recommend to discover how browsers works internally from the aspect of HTTP protocol, because it is a very useful knowledge if you want to develop tools that interacts with web APIs or simulate posting HTML forms.
You could use java.awt.Robot class and make all this thinks =)
you only need to write your manually action to the automated action =)
move mouse on text
write this...
tab
write this other..
tab press enter
wait N second
hope it helps! =)

Categories