If you post up the relevant code it will help.

On 4 June 2012 11:41, Bluemercury <[email protected]> wrote:

> Hi! Seems replying directly from gmail doesnt refresh this page. so im
> posting again, i changed the property like you said but if i call the
> dialogfragment, rotate the phone and press ok, it wont refresh the
> editext.Only if i call it again, dont rotate, and press ok. The problem
> happens when i rotate with the dialogfragment being visible, if the
> edittext has any value, before i rotate, by default it will show the values
> after rotation correctly , so the issue here lies when i rotate while
> showing the dialogfragment, seems the edittext i pass to it looses the
> connection with the view layout....
>
> regards,
>
>
> On Sunday, June 3, 2012 3:14:16 PM UTC+1, Fred Niggle wrote:
>
>> This is caused by the contents of the edittext not being saved when
>> rotated.
>> If the edittext is defined via xml then set
>>
>>  android:freezesText="true"
>>
>> to stop the edittext from loosing its contents upon rotation.
>>
>> Hope this help,
>> Fred
>>
>> On 3 June 2012 01:09, Bluemercury <[email protected]> wrote:
>>
>>> So im adapting my DateTimePickerDialog implementation to a
>>> DialogFragment, and right now it works well, i press the button to show the
>>> dialogfragment choose a date/time value, press ok and it will show on the
>>> fragment's edit text view.
>>> The problem is, if i press the button to show the dialog, then rotate,
>>> everything seems to work well except when i press ok to fill the edittext
>>> view it wont fill it with the choosen value. If i do this again it will
>>> work. Seems the problem is when i rotate the edittext seems to loose the
>>> view relation?
>>> Here's the frapgment that calls the dialog:
>>>
>>> public class MainFragment extends Fragment {
>>>>
>>>>   Button button;
>>>>
>>>>  TextView tv;
>>>>
>>>>    @Override
>>>>
>>>>  public View onCreateView(LayoutInflater inflater, ViewGroup container,
>>>>
>>>>  Bundle savedInstanceState) {
>>>>
>>>>   this.setRetainInstance(true);
>>>>
>>>>   View view= inflater.inflate(R.layout.**main_fragment,
>>>>> container,false);
>>>>
>>>>   button= (Button) view.findViewById(R.id.**button1);
>>>>
>>>>  tv=(TextView) view.findViewById(R.id.**editText1);
>>>>
>>>>  button.setOnClickListener(new OnClickListener() {
>>>>
>>>>   @Override
>>>>
>>>>  public void onClick(View v) {
>>>>
>>>>  FragmentManager fm = getActivity().**getSupportFragmentManager();
>>>>
>>>>  
>>>> DateTimePickerDialog.**newInstance(**DateTimePickerDialog.DATETIME_**PICKER,tv).show(fm,
>>>>> "dialog");
>>>>
>>>>   }
>>>>
>>>>  });
>>>>
>>>>  return view;
>>>>
>>>>  }
>>>>
>>>> }
>>>>
>>>>
>>>>> Here's the DateTimePickerDialog main methods:
>>>
>>> public static DateTimePickerDialog newInstance(int type,View view) {
>>>
>>>  DateTimePickerDialog f = new DateTimePickerDialog();
>>>
>>>  f.dialogType=type;
>>>
>>>  f.currCal=Calendar.**getInstance();
>>>
>>>  f.element=view;
>>>
>>>
>>>>  Logger.write("**DateTimePickerDialog", "newInstance", Logger.INFO);
>>>
>>>  return f;
>>>
>>>  }
>>>
>>>
>>>>  public DateTimePickerDialog() {}
>>>
>>>
>>>>
>>>>  @Override
>>>
>>>  public View onCreateView(LayoutInflater inflater, ViewGroup container,
>>>
>>>  Bundle savedInstanceState) {
>>>
>>>
>>>>  this.setRetainInstance(true);
>>>
>>>
>>>>  this.getDialog().**requestWindowFeature(STYLE_NO_**TITLE);
>>>
>>>  this.setCancelable(false);
>>>
>>>
>>>>  type = null;
>>>
>>>
>>>>  switch(dialogType){
>>>
>>>
>>>>  case DATE_PICKER:
>>>
>>>  type =inflater.inflate(R.layout.**custom_date_picker_dialog,
>>>> container, false);
>>>
>>>  type.findViewById(R.id.**imagelogo).**setBackgroundResource(R.**
>>>> drawable.ico_popup_data);
>>>
>>>  //fillDialogHeader();
>>>
>>>  dateDialog();
>>>
>>>  break;
>>>
>>>  case TIME_PICKER:
>>>
>>>  type =inflater.inflate(R.layout.**custom_time_picker_dialog,
>>>> container, false);
>>>
>>>  type.findViewById(R.id.**imagelogo).**setBackgroundResource(R.**
>>>> drawable.ico_popup_hora);
>>>
>>>  //fillDialogHeader();
>>>
>>>  timeDialog();
>>>
>>>  break;
>>>
>>>  case DATETIME_PICKER:
>>>
>>>  type =inflater.inflate(R.layout.**custom_datetime_picker_dialog,
>>>> container, false);
>>>
>>>  type.findViewById(R.id.**imagelogo).**setBackgroundResource(R.**
>>>> drawable.ico_popup_datahora);
>>>
>>>  //fillDialogHeader();
>>>
>>>  dateTimeDialog();
>>>
>>>  }
>>>
>>>
>>>>  fillDialogHeader();
>>>
>>>  //button clicks
>>>
>>>  ok=(Button)type.findViewById(**R.id.btn_change_date_ok);
>>>
>>>  ok.setOnClickListener(this);
>>>
>>>  clean=(Button)type.**findViewById(R.id.btn_change_**date_clean);
>>>
>>>  clean.setOnClickListener(this)**;
>>>
>>>  cancel=(Button)type.**findViewById(R.id.btn_change_**date_cancel);
>>>
>>>  cancel.setOnClickListener(**this);
>>>
>>>
>>>>  Logger.write("**DateTimePickerDialog", "onCreateView", Logger.INFO);
>>>
>>>  return type;
>>>
>>>  }
>>>
>>>
>>> Is the problem associated with passing the edittext view element?
>>>
>>> regards,
>>>
>>>>
>>>
>>>
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Android Developers" group.
>>> To post to this group, send email to android-developers@**
>>> googlegroups.com <[email protected]>
>>> To unsubscribe from this group, send email to
>>> android-developers+**[email protected]<android-developers%[email protected]>
>>> For more options, visit this group at
>>> http://groups.google.com/**group/android-developers?hl=en<http://groups.google.com/group/android-developers?hl=en>
>>
>>
>>
>>
>> --
>> Magnetic Door Alarm 
>> app<https://play.google.com/store/apps/details?id=com.nds.magneticdooralarm>is
>>  now available in Google Play
>>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Magnetic Door Alarm
app<https://play.google.com/store/apps/details?id=com.nds.magneticdooralarm>is
now available in Google Play

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to