I am writing one application in that I am taking input from user and sending it through sms, but my problem is that I am not able to get that string(i.e. which is given from user as a input )
suppose I have following in the main.xml file
It have one TextField, one EditText and one Button.
Now when user write input to EditText then that String I want to send through the sms.
my Test.java contains
Now when I run this and if I supplied input to form as "Pramod Deore" but when I I click on ok button it throws Exception
Life is easy because we write the source code.....
I suspect, you have not pasted the piece of code that is causing that exception. I do not see SmsManager.sendTextMessage being called anywhere in your code.
But when I pass second argument as "Pramod Deore" i.e. String then it runs successfully. But if I pass username (i.e which is get from EditText) then it throws Exception.
Life is easy because we write the source code.....
But when I pass second argument as "Pramod Deore" i.e. String then it runs successfully. But if I pass username (i.e which is get from EditText) then it throws Exception.
Have you tried to print the value you read from the EditText and see what you are getting? Is it null? Is it empty? Are you passing what you are actually reading to the sendSMS() method?
But when I run application in the form it shows value of first EditText as EditText. and second fileld which is Mob no is blank.
when I pressed on ok button . The Logcat shows output as
Life is easy because we write the source code.....
Have you tried to print the value you read from the EditText and see what you are getting? Is it null? Is it empty? Are you passing what you are actually reading to the sendSMS() method?
I had print values but I get null in both textfield.
Life is easy because we write the source code.....
Because you are printing their values inside onCreate(). The View is not drawn until the window receives focus.
You should copy the following inside the button click callback method(inside onClick of Ok button):