This has been resolved, I set the progress bar as gone, it will works correctly.[?]
On Wed, Apr 4, 2012 at 2:52 PM, GeekSnail <[email protected]>wrote: > I am developing a chess game, there is progress bar to indicating the > computer is "thinking". > At the start of the game, the progress bar will be hidden in default, > it will be set to visible when the computer is "thinking". > > The game board use a surfaceview to draw itself, so the progress bar > is works with the surfaceview. > > The progress bar will be controlled in a separate thread using > broadcast to inform UI thread to set the visible status of the > progress bar. > > but the progress bar can't be shown as i assume, more of the time, it > will not be shown but as long as it show, it will works fine. > > [code] > @Override > public void run() { > callback.showProgressBar(); > AISearch(); > callback.hideProgressBar(); > } > > GameMapView.Callback callback = new GameMapView.Callback() { > public void showProgressBar() { > Intent intent = new Intent(); > intent.setAction("progress"); > intent.putExtra("action", "show"); > GameMapActivity.this.sendBroadcast(intent); > } > > public void hideProgressBar() { > Intent intent = new Intent(); > intent.setAction("progress"); > intent.putExtra("action", "hide"); > GameMapActivity.this.sendBroadcast(intent); > } > > }; > > public BroadcastReceiver myReceiver = new BroadcastReceiver() { > @Override > public void onReceive(Context context, Intent intent) { > MyLog.d(TAG, "onReceive"); > String action = intent.getStringExtra("action"); > if (action.equals("show")) { > MyLog.d(TAG, "show"); > mProgress.setVisibility(View.VISIBLE); > } > > if (action.equals("hide")) { > MyLog.d(TAG, "hide"); > mProgress.setVisibility(View.INVISIBLE); > } > } > }; > > > [code] > > any idea about this? > > thanks in advance! -- 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
<<330.gif>>

