I'm just setting out in android development. I want to make a kind of card based game. I'm just looking for suggestions really on how I might start it.
I know I have to make the menu layout and view, then use an Intent from that to get to the main game view. My sticking points are:
There's going to be a deck of cards. It's going to be a set number so I was thinking I could just have each card defined as a button in the layout. I don't know if that is the right way to do it though.
Storage of card details. I'm thinking of using an xml file to store these.
You could try to check out this project:
http://code.google.com/p/bestcardgameever-android/
And a post of the author about this (there is a second post in the same blog):
http://developreality.blogspot.com/2009/05/overcoming-absolutelayout-deprecation.html
Related
I am new to Android Studio. While working on front end its sometimes easy to take some parts as png file and place it on the particular position instead of recreating it in xml file. I am confused can we use png all the time ? I am worried about memory space . Like the app contains 50 pages and in each page I use 1-2 assets . I don't want my app to have more than 40mb. What will be the best way to do? Can we store the image as a URL and retrieve it whenever we use. What's the drawback in that way?
So many questions :)
I am confused can we use png all the time ?
Use what's best for your picture. For a photo, a JPEG will probably do better. But if you wish, you can use PNG all the time, yes.
I don't want my app to have more than 40mb.
Check and see. Depends on how big your images are; we can't tell.
What will be the best way to do?
Not enough information to tell you that. In general, there's nothing wrong with using images in assets.
Can we store the image as a URL and retrieve it whenever we use.
Yes.
What's the drawback in that way?
You'll need to get some server space somewhere. Also, there will be a loading latency. Also, your app won't be usable while disconnected from the Internet.
While working on front end its sometimes easy to take some parts as png file and place it on the particular position instead of recreating it in xml file.
That's the part that is confusing to me. Android XML layouts usually contain interactive elements, ones that the user can interact with. Images, on the other hand, tend to be static. What kind of XML is there out there that you think you can replace by an image?
I am new to Android (but proficient in programming) and I have been reading the Google documentation.
I am trying to build a small app, just to get familiar with Android (not a very fancy app, just for learning app dev).
The app would have an initial activity containing a list of items, and the user can view them (through another activity), edit them (again another activity) or create new ones (again another activity). My concern is how to store this list of items in the phone.
I do not intend (at the moment) for the app to be synced with any external service, so I am happy to store all the data in a file. Typically I would be looking at 200 items of small size, so a text file (maybe XML or JSON) would be enough I think (SQL would probably be overkill here).
My question is: if I have an XML file with all the items, do I need to parse it and load it in memory for every activity?
For example:
the user enters the app to see the list of items -> must load the XML
the user wants to add a new item-> I need to load the XML again to be able to add an XML child
Is this the most natural way of doing this in Android? having to load the same resource over and over in each activity?
Thanks
If you want to reuse files you may use adapter. You can either create custom adapter or use default one. Besides that you may know programming concepts such as Design Patterns. My point is to reuse in android can be done programmatically.
In your for storing data would be better to use SharedPreferences here tutorial to understand idea about it
If you don't want to use SQL to store your data, you can try SharedPreference.
And yes, you have to load all values in everytime you read or write. But don't worry, it won't be hard for mobile phone hardware.
This is an easy question, but I don't know how to word it to get a result from Google.
I am currently building an app in Android. One of the features of the app includes inputting a large amount of personal data (i.e. emergency contact information, social security number, and others). The file will include around 40 fields, but I don't want the user to have to scroll through one layout to fill all this information out. Thus, how do I create new "forms" to populate without having to create a new activity and xml layout for each set of data?
Any help is appreciated. Thank you for your help.
Thus, how do I create new "forms" to populate without having to create a new activity and xml layout for each set of data?
You are welcome to create a new fragment and XML layout for each set of data, if you prefer.
At the end of the day, your code is largely the same in all cases:
You need all 40 fields in an XML layout file somewhere. Whether this is one file, two files, or ten files, is up to you.
You need to your controller logic for handling that input from those 40 fields somewhere. Whether that is in one activity, N activities, or N fragments, is up to you.
If you are expecting Android tools to be able to magically generate all this for you, just by you thinking really hard and staring at your monitor, Google's Project Synapse has not yet been released yet. :-)
Does Facebook's Android App uses ListView or is there another way to create that nice list of posts in a timeline?
Also it's currently very fast and when u scroll very fast up and down it doesn't display any sign of reloading images or graphics unlike the normal ListView when you're using dynamic image loader and caching.
It could be multiple LinearLayouts inside a ScrollView. The feed is of different types and can have different layouts, the layouts can be dynamically pushed onto a scrollview.
As far as the scrolling and performance is concerned, i think the feed is prefetched. thats a good practice if you do not want the user to reach the end of the listview for it to load more data.
Well I dont know answer but i can provide you a cheat code for this.
Download Facebook app apk file and after that decompile it
Change the extension of facebookapp.apk to facebookapp.zip, click Yes to any dialog appears. By this you can view manifest and xml layout files but code is still inaccessible.
Than their you found a classes.dex file, that use dex2jar to convert classes.dex files to classes.jar.
Use Java Decompiler (jd-gui) or eclipse to view those class files.
You can do this to any app,
By this you may not get the accurate code but get the basic idea how app works.
For any problem refer to google also for tools need you can find easily by google.
I am working on an app and I basically want to implement some type of function like the note apps do. Basically I have a listview set up that has a link to different xml files. I want the user to have a create new option where they can add some text to an edit text and be able to save the text and add it to the listview I have set up.
My question is how do apps like the Note Pads and Memos ect. do this. Do I need to set up some type of database or?
I have googled it quickly and did a quick search on stack but I don't know if I'm even searching for the right thing. I am just looking for a step in the right direction please!
Thanks!
They all save their data in a database. For android you should use an SQLite database because it is included in the SDK. There are a lot of great tutorials for SQLite out there, but I think that this is the best one
http://www.vogella.com/articles/AndroidSQLite/article.html
It is possible to do this using SharedPrefernces, but I would not recommend it, for efficiency and simplicity