Hi , I'm testing the new BetterPickers library(Date & time pickers). Every thing is ok until I added more than a one button to my xml file. the displaying of time on button text after picking it via the pickers is stopped . this is my layout xml file:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" android:orientation="horizontal" > <LinearLayout android:id="@+id/linearLayout1" android:layout_width="match_parent" android:layout_height="?android:attr/listPreferredItemHeight" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:gravity="center_horizontal" android:orientation="horizontal" > <Button android:id="@+id/lieu_depart" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Lieu de prise en charge" style="" /> </LinearLayout> <LinearLayout android:id="@+id/linearLayout2" android:layout_width="match_parent" android:layout_height="60dp" android:layout_alignParentLeft="false" android:layout_alignParentRight="false" android:layout_below="@+id/linearLayout1" android:layout_centerHorizontal="true" android:layout_marginTop="@dimen/activity_vertical_margin" > <Button android:id="@+id/button2_date_depart" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="50dp" android:text="Date" /> <Button android:id="@+id/time_depart5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="70dp" android:text="settime" /> </LinearLayout> <LinearLayout android:id="@+id/linearLayout3" android:layout_width="match_parent" android:layout_height="50dp" android:layout_below="@+id/linearLayout2" android:layout_centerHorizontal="true" android:orientation="horizontal" > <Button android:id="@+id/button4" android:layout_width="match_parent" android:layout_height="wrap_content" android:minWidth="@dimen/activity_vertical_margin" android:text="Lieu de restitution" /> </LinearLayout> <LinearLayout android:id="@+id/linearLayout4" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/linearLayout3" android:layout_marginTop="@dimen/activity_vertical_margin" android:orientation="horizontal" > <Button android:id="@+id/button5_date_arrive" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="50dp" android:text="Date" /> <Button android:id="@+id/button6_time_arrive" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="70dp" android:text="Heure" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/linearLayout4" android:orientation="horizontal" > <Button android:id="@+id/Button03" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:text="Button" /> </LinearLayout> </RelativeLayout> </ScrollView> this is the image and this is my code:Reservation.java > package younga.ines.yourcar; > > import android.os.Bundle; > import android.view.LayoutInflater; > import android.view.View; > import android.view.View.OnClickListener; > import android.view.ViewGroup; > import android.widget.Button; > import android.widget.Toast; > > import com.actionbarsherlock.app.SherlockFragment; > import com.doomonafireball.betterpickers.datepicker.DatePickerBuilder; > import > com.doomonafireball.betterpickers.datepicker.DatePickerDialogFragment; > import com.doomonafireball.betterpickers.timepicker.TimePickerBuilder; > import > com.doomonafireball.betterpickers.timepicker.TimePickerDialogFragment; > > > public class Reservation extends SherlockFragment implements > OnClickListener, > DatePickerDialogFragment.DatePickerDialogHandler, > TimePickerDialogFragment.TimePickerDialogHandler { > > private Button ti_depart; > private Button da_depart; > private Button ti_arrive; > private Button da_arrive; > @Override > public View onCreateView(LayoutInflater inflater, ViewGroup container, > Bundle savedInstanceState) { > // TODO Auto-generated method stub > > View rootView = inflater.inflate(R.layout.fragment_reservation, > container, false); > > > //date_depart > da_depart=(Button)rootView.findViewById(R.id.button2_date_depart); > da_depart.setOnClickListener(this); > > //time_depart > ti_depart = (Button) rootView.findViewById(R.id.time_depart5); > ti_depart.setOnClickListener(this); > > //date_arrive > da_arrive=(Button)rootView.findViewById(R.id.button5_date_arrive); > da_arrive.setOnClickListener(this); > > //time_arrive > ti_arrive=(Button)rootView.findViewById(R.id.button6_time_arrive); > ti_arrive.setOnClickListener(this); > > > return rootView; } > > > private void calltoDatedepartPicker() { > // TODO Auto-generated method stub > DatePickerBuilder dpb = new DatePickerBuilder() > .setFragmentManager(getChildFragmentManager()) > .setStyleResId(R.style.BetterPickersDialogFragment) > .setTargetFragment(Reservation.this); > dpb.show(); > } > private void calltoTimedepartPicker() { > // TODO Auto-generated method stub > > TimePickerBuilder tpb = new TimePickerBuilder() > .setFragmentManager(getChildFragmentManager()) > .setStyleResId(R.style.BetterPickersDialogFragment) > .setTargetFragment(Reservation.this); > tpb.show(); > > } > > private void calltoTimearrivePicker() { > // TODO Auto-generated method stub > TimePickerBuilder tpb = new TimePickerBuilder() > .setFragmentManager(getChildFragmentManager()) > .setStyleResId(R.style.BetterPickersDialogFragment) > .setTargetFragment(Reservation.this); > tpb.show(); > > } > > > private void calltoDatearrivePicker() { > // TODO Auto-generated method stub > DatePickerBuilder dpb = new DatePickerBuilder() > .setFragmentManager(getChildFragmentManager()) > .setStyleResId(R.style.BetterPickersDialogFragment) > .setTargetFragment(Reservation.this); > dpb.show(); > } > > > > > @Override > public void onDialogTimeSet(int reference, int hourOfDay, int minute) > { > // TODO Auto-generated method stub > // reference argument show -1 as value > Toast.makeText(getSherlockActivity(), ""+reference, > Toast.LENGTH_SHORT).show(); > if(reference==R.id.time_depart5) ti_depart.setText("" + hourOfDay > + ":" + minute); > if(reference==R.id.button6_time_arrive) ti_arrive.setText("" + > hourOfDay + ":" + minute); > } > > > @Override > public void onDialogDateSet(int reference, int year, int monthOfYear, > int dayOfMonth) { > // TODO Auto-generated method stub > if(reference==R.id.button2_date_depart) da_depart.setText("" + > dayOfMonth + "" + monthOfYear + "" + year); > if(reference==R.id.button5_date_arrive) da_arrive.setText("" + > dayOfMonth + "" + monthOfYear + "" + year); > > } > > > @Override > public void onClick(View v) { > // TODO Auto-generated method stub > > if(v.getId()==R.id.button2_date_depart){ > calltoDatedepartPicker(); > > } > > if(v.getId()==R.id.time_depart5){ > calltoTimedepartPicker(); > > } > > if(v.getId()==R.id.button5_date_arrive){ > calltoDatearrivePicker(); > } > > if(v.getId()==R.id.button6_time_arrive){ > calltoTimearrivePicker(); > } > > > > > } > > > > } > My question How can I use onDialogDataSet onDialogTimeSet methods to display the time or date picked on the 4 Buttons ???? thanks in advance & I'm sorry about my English . <https://lh5.googleusercontent.com/-nh4vpgq51Y4/UgarCA5qyCI/AAAAAAAAAKM/GUPQC69IxY4/s1600/pic111.png> -- 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 --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

