cocos2d-x Jni c++ java互调 并且相互刷新UI控件最简单例子(下

来源:未知 责任编辑:责任编辑 发表时间:2014-01-20 07:51 点击:

 

 

c++ 调用java 篇:

 

c++调用java。同事刷新android的Edit View控件

 

 

第一步:

\

第二步:创建布局文件

\

第三步:

 

public static EditText myView;

\

第四步:添加文本输入框

\

 

LayoutInflater inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);

myView =(EditText)LayoutInflater.from(this).inflate(R.layout.myedit,framelayout,false);

myView.addTextChangedListener(watcher);

myView.setMovementMethod(ScrollingMovementMethod.getInstance());

 

framelayout.addView(myView);

 

 

第五步:添加监听

 

\

 

TextWatcher watcher = new TextWatcher()

{

 

@Override

public void afterTextChanged(Editable s)

{

// TODO Auto-generated method stub

Log.d(TAG,111111);

}

 

@Override

public void beforeTextChanged(CharSequence s, int start, int count, int after)

{

// TODO Auto-generated method stub

Log.d(TAG,22222);

}

 

@Override

public void onTextChanged(CharSequence s, int start, int before, int count)

{

Log.d(TAG,33==[TextWatcher][onTextChanged]+s);

}

 

};

第六步:

\

public static void hideAdView(String[] str)

{

mHandler.obtainMessage( 100, str ).sendToTarget();

}

 

private static HandlermHandler =new Handler()

{

public void handleMessage(Message msg)

{

switch (msg.what)

{

case 100://UPDATE_UI:

{

String[] arrStrings = (String[])msg.obj;

if(arrStrings[0].equals(I'm a titile))

{

TestJni.this.myView.setText(C++ Change Java EditView string Test!);

发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
用户名: 验证码:点击我更换图片
最新评论 更多>>

推荐热点

  • cocos2d-x学习笔记(19)--label 、label atlas
  • cocos2d-x学习笔记(23)--地图的使用3--CCTMXLayer
  • Cocos2d-x学习(一):HelloWorld
  • cocos2dx在xcode下开发,编译到android上(2)
  • cocos2d 设置屏幕默认方向
  • cocos2d-x学习笔记(22)--地图的使用2(TMX) --Z-Order、AnchorPoi
  • Cocos2d-x 2.0 之 Actions “三板斧” 之一
  • cocos2d-x学习笔记(18)--游戏打包(windows平台)
  • cocos2d-x学习笔记(16)--spritesheet(精灵表单)
网站首页 - 友情链接 - 网站地图 - TAG标签 - RSS订阅 - 内容搜索
Copyright © 2008-2015 计算机技术学习交流网. 版权所有

豫ICP备11007008号-1