2017년 5월 23일 화요일

Snippet "How to display some HTML text in a webviewer" error



I´ve programmed this blocks:









But on my device (Sony Xperia Z1 Compact) it displays this text when I click the Button:























Can you help me?

PS: The text of the file DisplayHTMLText.html is the same as it returns.

--
your webviewer somehow displays the source code of the html page
does the test project work for you? you can download it here http://puravidaapps.com/snippets.php#2webviewstring2

-- 
Yes, it does.


--
Check your code ;) Blocks and html look OK though.... 

-- 
Sorry, this topic isn´t right here. But i tell you now a story:
I´ve forgotten that I rename the component in the really name (Tools = TaifunTools), but when I would like to rename the component... Ah, just look at the video in the annex.

Error when I access Taifun Tools 


Can it be related to this?

-- 
I don't think so

-- 
Tried renaming TaifunTools both ways on the test aia (on import and in the component box. No difference, still works.

What else is going on in your blocks? Suggest strip back the specific blocks to match the example aia and see if that works, then build back up from there until you find what causes the problem? 

-- 
I send you all blocks of this project (see annex).
It´s a docs app. With this you can view Documents.

-- 
Where are the webviewer blocks then?

-- 
Sorry, false screen.


-- 
without correct path obviously it will not work

-- 
That was the error with TaifunTools, see my messages above.


--
if you don''t want to use the extension, then use the following

Yes, you also can upload html files as assets into App Inventor! There is only one special thing to consider: During development, you have to use the development path to the embedded html document:
file:///mnt/sdcard/AppInventor/assets/<NAME OF YOUR HTML FILE>.html

Before packaging the app, use the production path.
file:///android_asset/<NAME OF YOUR HTML FILE>.html

-- 
Where can I embedd the code?

-- 
you might want to play around with the examples again to understand, what I was saying previously...

PS: The text of the file DisplayHTMLText.html is the same as it returns.
you probably forgot to upload the jQuery library into the assets of your app?

-- 
Right, i don´t have upload the jQuery library into the assets.
Where I can find it?

-- 
you find the library in the assets of the example project, just extract it from there
I will add a note on the website...

-- 
Even after I upload the jQuery library, it shows the same as in the screenshot above.
Any ideas how can I fix it now?

-- 
do you use the correct path now?
what about using the working example and adjusting it to your needs?

-- 
See the blocks in the annex.


--
Why not try putting on a timer, so call the clock to do the uri encode, or after the uri encode to call the webviewer, could be a timing issue in there somewhere?

-- 

Hide keybord after sending email


hope that everyone is ok ! :)
There is my issue, when i click a button it's oppening my mail client.
After i send my email, Gmail closed and i return to the app but the keybord stay open.
The only way I know to close it is to use the textbox.hidekeybord fonction.
But this will not work in that case.
Does anyone had ever have this issue ?
Do I miss something ?


--
There is also a Screen1.hidekeyboard method. Maybe that one works?
Otherwise there must be something in your code that makes it not execute the hideKeyboard.

--
Thx for your help.
I tried the Screen1.hidekeyboard but it doesn't work too.
Maybe i place it at the wrong place ?
Here is my code ? Do you see something wrong ?


--
sorry Wrong atachment
Here is the good one


--
the screenshot looks fine
after coming back into your app does the Screen1.HideKeyboard work manually using Do it?

--
It's not. Making a screen error :(

--
Error message :
" No focusable view found"
Any Idea ?


--
use one of the other mail solutions instead, for example the IFTTT solution

--
I can't be the sender. The user have to use his own mail client.
Otherwise it would have been à ggod solution.

