OPENFL Update 2.0, the Android Input method can not lose Chinese

Source: Internet
Author: User

Today hand cheap updated a bit openfl,fd inside again various error. The saddest thing is that the previous method of modifying Mainview.java input Chinese is now invalid. Fortunately this period of time study c2dx, finally is able to read the code that can understand the changes, tinkering with an afternoon, is solved.

OPENFL Previous version of Android Chinese solution original address:

http://blog.csdn.net/rocks_lee/article/details/8274194

New lime1.5.7 +openfl2.0.1. Do not know whether it is lime or OPENFL, after the upgrade directly removed the NME call. So change the original NMU under the Mainview.java also useless. Under Lime also have Mainview.java file, I tried to add override found Glsurfaceview below with Ben no Onkeymultiple method to cover me. And the Onkeychange from the original two parameters into three parameters. Totally useless.

So I found in the Lime directory Gameactivity.java class, activity is Onkeymultiple method. An originating paste code to the following, stick to Gameactivity.java inside can.

//Pelephone@Override Public BooleanOnkeymultiple (Final intInkeycode,intRepeatCount,FinalKeyEvent Event) {String s=event.getcharacters (); if(s = =NULL|| S.length () = = 0)return Super. Onkeymultiple (Inkeycode, RepeatCount, event); Final Char[] cc =S.tochararray (); intCNT = 0;  for(inti = cc.length; I. >= 0; CNT + = Cc[i]! = 0? 1:0); if(cnt = = 0)return Super. Onkeymultiple (Inkeycode, RepeatCount, event); FinalMainView me =MView; Me.queueevent (NewRunnable () {//This method is called on the rendering thread:             Public voidrun () { for(inti = 0, n = cc.length; I < n; i++) {                    intKeyCode; if((keycode = Cc[i])! = 0) {                        intCharCode =Me.translatekeycode (KeyCode, event); //simulate key down and up ...Me. Handleresult (Lime.onkeychange (Keycode,charcode,true)); Me. Handleresult (Lime.onkeychange (Keycode,charcode,false));        }                }            }        }); return true; }    //End Pelephone

directly to the folder under the Gameactivity.java, the next update will still be overwritten. And this also affects the completion of the Lime code. You can use the template method to cut the template into the directory of your project.

For example, I built a TMP folder under the project and put the modified Gameactivity.java into the TMP folder. Then modify the project configuration XML to add the following line of labels

<template path= "Tmp/gameactivity.java" rename= "Src/org/haxe/lime/gameactivity.java" if= "Android"/>

Compile, and you can play Chinese.

There's also a way to solve Chinese problems with JNI, and I found the following posts

Http://blog.sina.com.cn/s/blog_47030a4c0101dnml.html

JNI is a good idea, learning a lot of good things, I am also looking for access to the Open Platform SDK to find the method.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.