[Ubuntu-ma] (sans objet)
H. Mohammed Amine
h0uss4m at gmail.com
Lun 9 Aou 15:13:19 BST 2010
Dude, you're great ! thnx a lot ! i hope you would answer some of my
questions next time cuz i'm a kind of n00bs :s
On Mon, Aug 9, 2010 at 1:55 PM, Nordin <bouchtaoui at gmail.com> wrote:
> On 9-8-2010 15:27, H. Mohammed Amine wrote:
> > great ! and what about using the threads ?
> >
>
> Don't use threads for now, it's a horrible thing. Threads make things
> more complicated than needed. It depends on what you want.
> As far as my experience goes (on Windows with C++ and C#), you can only
> access the user interface components like buttons and text fields from
> the main thread. That's the thread your application is started from. If
> you create another thread to do some calculation, than you can't just
> access the graphic object to do the drawings. I'm sure there are tricks
> to achieve that, but than you'll end up with lots of readings and
> experimenting to have good control over it.
>
> Threads are useful if you have to wait a long time for a connection or
> data (from a serial port or from a tcp connection), in that case,
> instead of waiting all the time (which makes your UI not responding),
> it's better to do that in a separate thread and let the thread do the
> waiting. If something happens in that thread, you can inform the main
> thread with a message, signal or whatever construction they use in Java.
> In windows (using Visual C++) we have something like PostMessage()
> function call, to send a message from one thread to another. In C# I
> don't remember how to do that, but it's an ugly way to do that.
>
> So my advise is, don't use it for something like an animation, timers
> are much better and very simple to use comparing to threads.
> If you want to play with threads, we can do that next time together ;-).
> I want to write a simple chat app for Android (just for experimenting),
> we will use a thread for that (socket connection handling). If you can't
> wait, there is enough opensource code that works with threads in Java :).
>
>
> > On Mon, Aug 9, 2010 at 1:24 PM, Nordin<bouchtaoui at gmail.com> wrote:
> >
> >
> >> No problem,
> >>
> >> This construction is used a lot, because that keeps the user interface
> >> responsive.
> >> Imagine your animation is repeating forever in a loop, you want to be
> >> able to stop with a stop button.
> >> But because you're app is caught in a loop, you're unable to press stop,
> >> this makes your app is not responding and eats a lot of CPU resource.
> >> I don't know if you've seen a windows app freezing, well, that's the
> >> same result you'll get with your application.
> >>
> >> Using a timer your app can respond on a stop button and everything is
> >> fine ;-)
> >> I hope you understand :)
> >>
> >>
> >>
> >> On 9-8-2010 14:48, H. Mohammed Amine wrote:
> >>
> >>> nice idea ! thnx :) i'll try this
> >>>
> >>> On Mon, Aug 9, 2010 at 12:16 PM, Nordin<bouchtaoui at gmail.com> wrote:
> >>>
> >>>
> >>>
> >>>> On 9-8-2010 14:05, H. Mohammed Amine wrote:
> >>>>
> >>>>
> >>>>> No, No Compil Error i'm okeh till now !! i'm looking for how to anime
> >>>>>
> >> it
> >>
> >>>>>
> >>>> ! i
> >>>>
> >>>>
> >>>>> think something called timer
> >>>>> thnx :)
> >>>>>
> >>>>>
> >>>>>
> >>>> Yes, a timer would be the most logical way ;-)
> >>>> I think you first try it by every time pushing on a button (manually)
> >>>> and see if your animation does what it should do.
> >>>> When everything goes fine, you can replace your button by a timer,
> that
> >>>> triggers every 200 ms. In the timer handler you do the calculation and
> >>>> than update your drawings.
> >>>>
> >>>>
> >>>>
> >>>>> On Fri, Aug 6, 2010 at 3:57 PM, Gmail account<allali.ayoub at gmail.com
> >>>>> wrote:
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>> @H Mohammed Amine ,*
> >>>>>> *what is wrong with your code ?
> >>>>>> did you have any compilation error ?
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>> AYYOUB Allali
> >>>>>> JEE junior developer
> >>>>>> +(212) 644 67 79 24
> >>>>>>
> >>>>>>
> >>>>>> --
> >>>>>> Ubuntu-ma mailing list
> >>>>>> Ubuntu-ma at lists.ubuntu.com
> >>>>>> Modify settings or unsubscribe at:
> >>>>>> https://lists.ubuntu.com/mailman/listinfo/ubuntu-ma
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>
> >>>>>
> >>>> --
> >>>> Ubuntu-ma mailing list
> >>>> Ubuntu-ma at lists.ubuntu.com
> >>>> Modify settings or unsubscribe at:
> >>>> https://lists.ubuntu.com/mailman/listinfo/ubuntu-ma
> >>>>
> >>>>
> >>>>
> >>>
> >>>
> >>>
> >>
> >> --
> >> Ubuntu-ma mailing list
> >> Ubuntu-ma at lists.ubuntu.com
> >> Modify settings or unsubscribe at:
> >> https://lists.ubuntu.com/mailman/listinfo/ubuntu-ma
> >>
> >>
> >
> >
> >
>
>
> --
> Ubuntu-ma mailing list
> Ubuntu-ma at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-ma
>
--
*H Mohammed Amine*
Ce Qui Ne Nous Tue Pas Nous Rends Plus Fort !
-------------- section suivante --------------
Une pièce jointe HTML a été nettoyée...
URL: https://lists.ubuntu.com/archives/ubuntu-ma/attachments/20100809/6a8926b0/attachment.htm
Plus d'informations sur la liste de diffusion Ubuntu-ma