user
is a class variable, DNIWord
is just a method. Modify the call so it is like this:
.setMessage("The NIF is" +user +DNIWord (user)+ "-")
DNIWord though works with a shadowed user
variable, so
("The NIF is" +user +DNIWord (user)+ "-")
could be shortened to just
("The NIF is" + DNIWord (user)+ "-")
However, since user
seems to be class-scoped and you try to get the value of dniText
, which seems to be an EditText/TextView
, it is very likely that you will also get a NullPointerException
when you actually run your app. Move the assignment of user to somewhere like inside
onCreateDialog()
.
Edit: user
is not class scoped but instead local to onCreate()
local variables, like the name implies are local to the enclosing method.
Move user outside onCreate()
then take out the int
user in onCreate and write it just as user
.
int user = 0; //class instance variable
public void onCreate(Bundle icicle)
{
//...
try{
user = Integer.parseInt(dniText.getText().toString()); //no "int", just user
}
catch (NumberFormatException e)
{
}
}
Then in your onCreateDialog()
method, you should be able to access user
.