tkd_aj
tkd_aj

Reputation: 1063

Android Design Decision: one layout for multiple activities?

I am new to Android programming, and I need some advice. I want to create an app that teaches children the alphabet and numbers. I want each letter to have their own screen which you can scroll to and from other letters, but each screen will be similar in that it will have the current letter, pictures of objects that start with that letter, and sounds corresponding with the letter and the objects in the background. Should I make one XML layout for these and somehow changed what letter and objects show up in on the layout using Java, make an XML layout per letter, or is there a way to create a base layout in Java and have all of the letters and numbers inherit these qualities and methods. If that is the case, would that require a Java class per letter as well? I am sorry if these seem like stupid questions, but most of my education in Android has come from internet video tutorials. I appreciate any and all help. Thank you for your help in advance!

Upvotes: 0

Views: 114

Answers (2)

codeMagic
codeMagic

Reputation: 44571

v> I want each letter to have their own screen which you can scroll to and from other letters, but each screen will be similar

You probably want to check out ViewPager and Fragments for this.

This website usually seems to have pretty good tutorials. The docs and SO usually have good examples of getting started also.

Note These both require API >= 11 or using a compatibility package which you can find a tutorial Here. so that may be something to take into consideration. If that is an issue then you could simply have one layout with TextView, ImageView, etc... which retrieves its data from a DB and load them when a certain event happens such as a click.

Upvotes: 1

Luis Lavieri
Luis Lavieri

Reputation: 4109

Well, if you want a screen for each of the letters that you could swipe to, but each letter is going to have its own set of properties, I recommend you start looking for a ViewPager with custom Fragments. I think that is a good start. Then, you could focus on some other fancy features like sound.

Upvotes: 0

Related Questions