Skip to content

Commit

Permalink
change in time format
Browse files Browse the repository at this point in the history
  • Loading branch information
Divyanshuk committed Oct 27, 2018
1 parent 108622e commit c6d2087
Showing 1 changed file with 8 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

public class SelectTime extends AppCompatActivity {

String helper;

EditText ct1;
EditText ct2;
EditText ct3;
Expand Down Expand Up @@ -83,6 +85,7 @@ protected void onCreate(Bundle savedInstanceState) {
@Override
public void onClick(View v) {
setTime(ct1);

}
});

Expand Down Expand Up @@ -254,9 +257,9 @@ public void onClick(View v) {
String jsonMqtt = "{\n" +
" \"value\":\n" +
"\t\t{\n" +
"\t\t\t\"t1\":["+commaString(new SharedPrefClass(SelectTime.this).getTimings("timings1 : "))+"], \n" +
"\t\t\t\"t2\":["+commaString(new SharedPrefClass(SelectTime.this).getTimings("timings2 : "))+"],\n" +
"\t\t\t\"t3\":["+commaString(new SharedPrefClass(SelectTime.this).getTimings("timings3 : "))+"]\n" +
"\t\t\t\"t1\":["+(new SharedPrefClass(SelectTime.this).getTimings("timings1 : "))+"], \n" +
"\t\t\t\"t2\":["+(new SharedPrefClass(SelectTime.this).getTimings("timings2 : "))+"],\n" +
"\t\t\t\"t3\":["+(new SharedPrefClass(SelectTime.this).getTimings("timings3 : "))+"]\n" +
"\t\t}\n" +
"}\n";

Expand Down Expand Up @@ -286,26 +289,15 @@ public void onTimeSet(TimePicker timePicker, int hourOfDay, int minutes) {
} else {
amPm = "AM";
}
chooseTime.setText(String.format("%02d:%02d", hourOfDay, minutes));
chooseTime.setText(String.format("%d,%d", hourOfDay, minutes));

}
}, currentHour, currentMinute, false);

timePickerDialog.show();

}

public String commaString(String str){

StringBuilder cStr = new StringBuilder(str);
// cStr.setCharAt(2,',');

if(str.equals("")) {
return "-1";
}
else
cStr.setCharAt(2,',');
return cStr.toString();
}

private void sendMessagetoAakash(final String str){

Expand Down

0 comments on commit c6d2087

Please sign in to comment.