java code
public class DialogFragment_DocumentView extends DialogFragment { public static DialogFragment newInstace() { DialogFragment dialogFragment = new DialogFragment_DocumentView(); return dialogFragment; } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle("View Document"); builder.setView(getContentView()); Dialog dialog = builder.create(); return dialog; } private View getContentView() { LayoutInflater inflater = getActivity().getLayoutInflater(); View view=inflater.inflate(R.layout.dialog_documentview, null); ImageView img_download = (ImageView) view.findViewById(R.id.doucment_listitem_img_download); img_download.setImageBitmap(ConstantValues.bitmapDocument); return view; } }
XML File
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="@dimen/login_main_padding"
tools:context=".SHSact_Login">
<ImageView
android:id="@+id/doucment_listitem_img_download"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
CALLING
DialogFragment_DocumentView.newInstace().show(shSact_main.getFragmentManager(), "Document View");
No comments:
Post a Comment