This is your code,
EditText msg=(EditText)findViewById(R.id.Et_Msg);
String setMsg=msg.getText().toString();
Log.v("Messge","Message::"+setMsg);
- The first line is initializing the EditText. When it does by default there is no value ( string ) in the edittext.
- In the second line you are trying to fetch a string from a blank edittext, that's why it is giving you
NullPointerException
.
Solution : I suggest you to move your line String setMsg=msg.getText().toString();
to somewhere else where you are actually going to use the value of EditText.