Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MainActivity extends Activity implements CordovaInterface{
- .....
- .....
- public void changeText(String txt){
- textView = (TextView) findViewById(R.id.textView);
- textView.setText(txt);
- }
- }
- public boolean execute(String action, JSONArray args, final CallbackContext callbackContext){
- if (action.equals("changeText")) {
- ..............
- }
- }
- }
- <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- tools:context=".MainActivity" >
- <org.apache.cordova.CordovaWebView
- android:id="@+id/tutorialView"
- android:layout_width="match_parent"
- android:layout_height="196dp" />
- <TextView
- android:id="@+id/textView"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/hello_world" />
- </RelativeLayout>
- cordova.getActivity().runOnUiThread(new Runnable(){
- public void run() {
- textView.setText("Cordova Hello World");
- callbackContext.success();
- // Thread-safe.
- } });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement