i want to create a method to open a popup when i click on it and the title and the text would be automatic, something like this :
public void Display(String test){
new AlertDialog.Builder(this).setTitle(getTitle()).setMessage(test).setNeutralButton("close", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
}
}).show();
}
but test is a String and set Message doesn't accept Strings, and it would come from a resource XML, like Strings.xml. So i don't know ho to do this. And the 'getTitle()' i don't think it could work. My method to take the title is this one.
TextView str = new TextView(this);
str.setText(parent.getItemAtPosition(position).toString());
String title = str.getText().toString();