Re: [android-beginners] Re: string to double
2010/5/26 niko20 > Hi, > > Just do this > > Double mynewdouble = new Double(); > > There are built int objects that can take string as a constructor init > argument. > > The bad part is now you have a heavyweight object, but it works fine. > > If you want then you can put it into a normal double: > > double mydouble = mynewdouble; > > This is not solving my problem, I can solve it with the replace function; String aap = "123,55".replace(",", "."); But i though there maybe a sort off de-locale function which can read strings, with with comma or point, and convert it to a double. Faust > > > >> How do I transform a string with comma to a string with point. > > > > > By taking 2 seconds to look at the documentation for String. Your > answer is > > > right there. Just try looking. > > > > You mean the replace function? > > > > With the format function a double will be translated to a string using > the > > Locale setting. > > Is there a function who can do the other way around, from string to > double > > using the locale setting? > > > > > > > > > > - > > > TreKing - Chicago transit tracking app for Android-powered devices > > >http://sites.google.com/site/rezmobileapps/treking > > > > > -- > > > You received this message because you are subscribed to the Google > > > Groups "Android Beginners" group. > > > > > NEW! Try asking and tagging your question on Stack Overflow at > > >http://stackoverflow.com/questions/tagged/android > > > > > 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 > > -- > You received this message because you are subscribed to the Google > Groups "Android Beginners" group. > > NEW! Try asking and tagging your question on Stack Overflow at > http://stackoverflow.com/questions/tagged/android > > 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 > -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android 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
Re: [android-beginners] string to double
2010/5/26 TreKing > On Tue, May 25, 2010 at 3:22 PM, Faust Nijhuis wrote: > >> How do I transform a string with comma to a string with point. > > > By taking 2 seconds to look at the documentation for String. Your answer is > right there. Just try looking. You mean the replace function? With the format function a double will be translated to a string using the Locale setting. Is there a function who can do the other way around, from string to double using the locale setting? > > > - > TreKing - Chicago transit tracking app for Android-powered devices > http://sites.google.com/site/rezmobileapps/treking > > -- > You received this message because you are subscribed to the Google > Groups "Android Beginners" group. > > NEW! Try asking and tagging your question on Stack Overflow at > http://stackoverflow.com/questions/tagged/android > > 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 > -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android 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
[android-beginners] string to double
Hello, Is there an function to change an string with a comma to a double. example code; stripline1.Z0 = "123.45" (with point) DecimalFormat df = new DecimalFormat("#.##"); strip_Z0.setText(df.format(stripline1.Z0)); The value in the textEdit entry will be with a comma or point, depending on the locale setting. If I convert the string, with comma, directly to a double I get a "force close". How do I transform a string with comma to a string with point. Faust -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android 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
Re: [android-beginners] problem with edittext
2010/4/25 Kaustubh Padegaonkar > It may be that you are not getting the value of the edittext, using > editText.getText(). > you can see the logcat to see where you are going wrong. try setting the > values to null, when you select the other radio button, if that suits you > and your audience. > > Your solution works, but i still want to know where it is going wrong. Here is some of the code; NumberFormat df3 = new DecimalFormat("#.###"); if(radio_RL1.isChecked() == true) { mismatch.RL1= new Double(RL1.getText().toString()); mismatch.RL2= new Double(RL2.getText().toString()); mismatch.calcMismatch_RL(); VSWR1.setText(df3.format(mismatch.VSWR1)); VSWR2.setText(df3.format(mismatch.VSWR2)); } if(radio_VSWR1.isChecked() == true) { mismatch.VSWR1= new Double(VSWR1.getText().toString()); mismatch.VSWR2= new Double(VSWR2.getText().toString()); mismatch.calcMismatch_VSWR(); RL1.setText(df3.format(mismatch.RL1)); RL2.setText(df3.format(mismatch.RL2)); } > > Kaustubh Padegaonkar, > thetuxra...@gmail.com > > > On Sun, Apr 25, 2010 at 12:58 PM, Faust Nijhuis wrote: > >> Hello all, >> >> I have a made simple calculator let say from dollar to euro. >> >> There are two radiobuttons and two edittext entries one for dollar and one >> for euro . >> >> And there is one calculate button. >> >> I select one radio button (dollar) fill in a value for dollar and press >> calculate. >> The value of euro appears in the edittext entry. >> >> When i now select the radio button for euro and leave the first calculated >> value in the edittext entry >> the application will close. >> >> But when i first remove the calculated value and put in by hand and press >> calculate it runs fine. >> >> The emulator does not show this probem. >> >> To try it out download mwcalculator_lite and chose reflectometer >> calculator. >> >> >> Faust >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Android Beginners" group. >> >> NEW! Try asking and tagging your question on Stack Overflow at >> http://stackoverflow.com/questions/tagged/android >> >> 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 >> > > -- > You received this message because you are subscribed to the Google > Groups "Android Beginners" group. > > NEW! Try asking and tagging your question on Stack Overflow at > http://stackoverflow.com/questions/tagged/android > > 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 > -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android 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
[android-beginners] problem with edittext
Hello all, I have a made simple calculator let say from dollar to euro. There are two radiobuttons and two edittext entries one for dollar and one for euro . And there is one calculate button. I select one radio button (dollar) fill in a value for dollar and press calculate. The value of euro appears in the edittext entry. When i now select the radio button for euro and leave the first calculated value in the edittext entry the application will close. But when i first remove the calculated value and put in by hand and press calculate it runs fine. The emulator does not show this probem. To try it out download mwcalculator_lite and chose reflectometer calculator. Faust -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android 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