just send a message to the ui thread telling it to refresh On Feb 10, 12:14 pm, Isuru Madusanka <[email protected]> wrote: > I am working on ProgressBar class in android, but I can't make it > progress through 5 seconds and load the application. Everything works > but the progress bar not progressing. Here is the code. > > public class StartPoint extends Activity{ > > ProgressBar progressBar; > private int progressBarStatus = 0; > > @Override > protected void onCreate(Bundle savedInstanceState) { > // TODO Auto-generated method stub > super.onCreate(savedInstanceState); > setContentView(R.layout.splash); > > progressBar = (ProgressBar)findViewById(R.id.progressBar1); > > Thread timer = new Thread(){ > public void run(){ > try{ > sleep(5000); > while(progressBarStatus < 5000){ > progressBar.setProgress(progressBarStatus); > progressBarStatus += 1000; > > } > }catch(InterruptedException e){ > e.printStackTrace(); > }finally{ > Intent openMainList = new Intent(StartPoint.this, > in.isuru.caf.MainList.class); > startActivity(openMainList); > } > } > }; > timer.start(); > > } > > protected void onPause(){ > super.onPause(); > finish(); > > } > } > > Here is the layout file > > <?xml version="1.0" encoding="utf-8"?> > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ > android" > android:layout_width="match_parent" > android:layout_height="match_parent" > android:orientation="vertical" > > > <ImageView > android:id="@+id/imageView1" > android:layout_width="wrap_content" > android:layout_height="wrap_content" > android:src="@drawable/mary_mother_of_god" /> > > <ProgressBar > android:id="@+id/progressBar1" > style="?android:attr/progressBarStyleHorizontal" > android:layout_width="match_parent" > android:layout_height="wrap_content" > android:layout_weight="1.67" /> > > </LinearLayout>
-- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

