Win a copy of Head First Android this week in the Android forum!

Mike Cole

Ranch Hand
+ Follow
since Sep 25, 2006
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mike Cole

Hi all,

i want to make a class that has a visual representation on the screen and reacts to mouse-clicks or other events. I DONT want to interhit it from a JComponent, Button or something. I want to build it from the ground up, which will also teach me a bit more about Java (classes and interfaces i havent seen so far). While this is a nice aim... i have problems where to start.

What are the minimum requirements(Interfaces/Classes) my own class needs to reach these goals? (Visual representation and "clickable")

Thnak you for your time,

Mike
14 years ago
Hi all,
ive made a little game for my mobile. I have a splash screen, where i want the user to click one of the softbuttons or a number or the fire-button.
While this all works fine in the emulator, it does not on the device itself.
What would be the best solution that works on any device?
uhm...
The SplashScreen extends GameCanvas...
And is switched to full screen...

Thnx in advance!
[ June 03, 2007: Message edited by: Mike Cole ]
14 years ago
ahh.. i forgot.
To get the values out of an int. You need bitmasking.
14 years ago
Use bitshifting, you can make your own class around it.

Thats the way how a integer-color is build up (argb)
alpha = 0xff000000 = alpha 255
red = 0x00ff0000 = red 255
green = 0x0000ff00 = green 255
blue = 0x000000ff = blue 255

So to add the blue to your int value you can just add it.
For the others you�ll need to shift them to the left.
(8,16,24)
---
You can write a test-prog. and print out the value of the in as hex
sout(String.format("0x%08X",color));
14 years ago
Hi all,

i have a problem with xmlBeans and somehow i dont see a solution atm. maybe someone of you can help me.
I have different xml-Files which are nearlly identical(exept for some minor tags)
One for text, one for images.

So i though i am clever and make two different xmlBean-Libraries (jars)
It worked as expected with the images. But now iam trying to load the articles...

To create an image-document i use this:

Later on i try to import the text:

and i get following error message:


Nowhere in my code i try to cast anything. I just use these two xmlBean Libraries (one called img.jar, the other txt.jar)
To make them more different ive used that xsdconfig stuff. Thats why they have the text/image suffix everywhere.

Can anyone help me with this? Thnx!
14 years ago
Hi all,

can somebody tell which is the simpliest way to to escape chars in a String?
Lets say i found "(si)" and want to replace it by something diffrent. But the String.replaceAll uses regex, so it will find "si" as a group. In short i need the String "(si)" translated to "\(si\)".

Thanks
15 years ago
Ahh cool, i didnt think about that. Thanks for the explanation! Damn now i have to change all my code
15 years ago

you should code to the interface, not the implementation



Can you explain why?? Ive never heard of that.
15 years ago
No, that should work.
Maybe the error is before that?

Anyway, you can allways make a new file(without anything else) and try if it works there. If it doesen't work there too, you have another problem...
15 years ago
Hi all,

i have a question. When exactly should a GlassPlane be used? And how can i find out whats under it(Buttons, Labels etc.)
Sure i could use use the position of the mouse-cursor but that won't help if it is something like a scrollable menu or something, right?

Maybe someone can bring a bit light into the dark.

Thank you,

mk
15 years ago
Rock n' Roll... that looks exactly like what i was searching for!

Thnx, can't wait to take a look at it @home.
15 years ago
Hi,
Just a small question is it possible to make a window which is not square...
Something like some audio-app-skins where you can the desktop behind it and the player itself has something like a circle as window form or something... yeah, the description is a bit vague because i dont know how thats called

If it is possible to do so, i would appriciate some hints and tips.

Thnx

mk
15 years ago
Good feeling's gone...

What is wrong with this? Shouldn't that work?



Thnx for your help and time.

mk
15 years ago
Found a simple solution:


But i will still check the scanner class. The name sounds like fun
15 years ago
I dont know what a static class is.

Maybe you mean static functions and members?

If you have a function that does not to keep track of own internal variables and gets everything that it needs to fullfill the request via parameters then you can make it static...

For such functions theres no need to make an object.

(As far as i understand, so use this info with care )
15 years ago