The example is quite simple: I want to tell the user what the application is doing by simply showing the text (canvas.drawText ()). Then my first message appears, but not others. I mean, I have a setText method, but it does not update.
onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(splash); // splash is the view class loadResources(); splash.setText("this"); boundWebService(); splash.setText("that"): etc(); splash.setText("so on"); }
The text drawing of the view works by doing only drawText in onDraw () ;, so setText changes the text but does not show it.
Someone recommended me replacing the SurfaceView, but it would be very difficult for just a few updates, SO ... how could I update the view dynamically at runtime?
It should be pretty simple, just showing the text in 2 seconds, and then the main thread making it material, and then updating the text ...
Thanks!
Update:
I tried implementing handler.onPost (), but this is the same story over and over again. Let me tell you the code:
public class ThreadViewTestActivity extends Activity { Thread t; Splash splash; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); splash = new Splash(this); t = new Thread(splash); t.start(); splash.setTextow("OA"); try { Thread.sleep(4000); } catch (InterruptedException e) { } splash.setTextow("LALA"); } }
and
public class Splash implements Runnable { Activity activity; final Handler myHandler = new Handler(); public Splash(Activity activity) { this.activity=activity; } @Override public void run() {
Although the surge in another thread, I put the dream in the main thread, I use the handler to control the user interface and everything, it does not change anything, it shows only the latest update.