Java tutorial
package dk.tinytree.reader.Fragments.Others; import android.app.Dialog; import android.os.Bundle; import android.support.v4.app.DialogFragment; import android.support.v4.content.ContextCompat; import android.view.View; import android.view.Window; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import dk.tinytree.reader.R; /** * Created by stjo on 21-12-2016. */ public class OpenSourceLicenses extends DialogFragment { final OpenSourceLicenses context = this; ImageView searchTitleIcon; TextView searchTitleName; @Override public Dialog onCreateDialog(Bundle savedInstanceState) { final Dialog dialog = new Dialog(getActivity()); dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.fragment_opensource_licenses); searchTitleIcon = (ImageView) dialog.findViewById(R.id.searchTitleProfile); searchTitleIcon.setImageResource(R.drawable.ic_material_security_black_24dp); searchTitleIcon.setColorFilter(ContextCompat.getColor(getContext(), R.color.redOrange)); searchTitleName = (TextView) dialog.findViewById(R.id.searchTitleName); searchTitleName.setText(R.string.licenses_header_title); // Closes the Dialog Button dialogBtnCancel = (Button) dialog.findViewById(R.id.license_BtnCancel); dialogBtnCancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); return dialog; } }