Luka
Luka

Reputation: 13

Phonegap and Android: Send data from Native to Javascript

What is the best way to send array of data from native code (java) to the javascript code (phonegap)?

I'm calling script from DroidGap class.

public class MyClass extends DroidGap

Inside MyClass I am calling:

MyClass.this.sendJavascript("javascript: app.basic('" + js + "'); ");

Variable js is variable, where I put all the data like "4,5,6,23,123" etc.

Problem:

It sends data to javascript normally, but the UI in javascript frozes for second.

Any ideas?

Upvotes: 0

Views: 1675

Answers (1)

Dawson Loudon
Dawson Loudon

Reputation: 6029

You may want to try running the javascript send on a new thread. There is an example of creating a new thread here:

http://docs.phonegap.com/en/3.0.0/guide_platforms_android_plugin.md.html#Android%20Plugins

Upvotes: 1

Related Questions