I m creating an clock which will show the present time on the UI I want to show the digitd through the pictures from 0 to 1 For this i m taking the images from 0 to 9 one over the another making a stack and then changing the tranparancy of the image according to the number i want to show
@Override
protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_main);
super.onCreate(savedInstanceState);
i0.setAlpha(1);
i1.setAlpha(1);
i2.setAlpha(1);
i3.setAlpha(1);
i4.setAlpha(1);
i5.setAlpha(1);
i6.setAlpha(1);
i7.setAlpha(1);
i8.setAlpha(1);
i9.setAlpha(1);
Timer Tim=new Timer();
Tim.schedule(new TimerTask()
{ @Override
public void run()
{ runThread(); }
},1000,1000);
}
private void runThread()
{ runOnUiThread (new Thread(new Runnable()
{ public void run()
{
if(x==0){
i0.setAlpha(1000);
i1.setAlpha(1);
i2.setAlpha(1);
i3.setAlpha(1);
i4.setAlpha(1);
i5.setAlpha(1);
i6.setAlpha(1);
i7.setAlpha(1);
i8.setAlpha(1);
i9.setAlpha(1);}
if(x==1){
i0.setAlpha(1);
i1.setAlpha(1000);
i2.setAlpha(1);
i3.setAlpha(1);
i4.setAlpha(1);
i5.setAlpha(1);
i6.setAlpha(1);
i7.setAlpha(1);
i8.setAlpha(1);
i9.setAlpha(1);}
if(x==2){
i0.setAlpha(1);
i1.setAlpha(1);
i2.setAlpha(1000);
i3.setAlpha(1);
i4.setAlpha(1);
i5.setAlpha(1);
i6.setAlpha(1);
i7.setAlpha(1);
i8.setAlpha(1);
i9.setAlpha(1);}
if(x==3){
i0.setAlpha(1);
i1.setAlpha(1);
i2.setAlpha(1);
i3.setAlpha(1000);
i4.setAlpha(1);
i5.setAlpha(1);
i6.setAlpha(1);
i7.setAlpha(1);
i8.setAlpha(1);
i9.setAlpha(1);}
if(x==4){
i0.setAlpha(1);
i1.setAlpha(1);
i2.setAlpha(1);
i3.setAlpha(1);
i4.setAlpha(1000);
i5.setAlpha(1);
i6.setAlpha(1);
i7.setAlpha(1);
i8.setAlpha(1);
i9.setAlpha(1);}
if(x==5){
i0.setAlpha(1);
i1.setAlpha(1);
i2.setAlpha(1);
i3.setAlpha(1);
i4.setAlpha(1);
i5.setAlpha(1000);
i6.setAlpha(1);
i7.setAlpha(1);
i8.setAlpha(1);
i9.setAlpha(1);}
if(x==6){
i0.setAlpha(1);
i1.setAlpha(1);
i2.setAlpha(1);
i3.setAlpha(1);
i4.setAlpha(1);
i5.setAlpha(1);
i6.setAlpha(1000);
i7.setAlpha(1);
i8.setAlpha(1);
i9.setAlpha(1);}
if(x==7){
i0.setAlpha(1);
i1.setAlpha(1);
i2.setAlpha(1);
i3.setAlpha(1);
i4.setAlpha(1);
i5.setAlpha(1);
i6.setAlpha(1);
i7.setAlpha(1000);
i8.setAlpha(1);
i9.setAlpha(1);}
if(x==8){
i0.setAlpha(1);
i1.setAlpha(1);
i2.setAlpha(1);
i3.setAlpha(1);
i4.setAlpha(1);
i5.setAlpha(1);
i6.setAlpha(1);
i7.setAlpha(1);
i8.setAlpha(1000);
i9.setAlpha(1);}
if(x==9){
i0.setAlpha(1);
i1.setAlpha(1);
i2.setAlpha(1);
i3.setAlpha(1);
i4.setAlpha(1);
i5.setAlpha(1);
i6.setAlpha(1);
i7.setAlpha(1);
i8.setAlpha(1);
i9.setAlpha(1000);}
x=x+1;
if (x==10){x=0;}
}
}));
}
}
I cannot take 10 images for each digit i want to show can any 1 suggest any other way to do that. Is it possible through "view"..? can any1 tel me how to use views in android..?