From: Wolfgang K. <wol...@xm...> - 2009-10-12 11:49:45
|
The problem is that right now there is no Objective C wrapper for java.lang.CharSequence. How did you (Java) compile your code? Did you compile it against the regular Android SDK? That might cause the problem since the original setText() expects a CharSequence. Try compiling it against XMLVM's compatibility library instead. -- Wolfgang Joseph Rukshan Fonseka wrote: > So how come the code below fails for me? It gives me this error: > It seems to want to use java_lang_CharSequence.h, how can I avoid this? > > com_home_imageviewer_ImageViewer.m:8:35: error: > java_lang_CharSequence.h: No such file or directory > com_home_imageviewer_ImageViewer.m: In function > ‘-[com_home_imageviewer_ImageViewer onCreate___android_os_Bundle:]’: > com_home_imageviewer_ImageViewer.m:132: warning: > ‘android_widget_Button’ may not respond to > ‘-setText___java_lang_CharSequence:’ > com_home_imageviewer_ImageViewer.m:132: warning: (Messages without a > matching method signature > com_home_imageviewer_ImageViewer.m:132: warning: will be assumed to > return ‘id’ and accept > com_home_imageviewer_ImageViewer.m:132: warning: ‘...’ as arguments.) > make: *** [obj/com_home_imageviewer_ImageViewer.o] Error 1 > > > public class ImageViewer extends Activity { > /** Called when the activity is first created. */ > @SuppressWarnings("deprecation") > @Override > public void onCreate(Bundle savedInstanceState) { > super.onCreate(savedInstanceState); > > > > AbsoluteLayout layout = new AbsoluteLayout(this); > layout.setLayoutParams(new > LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); > ImageView viewer = new ImageView(this); > viewer.setImageResource(R.drawable.cat); > layout.addView(viewer, new > AbsoluteLayout.LayoutParams(AbsoluteLayout.LayoutParams.WRAP_CONTENT, > AbsoluteLayout.LayoutParams.WRAP_CONTENT, 0, 100)); > Button text = new Button(this); > layout.addView(text, new > AbsoluteLayout.LayoutParams(AbsoluteLayout.LayoutParams.WRAP_CONTENT, > AbsoluteLayout.LayoutParams.WRAP_CONTENT, 0, 0)); > setContentView(layout); > > > > text.setText("fffff")); > } > } > > > On 12/10/2009, at 10:05 PM, Wolfgang Korn wrote: > >> Currently our Android compativility library only has a method >> TextView.setText(String). With respect to the allowed input types >> this less flexible than the original Android method but it works. >> Since java.lang.String implements java.lang.CharSequence code using >> this method compiles with our compat lib as well as with the regular >> Android SDK. >> >> -- Wolfgang >> >> Joseph Rukshan Fonseka wrote: >>> Thanks that worked. How does one use the TextView.setText() thats >>> already defined in the TextWidget? >>> >>> When it cross compiles to iphone I get this error, I understand that >>> is because android's setText takes a CharSequence. But just >>> wondering how the setText in compat library can be called. >>> >>> com_home_imageviewer_ImageViewer.m:9:35: error: >>> java_lang_CharSequence.h: No such file or directory >>> com_home_imageviewer_ImageViewer.m: In function >>> ‘-[com_home_imageviewer_ImageViewer onCreate___android_os_Bundle:]’: >>> com_home_imageviewer_ImageViewer.m:164: warning: >>> ‘android_widget_Button’ may not respond to >>> ‘-setText___java_lang_CharSequence:’ >>> com_home_imageviewer_ImageViewer.m:164: warning: (Messages without a >>> matching method signature >>> com_home_imageviewer_ImageViewer.m:164: warning: will be assumed to >>> return ‘id’ and accept >>> com_home_imageviewer_ImageViewer.m:164: warning: ‘...’ as arguments.) >>> make: *** [obj/com_home_imageviewer_ImageViewer.o] Error 1 >>> >>> >>> >>> On 12/10/2009, at 12:55 AM, Wolfgang Korn wrote: >>> >>>> It seems that the pop2 instruction is used to clean up the stack >>>> here. Your code computes minimum and maximum of two values but >>>> simply ignores the computed value. To remove this computation >>>> result pop2 seems to be used. Until we implement the missing >>>> instruction you can simply assign the results from the calls to >>>> Math.min and Math.max to variables. In my case this removed the >>>> pop2 from the class file. >>>> >>>> One last thing: Could you please upload a patch file for your >>>> additions to Math.m/h to our review site >>>> (http://xmlvm-reviews.appspot.com/) or create a patch and send that >>>> instead of sending the whole files? This makes it easier to merge >>>> in case if concurrent modifications. >>>> >>>> -- Wolfgang >>>> >>> ------------------------------------------------------------------------ >>> >>> ------------------------------------------------------------------------------ >>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA >>> is the only developer event you need to attend this year. Jumpstart your >>> developing skills, take BlackBerry mobile applications to market and stay >>> ahead of the curve. Join us from November 9 - 12, 2009. Register now! >>> http://p.sf.net/sfu/devconference >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> xmlvm-users mailing list >>> xml...@li... >>> https://lists.sourceforge.net/lists/listinfo/xmlvm-users >>> >> >> > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > ------------------------------------------------------------------------ > > _______________________________________________ > xmlvm-users mailing list > xml...@li... > https://lists.sourceforge.net/lists/listinfo/xmlvm-users > |