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!
Related
Long post ahead...
Ok, I'm not sure how to explain it so I made a couple of screenshots. Also, I want to start off by saying I'm not looking for somebody to write code for me to copy, or links to specific articles. I just need help figuring out if what I want to make is possible and any direction on what to look at. I just haven't done something like that and so far I can't seem to word my searches well enough it seems to be able to find a solution.
TL;DR: I need to get scrn2 to either swipe left and right to prev/next card from the RecyclerView, or add buttons that do that
So. Here's the screenshot. I have already made scrn1 and scrn2, and am looking for a way to get to my mockup (that heart button there is just wishful thinking and I'm not at all concentrating on it, and the buttons on top of the cards are just a left-over from an old test I forgot to remove).
The idea behind this is just sort of a catalogue/text book to help with self-preparation for an exam on a specific topic.
What I have is a RecyclerView that I've populated with CardViews in an ArrayList. Since I'll be having a few cathegories of cards, and each will have around 40-50 in there, this seems like an efficient and quick way to load a long list like that, and it runs smoothly so far so I'm happy with it.
In order to get a "full details" screen (scrn 2) I implemented Parcelable to my single item template/class, and now when I click on a card I get that second activity that shows the full sized image, title and full description text.
I also added a search that filters the cards in real time, since there will be many of them and I want it to be easy to get to a specific item.
So far so good. Everything works, surprisingly.
Where I'm stuck now is that it will be extremely annoying for somebody to keep going in and out of the single items in order to get to the next one, so I need to be able to either make them scroll or have buttons at the bottom that go to previous and next. The thing is, the only time I've used swiping is in a tabbed activity and that requires fragments. When making those I had to have an xml for each tab, and a class to correspond to it, which is definitely not comfortable when I have 40 in 10 categories.
I assume I need something like an onClick event to add for buttons in the activity that holds the information that gets acquired from the RecyclerView to bring a specific position from my ArrayList... Like, if somebody clicks on the third card, the button brings -1 or +1. Or something like that?
Makes some sense in my head, but I can't find a way to search for that, and can't figure out if it's even possible to make. Soo any pointers would be hella useful. I'm really excited about being able to do that much from scratch, but still lack too much knowledge to be able to imagine what would work here. I'm still testing things out and am looking around for information, but will be happy if somebody has input on the situation.
I am new to Java and I am working on a project where depending on number of files in a directory,
buttons will be created respectively. Each button will have a customized right click context menu.
How can I achieve this or is this feasible?
I just want to know the approach to do this.
The approach that you may try:
While you iterate your directory/file list (or other process that will determine the button creation), you can generate (create an instance of) a new button (JButton), I assume you know how to use new, and put it on your form / panel.
However, most of the time, layout would become an annoying issue here.
Thus, you may try to use MigLayout to handle this.
It will help you a lot in putting your stuffs in a tidy and convenient way.
Try this approach and when you have a specific coding-part question, you can try to search the existing solution in SO (StackOverflow) or if it doesn't exist, you can ask that specific code-related question.
Hope it helps.
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.
I have an idea for my application, but I don't how to go about implementing it. Basically, I have a chat application, but you're able to tell the application whether it's a happy or sad message. I drew it out to hopefully make it easier for you to understand. Can anyone provide me with any insight on creating this kind of effect?
Step one (Hidden):
Step two (User clicks face):
Step three (user clicks face and it disappears):
Try this library.
Tutorial here - http://www.londatiga.net/it/how-to-create-quickaction-dialog-in-android/
Library here - https://github.com/lorensiuswlt/NewQuickAction
Use QuickActionController. Find the source of the Control at https://github.com/lorensiuswlt/NewQuickAction.
You just need to shift the position of display towards the right at quickaction UI class. Your requirement will be met.
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.