Android is using Dalvik VM. That is a sub-set of J2SE with extra Android functions. On 05/08/2009 9:06am, Mark Murphy <mmur...@commonsware.com> wrote:
> Watermarker wrote: > > I am new to Android development. I am developing in Eclipse with > > Android plugin. I am trying to execute the following J2SE code on > > Android. > Android is not J2SE. > > It is being compiled without errors as I have imported the > > JRE library in the android project. > Don't do that. > > In the Configure Build Path option > > I have imported JRE System Library and in Order and Export option I > > have also exported this JRE System Library. > Don't do that. > > But when it runs in emulator it gives the exception and failed to run. > > I think the jar files of JRE are not actually exported to Android > > emulator platform. If so, can anybody tell me how to export the jar > > files to Android emulator platform. > Use the Android API, please: > http://developer.android.com/reference/packages.html > > package test.six; > > > > import android.app.Activity; > > import android.os.Bundle; > > import android.widget.TextView; > > > > public class Driver extends Activity { > > /** Called when the activity is first created. */ > > @Override > > public void onCreate(Bundle savedInstanceState) { > > super.onCreate(savedInstanceState); > > setContentView(R.layout.main); > > > > TextView tv = new TextView(this); > > > > javax.swing.JTextField jt = new javax.swing.JTextField(20); > > jt.setText(" ...Hello its a Text Field... "); > > tv.setText(tv.getText()+" ,,, "+jt.getText()); > > setContentView(tv); > > > > } > > } > Android does not use or offer Swing. Your use of TextView is fine, just > not the JTextField. > -- > Mark Murphy (a Commons Guy) > http://commonsware.com | http://twitter.com/commonsguy > Android Development Wiki: http://wiki.andmob.org > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---