Hi all in my application by using web service i get the data from database and stored that data in hash table.I took that data from hast table to array.this array data can be displayed in button.My array contains 10 elements.For animation i used view flipper.Now i want to do is display that array elements on button one after another for every 10sec.But in Updater method i didn't get all array elements.How to solve this one
i am sending my code //in on create method i wore this one
user_advertise is the hash table
System.out.println(""+user_advertise.size());
array=new String[user_advertise.size()];
e= user_advertise.keys();
int i = 0;
int j=0;
for(i=user_advertise.size();;i++){
array[j]=e.nextElement().toString();
LinearLayout layout = (LinearLayout) findViewById(R.id.LinearLayout01);
LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.FILL_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT
);
Button buttonView = new Button(this);
buttonView.setText("" +array[i]);
Timer timing = new Timer();
timing.schedule(new Updater(buttonView), 3000, 3000);
ViewFlipper flipper = new ViewFlipper (this);
flipper.addView(buttonView);
layout.addView(flipper,p);
flipper.startFlipping();
flipper.setClickable(true);
flipper.setFlipInterval(10000);
flipper.setInAnimation(AnimationUtils.loadAnimation(this,R.anim.push_left_in));
flipper.setOutAnimation(AnimationUtils.loadAnimation(this,R.anim.push_left_out));
}
}catch(Exception e)
{
Log.v("Add",e.toString());
}
}
private class Updater extends TimerTask {
private final Button buttonView;
public Updater(Button buttonView) {
this.buttonView = buttonView;
}
public void run() {
buttonView.post(new Runnable() {
public void run() {
int k=0;
buttonView.setText(" ");
buttonView.setText(""+array[k].toString()+"");
if(array[++k]!= null)
{
k++;
}
}