Taha Körkem
Taha Körkem

Reputation: 906

How change TextView text

                 DateTime startDate8 = DateTime.now(); 
                 DateTime endDate8 = new DateTime(2014, 11, 5, 15, 0);

                 Period period8 = new Period(startDate8, endDate8, PeriodType.dayTime());

                 PeriodFormatter formatter8 = new PeriodFormatterBuilder()
                 .appendMinutes()
                 .toFormatter(); 

               tw.setText(String.valueOf(formatter8.print(period8))); 

My android app.

if tw is empty;
tw="00"

if tw is one-digit text, one-digit value = "x";
tw = "0x"

tw is text in TextView. i want write "00" to tw when tw was empty i want write prefix "0" to tw when tw was one-digit character

i explained https://i.sstatic.net/LbIT1.png

Upvotes: 0

Views: 67

Answers (1)

Lukas
Lukas

Reputation: 2554

if(tws.getText().toString().isEmpty()){
tw.setText("00")
}

if(tws.getText().toString().equals("x")){
tw.setText("0x")
}

Upvotes: 1

Related Questions