1. I have some basic knowledge about Android programming but really don't know how to start with Web part of blockly on android - what information should i read about to be able to test Web embedded blockly on android? I found the mobile demos read-me but i would like to have more background knowledge.
2. While going through blockly github pages I also found another great starting point - Scratch Blocks, but again, where can i find some deeper information about setting it up on Android. Is it also done by means of webView or can it be implemented by using native library.
--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
1. I decided to use Blockly embedded in android WebView approach and got a bit lost. I more less know what to do but i need to ask about some details. Right now i would like to communicate my webview fragment with my main activity. I found that it is possible by means of ViewModel, is it the best thing to do?
2. In Demo project for webview in android (https://github.com/google/blockly/tree/develop/demos/mobile/android) in file BlocklyWebViewFragment.java i found really helpful TODO but still i struggle to differentiate what should be done in html and what in java. Right now i would like to write methods which generates string from blocks in my workspace, but the problem is i dont know if it should be done within this java file.
mWebView.evaluateJavascript( |
3. What webAppInterface class is for ?
4. Lastly, is highlighting blocks available for WebView since the header in the article says "Highlight Blocks (Web Only)"?
mWebView.evaluateJavascript(
"Blockly.JavaScript.workspaceToCode(workspacePlayground);",
code ->Toast.makeText(getContext(), code, Toast.LENGTH_SHORT).show());<script type="text/javascript">
var workspacePlayground = Blockly.inject('blocklyDiv'(...)
Hi Mikolaj!
A few debugging questions:
1. Have you tried using Blockly.mainWorkspace instead of workspacePlayground?
2. Could you try printing the code instead of using Toast.makeText just to double check that something isn't getting lost there?
Thanks!
Abby
private void generateCode(){
Log.d("WEBVIEW", "Code gen invoked");
String codeCopy = "";
mWebView.evaluateJavascript(
"{var code = Blockly.JavaScript.workspaceToCode(Blockly.mainWorkspace); console.log(code); return code};",
code -> codeCopy.concat(code));
Toast.makeText(getContext(), codeCopy, Toast.LENGTH_SHORT).show();
Log.d("WEBVIEW", "Code gen finished");
}
private void generateCode(){
Log.d("WEBVIEW", "Code gen invoked");
mWebView.evaluateJavascript(
"{var code = Blockly.JavaScript.workspaceToCode(Blockly.mainWorkspace); console.log(code); return code};",
code -> Toast.makeText(getContext(), code, Toast.LENGTH_SHORT).show());
Log.d("WEBVIEW", "Code gen finished");
}
private void generateCode(){
Log.d("WEBVIEW", "Code gen invoked");
mWebView.evaluateJavascript(
"var code = Blockly.JavaScript.workspaceToCode(Blockly.mainWorkspace); console.log(code); code;",
code -> Toast.makeText(getContext(), code, Toast.LENGTH_SHORT).show());
Log.d("WEBVIEW", "Code gen finished");
}
private void generateCode(){
Log.d("WEBVIEW", "Code gen invoked");
mWebView.evaluateJavascript(
"var code = Blockly.JavaScript.workspaceToCode(Blockly.mainWorkspace); console.log(code); code;",
code -> {Log.i("WEBVIEW", "code: "+code); Toast.makeText(getContext(), code, Toast.LENGTH_SHORT).show());}
Log.d("WEBVIEW", "Code gen finished");
}--
private void generateCode(){
Log.d("WEBVIEW", "Code gen invoked");
mWebView.evaluateJavascript(
"Blockly.JavaScript.workspaceToCode(Blockly.mainWorkspace);",
code -> {Log.i("WEBVIEW", "code: "+code); Toast.makeText(getContext(), code, Toast.LENGTH_SHORT).show());}
Log.d("WEBVIEW", "Code gen finished");
}Hello everyone,
Quick introduction about myself - currently I am finishing my Telecommunication studies and as a thesis i proposed to create coding app for kids (6-12 years old) which introduces basic coding notions. The tool on which user operates is block language while mobile phone with all its sensors, lights and speakers is a way of interaction or showing the results to the user. The starting point for my work is of course Blockly. But here are my problems:
1. I have some basic knowledge about Android programming but really dont know how to start with Web part of blockly on android - what information should i read about to be able to test Web embeded blockly on android? I found the mobile demos read-me but i would like to have more background knowledge.