Java annotation using Pyjnius - android-webview

I copied this code to use android native WebView in my Kivy application. Works perfectly :)
Now, I would like to bind my JavaScript with my Kivy application.
I've read through this guide:
...
/** Show a toast from the web page */
#JavascriptInterface
public void showToast(String toast) {
...
How can I create a PyJnius class that has #JavascriptInterface annotation?
Thanks!

Related

How to add a shortcut to mobile homescreen in Xamarin.Forms?

How can I add a shortcut icon to mobile homescreen in Xamarin.Forms ?
I am a beginner in Xamarin and try to do this.
Edit:
Currently I don't have attached an Mac for IOS, yet
so what I want is to run only Droid for now
If you deploy your Android application via the Android play store, the shortcut will be added to the home screen automatically.
For iOS, it should get added by default when you install the app.
Add the following attribute to your Activity-class:
[Activity (MainLauncher=true)]
public class MainActivity: FormsApplicationActivity {
// ...
}
That should be all. For iOS there is no special action required.

Upload a file using Drag and Drop on the Browse button in the Browser

We are using file upload from the gwt but i want to upload the file by drag and drop in the browser. It is working fine with chrome browser but not working with Firefox because in Chrome it is showing choose File and Firefox it is showing Browse option. How can i upload the file in the Firefox browser by Drag and drop?
We are using GWT 2.5.1 and Smart Gwt 4.1.
We could do the drag and drop in any version of chrome but not in any version of firefox browser.
Code Snippet:
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.FileUpload;
import com.google.gwt.user.client.ui.RootPanel;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.FileItem;
import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.VLayout;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class TestApp implements EntryPoint {
#Override
public void onModuleLoad() {
VLayout vTest=new VLayout();
vTest.setBackgroundColor("#D3D3D3");
VLayout fileVLayout = new VLayout(10);
fileVLayout.setAutoWidth();
fileVLayout.setAutoHeight();
fileVLayout.setPadding(10);
final DynamicForm form = new DynamicForm();
TextItem filename = new TextItem();
filename.setTitle("File Name");
TextItem uploader = new TextItem();
uploader.setTitle("uploader name");
uploader.setWrapTitle(false);
**// Smart GWT**
final FileItem uploadfile = new FileItem();
uploadfile.setTitle("File Item");
uploadfile.setAlign(Alignment.CENTER);
**// GWT**
final FileUpload fileTest = new FileUpload();
fileTest.setTitle("File Upload");
form.setItems(filename, uploader, uploadfile);
form.draw();
HLayout fileHLayout = new HLayout(10);
fileHLayout.setHeight(10);
Label fileNameStaticLabel = new Label();
fileNameStaticLabel.setContents("File Upload");
fileNameStaticLabel.setWrap(false);
fileNameStaticLabel.setHeight("25px");
fileNameStaticLabel.setAlign(Alignment.RIGHT);
fileVLayout.addMember(form);
fileHLayout.addMember(fileNameStaticLabel);
fileHLayout.addMember(fileTest);
vTest.addMember(fileVLayout);
vTest.addMember(fileHLayout);
RootPanel.get().add(vTest);
}
}
Thanks in advance.
You're on the right track, just replace the native GWT code with Smart GWT code.
You are mixing GWT with Smart GWT components. You should not do that, per http://forums.smartclient.com/showthread.php?t=8159#aMix. "The reason for this is that there are limits to the maximum degree that two Ajax widget kits
(including GWT) can interoperate..."
Smart GWT has its own file picker, see http://www.smartclient.com/smartgwtee/javadoc/index.html?overview-summary.html (FileItem). And also it's own Canvas system: Don't use GWT RootPanel, use Smart GWT Canvas or VLayout, etc.
Though Smart GWT has "GWT" in the name, and though it uses substantial portions of GWT (GWT Compiler, etc), Smart GWT really is a framework unto itself. Aside from rare cases (e.g., login page), it's not advisable to mix Smart GWT with native GWT.

how to add multiple markers on the google map just by url?

I have an android application, I want to convert it to blackberry 10 , the google map is needed in the app,but the blackberry 10 do not support GoogleMap, the blackberry developer web site supply a way to replace it.The sample as below:
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
WebView webView = (WebView) findViewById(R.id.mywebview);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("http://maps.google.com/?ll=36.97,
-122&lci=bike&z=13&t=p");
}
I cannot really understand it,I do not know how to add multiple markers on the GoogleMap via url? who can help me?
This worked for me the map was shown in a webview.

GWT native drag & drop - DragStartEvent not firing on IE9

I have GWT 2.4.0 native drag and drop working with Chrome, Safari and Firefox. But on IE9, the drag start event does not fire and the cursor seems to go into a text selection mode.
Any ideas?
public class BaseFlowComponent extends Composite {
public BaseFlowComponent() {
this.initWidget(panel);
this.addDomHandler(new DragStartHandler() {
public void onDragStart(DragStartEvent event) {
event.setData("text", componentName);
event.getDataTransfer().setDragImage(getElement(), 10, 10);
}
}, DragStartEvent.getType());
this.getElement().setDraggable(Element.DRAGGABLE_TRUE);
}
}
This issue is fixed since http://code.google.com/p/google-web-toolkit/source/detail?spec=svn10138&r=10138.
GWT Team Test URL - http://gwt-cloudtasks.appspot.com
GWT Team Sample Code - http://code.google.com/p/google-web-toolkit/source/browse/trunk/samples/mobilewebapp/src/main/java/com/google/gwt/sample/mobilewebapp/client/desktop/DesktopTaskEditView.java
Ensure that you are running the sample code in the same browser and document mode in Hosted and Production mode. Also keep in mind GWT teams recommendation. https://developers.google.com/web-toolkit/doc/latest/DevGuideIE9
Ensure IE9 is not running under some IE8/IE7 compatibility mode.
For IE7 and IE8 the feature is disabled.
Reference -
http://code.google.com/p/google-web-toolkit/source/detail?spec=svn10138&r=10138
https://groups.google.com/forum/?fromgroups=#!topic/google-web-toolkit/0MkjaHsVfO4

ImageBundle - Unable to find image resource problem

Hi I'm trying to implement a ImageBundle for my gwt app.
#SuppressWarnings("deprecation")
public interface MenuImageBundle extends ImageBundle {
#Resource("icons/001_15.png")
AbstractImagePrototype fileNewIcon();
}
But I get this error when the gwt app calls for the fileNewIcon():
Unable to find image resource 'icons/001_15.png'
Although the icon image is in the icons folder in the WAR folder.
Anyone know how to fix this error?
Thanks.
icons package should be in your classpath. Look here for more information.