Overriding AnalogClock in Android - java

I want to create an AnalogClock that can display a preset time, given as a parameter.
And I want to draw between the background and the hands. I want to paint the area between the minute-hand and location of the hour-hand at a preset future time. This is to let the user see how much time remains for the current activity.
I thought that I could take the AnalogClock object and extend that. However, when I create a new function that is essentially a copy of one of the old ones, I get errors on the com.android.internal.R.styleable.AnalogClock* objects: "com.android.internal.R cannot be resolved"
How can I import these objects? I've read something about declare-styleable, but I cannot figure out how to apply that to my situation. (Sorry, I'm really a Java n00b)
For instance, the internal objects refer to several graphical things, such as dials, hour_hand and minute_hands.
Here's my code: http://pastie.org/713276
Any help is very much appreciated, I am stuck after hours of Google.

Here is an tutorial for creating a custom Analog Clock. Shows some sample code, hope this is at least a start in the right direction.

Set time with custom android AnalogClock from its original class Please have a look at my solution. You can use it to display a custom analog clock in a application and set time that you want in it.

Related

FancyOverFlow on swipe listener

Im using this library to create a gallery,and im kinda new to android programing but i want to add a listener to when the user swipe down the image it will be deleted.
thanks for the helpers,and if you didnt understood me tell me to rephrase.
Ok, since you haven't tried anything, and thus you don't have a specific question, all I can do is trying to point you in the right direction (I hope).
I suggest that you do the following:
1) Setup the library: take a look at the examples provided by FancyOverFlow.
2) Make sure that you understand what is going on about the code that you use, don't add code "just because it works". Do this as a rule of thumb for every code that you write. If you are using a 3rd party code library, you don't have to fully understand how every method works internally, but make sure that you understand in/outputs of the methods you are calling. Understanding how things work will make it much easier to modify your own code.
3) Find out which component has the hold of your current image in displayed gallery. This will be the control on which you will set up a swipe listener do detect user swipe moves. I haven't tested this, but I suspect taht in this case the component is called FancyCoverFlow (take a look at README.md file).
4) Take a look at Swipe Views (or any tutorial that does swiping) and adapt your code.
If you are new to Android, it may take a while, but don't give up!

Using java Robot class

I want to write an address in the address bar of a browser as well as click on a link using java Robot class. How can I track the different objects in a certain window?
Just giving a look at the API http://docs.oracle.com/javase/7/docs/api/java/awt/Robot.html, anyone who do this should know that via Robot Class there is no "trackComponent(Component specificComponent)" method, you got 2 things that may help you:
1-getPixelColor (more than help, seems useless for you by now, maybe i'm wrong).
2-createScreenCapture.
the second method is maybe the answer for your problem, you could take a picture of the screen and with some image processor (javaCV could help you on this: https://code.google.com/p/javacv/) you could then track the components on the screen you took (for instance: from pixels xxx to pixels yyy is the Address bar of browser), of course you need to read some documentation about javaCV (OpenCV) for get this done, after that just use the method for move cursor and enter keys for fill the components, hope someone give a simpler way to do this, but i think this way you learn a bit of JavaCV a really powerful tool.

Calling a Bitmap Class in Java

I found this post on the site:
Blackberry Clickable BitmapField
explaining a class where you can draw a clickable bitmap. This is exactly what I want to do but the issue for me is that I'm quite new to Java and I don't know how to properly call this statement. What are the commands to create this bitmap? So far all I have is:
CustomMenuButtonField buttonInstance = new CustomMenuButtonField("img1.png", "img2.png");
aside from that I don't know how to make the drawing appear. If I try:
buttonInstance.paint(graphics);
I need to declare graphics which I am not sure how to do. I've checked the API but its still a bit confusing to me. Also where should these call statements be used? In the userInterface constructor?
Once you create your custom button field, you just need to add it to your screen:
add(buttonInstance);
It will then be displayed by the framework automatically. For more info, see the Getting Started Guide for the SDK version you are using in the Development Guides.

Java | I need to make an applet but I don't know how to begin

I need to make kind of a game in Java but I am a total beginner. It has to be applicable to the web and I need to use images on it and action listeners. So, do you recommend any site to know how to begin?
The description of the game (it is not really a game but it implements things that usually are in a game) is this:
Show a matrix of images of 3x3 elements, then, hide them and put instead empty squares. The images shown in the matrix, must remain in the lower part of the screen just below the empty squares and they must be randomly positioned. The user, must click one image and put it on the correct empty square. The result, must be, how many images were correctly positioned, the time it took to end the game, the time between mouse clicked and released for each image.
For additional information, I want you to know that this application is for a friend of mine who studies medicine. He wants this program to test patients who accident and receive hits on their heads. You may think that the description I gave you may not be a good software for that purpose, and in fact, it may be not, but, once I know the management of all that is required (Images, MouseListeners, how to introduce it to a web etc), I will be able to make a better product. So, please tell me, how can I begin?. What do I need to know?
I would start here. Except for some startup boilerplate and the restrictions of the sandbax (which, based on your description, you will b unlikely to encounter), there is no fundamental difference in an applet from normal code.

Working in java image

I will explain my question clearly.
I need to zoom in/zoom out the world map.
When I click on the particular country in map, control should redirected to new page with respective the country.
I dont have any idea about this in java. Please explain the steps to acheive the above task.
As the question is quite general, here is a general answer: Zooming often means, that you want to display a certain percentage of somethin, and not the whole, where your size of the displayed will not change.
But in your case it seems more like a "find a mouse click in a polygon" thing. So you have to add a selection/click listener to whatever widgets you use (Swt? swing? ....?) where you change what your program renders.
It sounds like you may be trying to reinvent the wheel. Google etc have already solved this problem rather well. It might be better to incorporate an existing solution into your application. Have a look at GoogleEarth inside Java Swing.

Categories

Resources