I'm rewriting my application with Fragments API
support. In the original application I have an AlertDialog
that is created like this :
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.button_dialog, null);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setView(view);
ListView mListView = (ListView) view.findViewById(R.id.mblist);
builder.setTitle(getString(R.string.sysinfo)).setNeutralButton(
getString(R.string.okay), null);
Cursor dcursor = propManager.propCursor();
if (dcursor.moveToFirst()) {
startManagingCursor(dcursor);
String[] from = { Constants.NAME_DET,
Constants.VALUE_DET };
int[] to = { R.id.mbname, R.id.mbvalue };
SimpleCursorAdapter dadapter = new SimpleCursorAdapter(this,
R.layout.info_list_row, dcursor, from, to);
mListView.setAdapter(dadapter);
}
final Dialog dialog = builder.create();
dialog.show();
How can I display the same dialog via a DialogFragment? I have read the documentation but have trouble figuring out how to proceed with this.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…