Gather parts from layout, java android - java

Im pretty new at programming android and this is my problem:
I have a layout page that i have alot of information on, including buttons and textedits. Now i want to split it up in different parts, without having to create different layouts for every headline. So for example, if i choose to see "Information 3" i want to hide everything else on the layout except the "information 3 text/buttons/textedits".
Is it possible to do this? Because i really dont have time for making a new layout for every headline, and i dont want to show every headline at the same time. (I want to keep all information/data in the same layout file)
Maybe there is a smarter way to do it? Thanks in advance!
/Erik

You can call view.setVisibility(View.GONE) if you want to remove it from the layout. you can search some more questions like these:
hide/show on click of Button
how-to-show-hide-grouped-views
Try these and if u need more help then let me know

Related

how do I attach a description to an imagen in android studio?

first of all I want to thank, because in this community I have found a lot of solutions to my development question. But this time I have a big one. I was looking for an answer to it in google and pdf´s and so on. But it's a complicated question and don't know how exactly ask for it in google. I new in app development. so here I go. I'm trying to do an app that shows the different recipes with photos and description like time that it takes and the difficulty and so.
explanation of the question
Apologize because the childish imagen to explain to you but you know (efficiency).
My two questions are:
1) How may I do to attach a description to an image. I mean, I want that the people can add their own recipes and of course I will make a formulary to this, but how may I do to when the people create the recipe that I suppose that it should be an object of a class, the TextView be attached to the bottom of the image automatically. in resume, that the image and the description with their elements be one unique element. I have tried to encapsulate the image and the text view in one layout, but in this case I don't know how to create a new layout once the app is running. ok the user fill the formulary but how to create a new layout on the run. I don't know how to solve this.
2) How may I do to change in the description of the image the quantity of red tomatoes. I mean. if the recipe have 3 in difficulty, 3 of 5, this is settled by the user, but how I do to show 3 red tomatoes of 5 and the other showed in gray?
I know you may say "another Newby" but I have realized that I love programming and in El Salvador (Central America) there´s almost any information about this subject. Again, thanks a lot.
one way to achieve that is by using Recycler view. and every time a user adds an item. you can add it to the list and the system will draw a new item for you.
check this tutorial
let me know if this helps or you need more explanation

Ideas on how to set a button to call a specific position from an ArrayList in a separate activity

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.

It is possible to implement following UI using ListView in JavaFX

It is possible to implement following UI using ListView in JavaFX:
(Since I do have enough reputation to post a image, it can be found here)
Which means not only the titles, but the dates and status(synced or not) as well.
The information in the ListView should be read form a ObservableList<CustomObject>. Each CustomObject has its properties including title, date, status, etc...
Finally, I will need to add a listener to it.(This won't be a big issue I think).
Again, thanks very much. Since my level is pretty low and I am possibly asking some stupid questions, I kindly ask you if you can explain with some actual codes.
Or, if a ListView cannot do such a thing, what else should I use?
What about using a VBox for the lines?
Then for each entry an other VBox with two entries for the two rows (one for the title and one for the date/status).
Title, date and status -> label
If you want to drag your scene together you can try:
https://docs.oracle.com/javase/8/scene-builder-2/installation-guide/jfxsb-installation_2_0.htm

Making Java button dynamically?

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.

Grid Layout on Android?

I'm looking to create a grid layout - a complicated version actually. Since I am new at Java (I have created some Android Applications) I don't really know how to do this.
Let me explain: I want a grid layout, that looks like this:
But, instead of having pictures and colours inside of each box of the grid.. I want to have a box with 3 apps that the user can change. Kind of like the bottom part of Aviate launcher.
Like this:
So basically, I would like to have a grid layout, that the user can resize each part of the grid, each grid have a 3 apps inside, and the user can redefine those apps.
So how can I do something like that?
Thanks in advance if you understand the question.
I could not understand clearly. But, if you are looking for Gridlayout, try http://developer.android.com/training/displaying-bitmaps/index.html
Or, if you want to make a widget try open source project like https://github.com/twotoasters/HorizontalImageScroller-Android

Categories

Resources