last day (19 days later) » 

07:15
0
A: Edittext Numeric by code

HiralTry using: mEditText.setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL | InputType.TYPE_CLASS_NUMBER); Edit : Also change your xml like: <EditText android:text="100.99" android:id="@+id/EditText01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:...

already tried.. still can input + and - (plus and minus) :(
Then just use decimal,don't include number so try this: mEditText.setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL);
please see my edit! That worked for me.also you can remove specification of input type in your xml,everytime set it by code!
xml it's only for example what i found.. i need create this without xml. That's all. also i tried your code (without xml file) and this did not work.
Tried cleaning and rebuilding project after editing your code?And please post your complete code that dynamically generates edittext and sets properties of it.
yep.. already!!
07:16
please post the code that generates and sets property of your edittext
hey
maybe u understand better what i want
i just have problem with english speaking
first ) i want input only NUMBERS 0-9. And only point/period (".")(it's not smile - it's a dot example 9999.(dot)9999 )
that's all
hey
androidpeople.com/… here i found code
maybe u understand better what i want
i just have problem with english speaking
first ) i want input only NUMBERS 0-9. And only point/period (".")(it's not smile - it's a dot example 9999.(dot)9999 )
that's all
just a min
let me see into it
okay
im here if need
I am not asking about the code you referred
i am asking you to post the code what you tried to make it by code.
oh ok lol :D
07:28
the one where you put the lines i suggested in my answer
et1.setInputType(InputType.TYPE_CLASS_PHONE | InputType.TYPE_NUMBER_FLAG_DECIMAL);
et2.setInputType(InputType.TYPE_CLASS_PHONE | InputType.TYPE_NUMBER_FLAG_DECIMAL);
et3.setInputType(InputType.TYPE_NULL | InputType.TYPE_NUMBER_FLAG_DECIMAL);
et4.setInputType(InputType.TYPE_CLASS_PHONE);
i have 6 edittext's in my programm.. and i tried on all other methods.. but all what i can do it input 0-9, +,-,#. i want input without +,-,=,#
so for all this edittext,you want to set input type the same you asked in your question?
and i can't input .
if so...then try this:
et1.setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL);
all settings what was in inputtype i tried :(
07:31
no no
just try the above one into one edittext and see
it must work
it is working for me here
already tried
but in your code,none of the line says this option!
:P
dude, i just show your last code which i tried
did u try input it from keyboard ?
hi peter and hiral this is yugandhar
hi yugandhar
07:36
i am waiting for reply from peter about same question
peter telling i want float value in edit text
the xml layout given is working
its taking only float values
im here
hello yugand
but the keyboard displaying +, - and £ symbols
yes yes
sorry not £ # symbol
peter let me know one thing
yes ?
07:39
the keyboard should not display +, -, # symbols ?
should not
or
ok but now even they appear on keyboard, if you press it won't go into edittext
did you checked that one
symbols should not display or deny entering them
yes keys are appearing on keyboard but, even you press them it won't display on edittext
it's displayed
07:42
is it displayed when you press # key ?
yes
when i press #,+,-,= - all this symbols displayed in edittext (
can you post image with edit text and keyboard
yes with which inputsetting u want ?
Yes...peter is right.actually i didn't try that by code,i had that in xml and it is working fine.
but when you make it from code,it is not working properly.
for this code
<EditText android:text="100.99"
android:id="@+id/EditText01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numeric="integer|decimal" />
07:44
noooooooo
f..ck
you are getting +, # symbols in edittext
IM NOT USING STUPID XML
this code i found here androidpeople.com/android-edittext-numeric . And i want to know how to do this shit without xml .. only by code(programmaticaly)
don't think like that
I tested same code
its working fine
what u tested please show
and also show how u create edittext
whatever you posted that only i tested.
main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<EditText
android:id="@+id/et"
android:text="100.99"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:numeric="integer|decimal" />

</LinearLayout>
07:49
-_-
dude, it's very funny :)
Java file
public class RealvaluesEditText extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
test it now i am using Android 2.2
did u read my words about xml ?:)
without XML also we can get same result, i have the code
realy ?
please show
did you checked my XML and java files ?
no problem if not checked
07:53
@peter: i have searched on www.developer.android.com also but it really doesn't work as doc shows.
Even i am getting the strange behavior of this when i code it in my class
and not in xml
@YugandharBabu oh
but surprisingly,putting android:inputType="decimal" in edit text tag in xml perfectly works
@YugandharBabu u sayd u have code without xml
@YugandharBabu so .. can u show me ?
07:55
main.xml
hey
stop
it's with xml
without xml : EditText et = new EditText(this); <--- it's without xml
main.xml - = with xml
@peter:
i have a solution for your problem.
@Hiral yes ?
07:56
means no EditText in XMl file
thats a trick kind of thing
just put a text watcher on your edittext
and filter out the character you don't want allow user to enter
@YugandharBabu: there is not xml with him.he is just having a class and he is trying to do all these things in that only,BY CODING!!!
textwatcher ? what is it.. never hear about it (
well...let me give you example
wait
Peter check this Java file
mEditText.addTextChangedListener(new TextWatcher() {

@Override
public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
}
@Override
public void beforeTextChanged(CharSequence arg0, int arg1, int arg2,
int arg3) {
}
@Override
public void afterTextChanged(Editable arg0) {
}
}
07:59
very intrested
interes *
now in methor,in onTextChanged method,you need to check the last character of the string you get in arg0
so once you find it invalid character,you just need to remove it from string and set that new string to your edittext.
thats it!!
hope you get the things.
@peter: are you therE?
@Hiral yes, im just thinked about new info
ok
@Hiral thank you very much.. i will try it (need first foudn some code) .. also if it's help me.. post some words about textwatcher in my question.. and if i found solution with textwatcher. i accpeted u
sure
i am doing these only
preparing a block of code for you
08:24
please check the answer
in edit,i have added the code
i have added all possible special characters
thought,you will have to check for your own and make the things work
and also there would be error if you enter special character at first
i am looking into it to make it proper
hey
@Hiral im are u here ?
i not found code.. or found and have error with textwatcher.. i tried again and play with flags.. and don't know why - but et1.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL); this work perfectly for keyboard.. but on virtual keyboard i can't input dot(period/point . )
please check my answer again
i am clearly seeing it updatedd
and yes,that problem is also resolved
the code i posted lastly in edit in my answer is perfectly working
try it out
thanks for accepting the answer
happy coding!! :)
bye
08:43
good bye )
thanks for help
09:02
no
you dont need to add anything else to edit text
infact,i tested the same in my app and it was working fine
what problem you are getting?
hope,you have added mEditText.setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL); before setting textwatcher to it.
@peter: are you therE?
hi hiral
i didn't added any inputType for EditText instance
its taking alphabets aslo
09:38
@YugandharBabu: then you must add it
before setting watcher to it
 
2 hours later…
11:23
@Hiral нуы
@Hiral yes, im here

  last day (19 days later) »