Posts

Showing posts from August, 2014

cordova phonegap in android sendPluginResult big data

1.what i want to return big data (big than 8k) to javascript,but cordova said parse error.   2.fixed in java: if (action.equals( "fetch_installed_apps" )) { class MyRunnable implements Runnable{ public CallbackContext callbackContext; public void run() { JSONArray ary = PackageHelper.fetch_installed_apps(); JSONArray ary2; PluginResult pluginResult; PluginResult.Status status = PluginResult.Status.OK; int num = 10; try { for ( int i=0,c=(ary.length()+num-1)/num;i<c;++i){ ary2 = new JSONArray(); for ( int j=i*num,c2=Math.min(j+num, ary.length());j<c2;++j){ ary2.put(ary.get(j)); } pluginResult = new PluginResult(status, ar...

cocos2d-x 3.2 C++ modify android to play .mid file by mediaplayer–or 3.0 develop log

because in android,media player support midi,but cocos2d-x 3.2 code not support. now i found fixed it method: modify cocos2d\cocos\platform\android\java\src\org\cocos2dx\lib\Cocos2dxMusic.java fn: public void playBackgroundMusic(final String pPath, final boolean isLoop) ln: 118 old: this .mBackgroundMediaPlayer.stop(); this .mBackgroundMediaPlayer.setLooping(isLoop); this .mBackgroundMediaPlayer.prepare(); this .mBackgroundMediaPlayer.seekTo(0); => new : if ( this .mCurrentPath.indexOf( ".mid" )>0){ this .mBackgroundMediaPlayer.setLooping(isLoop); // this.mBackgroundMediaPlayer.prepareAsync(); } else { this .mBackgroundMediaPlayer.stop(); this .mBackgroundMediaPlayer.setLooping(isLoop); this .mBackgroundMediaPlayer.prepare(); this .mBackgro...

android develop log 2 - custom control xml and code

1.android control set style by code answer: I do not believe you can set the style programatically. To get around this you can create a template layout xml file with the style assigned, for example in res/layout create tvtemplate.xml as with the following content: <?xml version= "1.0" encoding= "utf-8" ?> <TextView xmlns:android= "http://schemas.android.com/apk/res/android" android:layout_width= "fill_parent" android:layout_height= "wrap_content" android:text= "This is a template" style= "@style/my_style" /> then inflate this to instantiate your new TextView: TextView myText = (TextView)getLayoutInflater().inflate(R.layout.tvtemplate, null ); Hope this helps. 2.android remote icon from tabhost control answer: create one tab class: public class NoIconTab extends LinearLayout { public NoIconTab(Context c, int drawable, String label) { super(c); ...

cocos2d-x 3.0 c++ compile error and fixed develop log

  > cocos new Snake -p com.pkrss.snake -l cpp -d Project // need many timers. > cocos compile -p android -m release --ap 10   error: Couldn't find the gcc toolchain. log: ndk-r10 is not support cocos2d-x 3.2,and release ndk-r9 error: Android NDK: Invalid APP_STL value: c++_static log: edit project dir\proj.android\jni\Application.mk old: APP_STL := c++_static new: APP_STL := gnustl_static error: "Compile thumb : chipmunk_static <= cpCollision.c C:/Users/deliang/AppData/Local/Temp/cpCollision-276362.s: Assembler messages: C:/Users/Administrator/AppData/Local/Temp/cpCollision-334565.s:2151: Error: cannot honor width suffix -- `ldr r4,[r1],#4' log: used ndk-r9d,not used ndk-r10 now. error: build.xml:46: sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var log: it say, build so have error. you can retry many timer: > cocos compile -p android -m release --ap 10 error: make.exe: *...