java - android: Set time from time picker in dynamic edit text in table row -
I have a table layout with went table rows created programmatically and a programmatic built in each row Editing Text is linked with one of the buttons on a line that has the name of 'EditTextTime' named under the Edit Text 'editTextTime' in each row Eligible, so when you click on it, the time picker dialog Happens after you select the Time Picker that appears in 'editTextTime'.
But here's the problem, when the time is selected, then also appears in 'editTextTime' at the same time, if there are two rows selected. The only time I need to select is to set the text in the selected 'editTextTime' of the current row and it does not appear in any other 'editTextTime' than any other line. How will I go about this?
The problem (I think) that you named all EditTexts same and setTimeToEditText function " The programmatic creation creation code is out of ", therefore, you have to set onClickListener for each on it.
UPDATE I increases at a simple example to add will post editing text as Programmetik
public class Main activity (LinearLayout myLayout; @ override protected void saved create (bundled Instansstet) {Suprknkret (saved Instensstet); setContentView (R.layout.activity_main); MyLayout = (LinearLayout) for findViewById (R.id.linearLayout); (Int i = 0; I <5+ i ++) {Last Editing Text My Edit Text: New Stamp Day text (main activity. This); // This pass / materials for an activity or reference // show it your best Aditekt. EditText .setOnClickListener (new View.OnClickListener () {@Override on public void ( View v) {// Discover // process present the final calendar c = Calendar.getInstance (click on); int mHour = c.get (calendar. HOUR_OF_DAY); int mMinute = c.get (calendar. Maianutii ); Time PictureDioGroup TPD = New Time PictureDialog (Main Activity. Number, // the Activity New Time Picture reference before dialogue. Onetime Stuttlist () {@Override Time-Sets at Public Zero (TimeCucker View, In Hour Hourfight, Int Minute) {myEditText.setText (HourEfed + ":" + Minute); // you set the time for editing text)}, MHour, mMinute, false); Tpd.show (); }}); MyLayout.addView (myEditText); }}}
Comments
Post a Comment