Setting result of TimePickerDialog to a button via DialogFragment android
<p>Good day, I will be the first to admit, i have no experience using fragments at all and just learning so please bear with me. As the title say, i am trying to set the result from a TimePickerDialog to a button in my activity but no success. When i click the start button, i don't see a usual TimePickerDialog, All i see is a tiny empty dialog in the middle of the screen. So please what could i be doing wrong? Thank you.</p>

<p>Here is my code:</p>

<p>TimeDialog:</p>

<pre><code>public class TimeDialog extends DialogFragment {
    private int mHour;
    private int mMinute;

    public TimeDialog(){

    }

    public static TimeDialog newInstance(int title){
        TimeDialog frag = new TimeDialog();
        Bundle args = new Bundle();
        args.putInt("title", title);
        frag.setArguments(args);
        return null;

    }

    private TimePickerDialog.OnTimeSetListener mTimeSetListener = new TimePickerDialog.OnTimeSetListener() {

        @Override
            public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
                mHour = hourOfDay;
                mMinute = minute;

                //updateDisplay();
            }

        /*private void updateDisplay() {

            View v = getActivity().getLayoutInflater().inflate(R.layout.add_resp, null);
            Button start = (Button)v.findViewById(R.id.start_time_button_id);
            start.setText(new StringBuilder().append(mHour).append(":").append(mMinute).toString());


        }*/
        };

    @Override
    public Dialog onCreateDialog(Bundle savedInstancestate){

        return new TimePickerDialog(getActivity(), mTimeSetListener, mHour, mMinute, false);

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
        View v = inflater.inflate(R.layout.add_resp, container, false);
        Button start = (Button)v.findViewById(R.id.start_time_button_id);
        start.setText(new StringBuilder().append(mHour).append(":").append(mMinute).toString());
        return v;

    }   
}
</code></pre>

<p>and Here is where i call it from the activity:</p>

<pre><code>public class AddResp extends Activity implements OnClickListener {
    EditText text_title;
    Button start;

    public void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.add_resp);

        text_title = (EditText)findViewById(R.id.title_text_id);
        start = (Button)findViewById(R.id.start_time_button_id);

        start.setOnClickListener(this);

    }

    @Override
    public void onClick(View view) {
        int selection = view.getId();
        switch(selection){
        case R.id.start_time_button_id:

             DialogFragment newFragment = new DialogFragment();
                newFragment.show(getFragmentManager(), "dialog");
         break;       
        }
    }
}
</code></pre>
