Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.hoa.dialog;
- import android.app.DialogFragment;
- import android.app.FragmentManager;
- import android.content.Context;
- import android.os.Bundle;
- import android.view.LayoutInflater;
- import android.view.View;
- import android.view.ViewGroup;
- import android.widget.ImageButton;
- import android.widget.TextView;
- public class DialogFragm extends DialogFragment {
- private static final String TAG = "DialogFragm";
- public interface OnInputListner{
- void sendInput(String Input);
- }
- public OnInputListner mOnInputListner;
- ImageButton event1;
- ImageButton event2;
- ImageButton event3;
- ImageButton event4;
- String type ;
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- // Inflate the layout for this
- View v = inflater.inflate(R.layout.fragment_dialog, container, false);
- event1 = (ImageButton)v.findViewById(R.id.imageButton);
- event1.setOnClickListener(new View.OnClickListener(){
- @Override
- public void onClick(View v) {
- type = "道路施工";
- FragmentManager newFragment = getFragmentManager();
- Dialog2 myDialog = new Dialog2();
- //Dialog2 myDialog = (Dialog2) getActivity().getFragmentManager().findFragmentByTag("Dialog2");
- mOnInputListner.sendInput(type);
- myDialog.show(newFragment,"Dialog2");
- getDialog().dismiss();
- }
- });
- event2 = (ImageButton)v.findViewById(R.id.imageButton2);
- event3 = (ImageButton)v.findViewById(R.id.imageButton3);
- event4 = (ImageButton)v.findViewById(R.id.imageButton4);
- return v;
- }
- @Override
- public void onAttach(Context context) {
- super.onAttach(context);
- try{
- mOnInputListner = (OnInputListner)getTargetFragment() ;
- }catch(ClassCastException e){
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment