Greeting!! I wanted to display table like this:-
- 1 * 1 = 1
- 1 * 2 = 2
-
-
-
1 * 10 = 10
But i am able to display 1st line then it disappear then it show next line . i am trying with string array to display the number.
Here is my code:-
public class MainActivity extends Activity {
TextView txtView;
static String test[]={"","1","","1 *","","1 * 1","","1 * 1 = 1",
"","1","","1 *","","1 * 2","","1 * 2 = 2",
"","1","","1 *","","1 * 3","","1 * 3 = 3",
"","1","","1 *","","1 * 4","","1 * 4 = 4",
"","1","","1 *","","1 * 5","","1 * 5 = 5",
"","1","","1 *","","1 * 6","","1 * 6 = 6",
"","1","","1 *","","1 * 7","","1 * 7 = 7",
"","1","","1 *","","1 * 8","","1 * 8 = 8",
"","1","","1 *","","1 * 9","","1 * 9 = 9",
"","1","","1 *","","1 * 10","","1 * 10 = 10"};
Handler handler;
ImageView imageView;
Runnable runnable;
StringBuilder sb = new StringBuilder();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Intent i = getIntent();
String someVariable = i.getStringExtra("MA");
Toast.makeText(getApplicationContext(), "SomeVariable" +someVariable, 222).show();
txtView = (TextView) findViewById(R.id.greentxt_name);
handler = new Handler();
runnable = new Runnable() {
int t=0;
public void run() {
sb.append(test[t]);
t++;
if( t>=79)
{
handler.removeCallbacks(runnable) ;
txtView.setText(test[t]);
}
else
{ txtView.setText(test[t]);
handler.postDelayed(this,1000);
}
}
};
handler.postDelayed(runnable, -1000); //for initial delay..
}
}
Any answer is appreciable.
Thank's in advance