0

I want to create a new class to customize dialogpreference.Though I try to many methods,they all didn't work. And I find a way to use the layout prepared as the layout of dialog in the dialogpreference on the site as follow: How to access widgets in a custom DialogPreference with a inflated layout?.

When I try to use the layout like this: setDialogLayoutResource(R.layout.address_dialog); But it didn't work.Can you help me solve the problem?

Community
  • 1
  • 1
Sysphus
  • 194
  • 1
  • 3
  • 11

1 Answers1

3

It is better late then never :) and I think the answer to this question already exists somewhere on the SO.

You should write something like this in your :

@Override
public View onCreateDialogView() {
    LayoutInflater layoutInflater = LayoutInflater.from(getContext());
    View view = layoutInflater.inflate(R.layout.city_select_dialog, null);

    // {Your code here}

    return view;
}
Prizoff
  • 4,486
  • 4
  • 41
  • 69