Java tutorial
/* * * Copyright 2016 Manish Patel (MD) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.mytwitter.activity; import android.app.Dialog; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v4.app.DialogFragment; import android.support.v7.app.AlertDialog; import android.view.LayoutInflater; import android.webkit.WebView; import com.mytwitter.R; /** * Created by Manish on 5/14/2016. */ public class LicensesDialogFragment extends DialogFragment { public static LicensesDialogFragment newInstance() { return new LicensesDialogFragment(); } @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { WebView view = (WebView) LayoutInflater.from(getActivity()).inflate(R.layout.dialog_licenses, null); view.loadUrl("file:///android_asset/open_source_licenses.html"); return new AlertDialog.Builder(getActivity(), R.style.Theme_AppCompat_Light_Dialog_Alert) .setTitle("Open Source Licenses").setView(view).setPositiveButton(android.R.string.ok, null) .create(); } }