It is possible duplicate as bottom link. For specific question I want to ask or to get a faster answer, see the answer in my question. Otherwise, go to the following link.
=========================================================================== My question :
I am asking this question even though there are possible duplicates but those didn't worked for me.
I am trying to access to
strings.xml
in AlertDialog but I can't seem to make it. I have said
.setTitle(@string/AlertTitle)
in the following code below but it didn't worked and gave out an error. Is there any possible ways to get strings from AlertDialog or is it impossible?
Code below.
This is AlertMainActivity.java
AlertDialog dialog = new AlertDialog.Builder(this)
.setTitle("Add a New Task") //AlertTitle
.setMessage("What do you want to do next?") //AlertMessage
.setView(taskEditText)
.setPositiveButton("Add", new DialogInterface.OnClickListener() //Add {
...
.setNegativeButton("Cancel", null) //Cancel
...
}
and strings.xml
<string name="AlertTitle">Add a New Task</string>
<string name="AlertMessage">What do you want to do next?</string>
<string name="Add">Add</string>
<string name="Cancel">Cancel</string>
Thanks!