Best method to implement many layout(XML) in an Android app [closed] - android

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I am very new to Android development and I'm trying to create a calculator with different layouts for different kinds of mathematical problem solving.
So if I add around 100 formulas starting different activities isn't an option I guess. So what will be the best method to implement this idea?
Currently I plan to make different XML layouts(100 for 100 formulas) and use LayoutInflater all in one single activity. What do you guys recommend?

You can use a Fragment. One single activity with one single fragment. Each time you switch to a different formula, simply change the layout used in the fragment and show it. An approach (maybe not the best one) is use replace and in onCreateView method choose the layout you want to use.

Related

Can I use the same RecyclerView adapter for two different activities for two different data classes? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have created a RecyclerView. I want to add another RecyclerView to another activity in my app which displays different layout and different data (uses different data class). can I do it with same adapter that I created? if yes, then please tell how? if by getItemViewType() then how to differentiate between two activities to set the respective view holder and how to add two data classes? please help. I am working in Kotlin, please give a kotlin example.
I would suggest you not to do so. From the maintance perspective, it would just make you code harder to understand and update later. Even if that means you need more code.
If you really want to do so, you could provide additional parameter to the adapter class - a Boolean for example, that will tell you which activity are you in right now and for which data it has to be prepared.
And having that, you can just add an if condition in every place you need sth different depending on a data class youre using. And thats it.

Who is a good practice to build an Application? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I'm recently started programming in Android Studio with Java, i don't have enough Knowledge in Building Mobile Applications.
So, my question is, if making a Class of methods for the logic of the application or make the methods in Activity Label.
Or if anyone experienced can give me a good advice.
If I understand your question correctly, it depends on where do you plan to use your methods. Are they limited to just one activity? Or will you be using those methods across several activities? If just for one activity then no need for another class to put those methods in as you will be using them in only one! On the other hand, if you plan to use the same method in several classes then putting those common methods in a single class is better

Android App that has an element which is sticked to bottom on every page [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
i want to create an android app that has a music play at the bottom of the app. We gonna switch between activites but i want that music player to keep playing. How should i achieve this
So you want a particular view at every activity/fragment? Create a separate layout with your desired view and include it in xml file of activities/fragments.
example :
<include layout="#layout/your_layout"></include>
You can use fragment instead of many activities or use Viewpager. If you are not friends with those you can also create base activity with music player and extend other activities from it. But best way to do such thing is using fragments and Viewpager makes it even more easier.
Read this article to get familiar with fragment

What to make first while making android apps? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'm a beginner in android. I learn the basic concepts one at a time. But now i'm trying to make a slightly large project. How should i approach this? Should I make all the activities first or should i make activities along with code? Or should i just continue on with the anything i like?
The first thing you would need to think of is what exactly your app does.Once you have that in mind the next thing your're going to want to do is think of an interface for the app which usually leads to deciding what information needs to be shown when and on which screen.Once you know what needs to be where you can start the actual coding,i suggest 1 activity at a time.
If you want a large project i suggest a to-do app.

How can access to the objects of a Layout XML from a Java class in Android [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
That's my question, I want design all the interface of my application within an XML layout but I want to handle all the onTouch events, move ImageViews, etc, from a Java Class, this is possible?
LayoutInflaters let you convert XML layouts to the corresponding View objects in Android.
Yoni is correct, but I'd add one thing.
Don't ever change the XML files on the device. They're compiled into binary files so any changes you make to them won't actually impact the UI. All changes you make to the inflated objects will, however, have the expected results.

Categories

Resources