Progress Bar not progressing



I am doing a prime tester application and i want to show the progress of the testing while taking place. Here is my code when i run it on my phone i don't see the progress bar horizontal filling it just stays there.



public class MainActivity extends Activity{

//My global Views
Button b;
TextView tv;
EditText et;
int alaa;
ProgressBar pb;
long dv;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

//The References
b = (Button) findViewById(R.id.bt);
tv = (TextView) findViewById(R.id.tv);
pb = (ProgressBar) findViewById(R.id.progressBar1);
et = (EditText) findViewById(R.id.et);


b.setOnClickListener( new View.OnClickListener() {


//CALCULATE INPUT
public void onClick(View v) {
if(et.getText().toString().isEmpty()){
tv.setText("Please Insert a Number!");
}else{
int etll = Integer.parseInt(et.getText().toString());
Long etl = Long.parseLong(et.getText().toString());
long a=0;
int torf = 0;
pb.setMax(etll);
int alaa = 0;
long etlt = etl/2 + 1;
for(a=2;a<etlt;a++){
if(alaa > etll){
setProgress(alaa);
alaa++;
}
if(etl%a == 0){
torf = 1;
dv = a;
break;
}
}

No comments:

Post a Comment