Question

I am using preference.xml. Since my app uses Google Maps API, I need to show Legal Notices as a part of my about screen. I have successfully created activity that extends DialogPreference and the dialog is shown when clicked. But the dialogMessage needs to be a string as below

String LicenseInfo = GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(
    getApplicationContext());

So how can I show this string in android:dialogMessage?

Here is OptionDialogPreference.java

public class OptionDialogPreference extends DialogPreference {

public OptionDialogPreference(Context context, AttributeSet attrs) {
    super(context, attrs);
    // TODO Auto-generated constructor stub
}

}
Was it helpful?

Solution

public class OptionDialogPreference extends DialogPreference {

    private Context _context;

    public OptionDialogPreference(Context context, AttributeSet attrs) {
        super(context, attrs);
        setDialogMessage(GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(context));
    }    
 }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top