[android-developers] Re: View Activity Communicaton

2008-04-10 Thread hackbod
On Apr 9, 8:43 pm, Rui Martins <[EMAIL PROTECTED]> wrote: > Is there a way to avoid the Dark Grey background while the application > is starting, like setting up a layout.xml or similar, so that we get > either a predefined background or at the worst case a full Black > background while the appli

[android-developers] Re: View Activity Communicaton

2008-04-09 Thread Rui Martins
Once again thank you for the feedback. I would then suggest for someone to review the examples, since I'm 99% sure that I got the Application suggestion, from an Android Documentation example, I just can't pin point it right now. Currently, it's working a lot better and faster, by using activity

[android-developers] Re: View Activity Communicaton

2008-04-09 Thread Rui Martins
Once again thank you for the feedback. I would then suggest for someone to review the examples, since I'm 99% sure that I got the Application suggestion, from an Android Documentation example, I just can't pin point it right now. Currently, it's working a lot better and faster, by using activity

[android-developers] Re: View Activity Communicaton

2008-04-08 Thread hackbod
On Apr 8, 3:21 pm, Rui Martins <[EMAIL PROTECTED]> wrote: > I checked my code, and I was giving the Application to the View > Constructor, as the context, which I believe is correct, although we > can also pass the activity (this) No, it is not correct to give the Application. The views you are

[android-developers] Re: View Activity Communicaton

2008-04-08 Thread Rui Martins
I checked my code, and I was giving the Application to the View Constructor, as the context, which I believe is correct, although we can also pass the activity (this) My code was: setContentView( new GameMenuView( getApplication() ) ); > Well, you have a range of choices: > > - U

[android-developers] Re: View Activity Communicaton

2008-04-08 Thread hackbod
On Apr 8, 7:22 am, Rui Martins <[EMAIL PROTECTED]> wrote: > But having to force a cast on the context given to a view, just to be > able to call the methods from the activity on the same context, seems > like a hack to me. > Probably better than what I'm doing know (forcing the flag > NEW_TASK_LAU

[android-developers] Re: View Activity Communicaton

2008-04-08 Thread Dan U.
That would work, but I'm not sure if it's possible to still use the view in an xml layout. On Apr 8, 7:25 am, ThursdayMorning <[EMAIL PROTECTED]> wrote: > I had this exact question a while ago, when I was building some custom > View components. What I wanted was a little more complicated though -

[android-developers] Re: View Activity Communicaton

2008-04-08 Thread ThursdayMorning
I had this exact question a while ago, when I was building some custom View components. What I wanted was a little more complicated though - it was basically this. Basic containing view, set in the Activity class itself Several classes stored inside the activity with views defined *inside those c

[android-developers] Re: View Activity Communicaton

2008-04-08 Thread Rui Martins
Thanks a lot dor the input. >From all that was said, I believe that I may be feeding the View Constructor with something else than the activity, probably something like Application or similar, I know I copied one example from the SDK, if I'm not mistaken, I'll have to check when I get back home

[android-developers] Re: View Activity Communicaton

2008-04-08 Thread Dan U.
True. To make it more generic, some class checking should be done. On Apr 8, 12:28 am, hackbod <[EMAIL PROTECTED]> wrote: > On Apr 7, 11:52 pm, "Dan U." <[EMAIL PROTECTED]> wrote: > > > > Inside a view, apparently we can't get a reference to the Activity > > > that contains us (the view), and eve

[android-developers] Re: View Activity Communicaton

2008-04-08 Thread hackbod
On Apr 7, 11:52 pm, "Dan U." <[EMAIL PROTECTED]> wrote: > > Inside a view, apparently we can't get a reference to the Activity > > that contains us (the view), and even if there is a way to get the > > reference, we can't probably call it directly, due to UI threading > > issues. > You do have acc

[android-developers] Re: View Activity Communicaton

2008-04-08 Thread hackbod
On Apr 7, 10:54 pm, Rui Martins <[EMAIL PROTECTED]> wrote: > Another Example: > How do we call our activity finish method, from our activity view > class ? You can either hand the activity to the view for it to make calls on to, or have a callback interface from the view that the activity impleme

[android-developers] Re: View Activity Communicaton

2008-04-08 Thread hackbod
On Apr 7, 10:22 pm, Rui Martins <[EMAIL PROTECTED]> wrote: > Now if, you look at the View object, it's the only one to have user > input handlers, like: > onMotionEvent( MotionEvent event ) ( or onTouchEvent for M5), and > onKeyDown( int keyCode, KeyEvent event ) ! > An Activity doesn't have those

[android-developers] Re: View Activity Communicaton

2008-04-07 Thread Dan U.
> I'm not setting these view components through > androidManifest.xml. I don't think I understand. How does a view have anything to do with the androidmanifest? On Apr 7, 11:08 pm, Rui Martins <[EMAIL PROTECTED]> wrote: > Possibly an important piece of information that I haven't mentioned > befo

[android-developers] Re: View Activity Communicaton

2008-04-07 Thread Dan U.
> Inside a view, apparently we can't get a reference to the Activity > that contains us (the view), and even if there is a way to get the > reference, we can't probably call it directly, due to UI threading > issues. You do have access to the Activity. It's actually the Context that gets passed i

[android-developers] Re: View Activity Communicaton

2008-04-07 Thread Dan U.
Wow, a lot of stuff to cover. I'll try to keep it short. > Now if, you look at the View object, it's the only one to have user > input handlers, like: > onMotionEvent( MotionEvent event ) ( or onTouchEvent for M5), and > onKeyDown( int keyCode, KeyEvent event ) ! > An Activity doesn't have those

[android-developers] Re: View Activity Communicaton

2008-04-07 Thread Rui Martins
Possibly an important piece of information that I haven't mentioned before. I'm NOT using the available Android widjets, like buttons and similar, to avoid GUI problems between SDKs, specially since the application is a game, and is NOT common to use the phone OS GUI inside a game. Games usualy

[android-developers] Re: View Activity Communicaton

2008-04-07 Thread Rui Martins
Another Example: How do we call our activity finish method, from our activity view class ? Inside an Activity context, we can just call finish(); Inside a view, apparently we can't get a reference to the Activity that contains us (the view), and even if there is a way to get the reference, we c