--
Sharing component will be nice too, but I can't find a way to put the mail to in the code so the user don't have anything to do except clicking on Send.
The msg will contain previous value selected by the user, and be send to an mail adress (that I don't own).
Do you see any other way to do it ?

--
Seems the issue is that the mail client is bringing up the keyboard, so the mail client needs to make it go away ?

Will the smartphone hard/soft "Down" key make it go away? ( I recognise you want it to disappear "programatically") or will it not hide at all ?

Or is the keyboard up before you go to the mail client, in which case can you make it hide before the activitystarter?

--
Thx for your time.ble view found
As you can see on top, the message error was "No focusable view found".
So i just try to put a text box, also put a Screen1.hidekeyboard on GoBacktoMenu button.
It's working, when i click on it, it's hidding the keyboard.
BUT, what I would like is the keybord hide himself once the user sent his email, that way, when he come back to the app after sending his email, it's clean.
Do you have any Idea ?

--
As you can see on top, the message error was "No focusable view found".
you get that error, if you try to close the keyboard while there is no keyboard open
try Tim's suggestion and close the keyboard in the email app

--
Sounds like the keyboard is open in the app before ActivityStarter, so close it before "leaving" the app to go to the email client ?

--
what do you mean by " close the keyboard un thé email app" ? How Can I get client mail to close the keyboard automaticaly ?

--
keyboard is not previously open in the app. The user never use the keyboard except for this email part.

--
Does the problem occur in the Companion and the built app?

--
Both oh them

--
Well, I found a workaround.


1/ The fonction Screen1.HideKeyboard need a focusable view to close the KeyBoard, so don't forget to put a TextBox on your screen with Heigth & Width to 1 Px.
2/ I used a clock with timer set up to 5 ms. When the user click on the SendEmail button, it's trigger the timer to close the keyboard every 5 Ms.
3/ When the keyboard is hidden, you have to set up a trigger to set TimerEnabled to false. For that, I use WhenSceenError with code error 906.

It's maybe not pretty, but it's working ! :) 



--
Is there an extrakey or extravalue that can be sent to the mailapp to stop it opening the keyboard?

Or what "result" is generated by the mailapp on return to appinventor ?

--
Well done Jules

--
Hummmm I maybe spoke to fast.
It's not working the first time i click the Mail button. Back button allow me to hide the keyboard, if I click again on mail button, this time it's working.
Any idea why ?
@ Taifun: a simple extrakey to send to the mail app will be nice. Any idea ?

--
This should be registered as a bug, or at least something to be fixed by the MIT Developers

If you just use the Gmail app on its own, the keyboard disappears once you send a message, and retrnes to list of emails, but not so if accessed via ActivityStarter

--

back button is clicked, then can we put apk into background as "home" button?


I have a question about the action of "back" button clicked. I knew there is a way to handler BackPressed in screen, but it only provided the options of yes/no/cancel, actually instead of "no" or "cancel", I would like to put the app running in background as "home" button clicked. 
do you have any suggestion?

--
Use Android Studio.    App Inventor apps cannot run as a Service.  That means they cannot run in the background.  Also AI can use the BackPressed soft key but cannot use the Home soft key.

-- 
Actually I did see your reply regarding this topics, basically AI2 does not support it. 

And the reason I am still asking this question is because it seems to be working in some extent. For my APK, I started BLE connections, and I can send commands to BLE server to control the LED light for example, if I clicked "home" button or "power" button, the application is actually running in background for my understanding, then I selected this app back by collapse application window, I can see BLE connection is still here (I use timer to count it) and I still can control the remote by sending data via BLE connection. 

 However, it will NOT work when I click "back" button, That is why I was keeping asking about it. Is there any way to put app as clicking "home" button. 

-- 
You did NOT read this part  ' AI can use the BackPressed soft key but cannot use the Home soft key.'    AI cannot use the Home soft key but Android Studio can.

-- 
I understood your point. I was not looking for AI to use Home Soft Key, but my question is that when "backPressed", can AI do similar thing as "home" key pressed? since right now as I mentioned, there are three options "yes/no/cancel", surely, I did not want to quit the applicaiton, but just want it running as "home" key pressed. 

not sure if we can do it

-- 
You might be using the HOME button as a start extra task button,
if your Android settings don't destroy other tasks.

This is the equivalent of alt-tabbing in Windows.

I don't believe the first app runs, it just
is suspended.

-- 
you might want to try the MoveTaskToBack method from the simple notification extension

--