Link to home
Create AccountLog in
Avatar of allelopath
allelopath

asked on

DialogFragment with lots of text

Below is code for a dialog with some text. I want to add a lot of text. I could just add it to the string, but I want to know if there is a way to have a text file that contains the text and have that displayed.
import android.annotation.TargetApi;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.app.DialogFragment;

@TargetApi(11) public class HelpDialog extends DialogFragment {

	@Override
	public Dialog onCreateDialog(Bundle savedInstanceState) {
		// Use the Builder class for convenient dialog construction
		AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
		
		builder.setMessage(R.string.help)
        .setCancelable(false) // one button only
		.setPositiveButton(R.string.close, new DialogInterface.OnClickListener() {
			public void onClick(DialogInterface dialog, int id) {
			
			}
		});

		// Create the AlertDialog object and return it
		return builder.create();
	}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Chris Harte
Chris Harte
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account