Hi there, I'm in the middle of building an app with the same navigation structure as this app which involves a list of items which when clicked displays details pertaining to that item in another layout.
So I wanted to ask a few questions:
1) Which is better?
a) To use fragments, one for the listView and another one to display the details.
b) To use 2 separate activities for each layout and to pass data using intents to handle selection.
2) What is a better way to store data in this case? JSON or SQLite? Can you please briefly explain why?
Thanks for your time.
K12 said:
Hi there, I'm in the middle of building an app with the same navigation structure as this app which involves a list of items which when clicked displays details pertaining to that item in another layout.
So I wanted to ask a few questions:
1) Which is better?
a) To use fragments, one for the listView and another one to display the details.
b) To use 2 separate activities for each layout and to pass data using intents to handle selection.
2) What is a better way to store data in this case? JSON or SQLite? Can you please briefly explain why?
Thanks for your time.
Click to expand...
Click to collapse
1) A: Fragments as its easier to create large screen (tablet/phablet) layouts for fragments as you can have them side-by-side
2) SQLite - fast, easy to store and get data from, easy to code for, compact.
Jonny said:
1) A: Fragments as its easier to create large screen (tablet/phablet) layouts for fragments as you can have them side-by-side
2) SQLite - fast, easy to store and get data from, easy to code for, compact.
Click to expand...
Click to collapse
Regarding 2),
If I want to make the app accessible to people of different languages, which would be a better approach?
a) To create separate databases for different languages.
b) To create one database with the relevant tables for different languages.
K12 said:
Regarding 2),
If I want to make the app accessible to people of different languages, which would be a better approach?
a) To create separate databases for different languages.
b) To create one database with the relevant tables for different languages.
Click to expand...
Click to collapse
I would go for having one database and relevant tables for the different languages.
Related
hi,
I have a program and it has lots of settings saved in memory, when I exis the program I need to save settings in a config file.
My program has CString(s), CArray(s) and other basic int and DWORD varibles, so how can I save such complex settings?
Mohammad
as xml maybe
If you're using MFC you could always attach a CArchive to a file and serialize
Perhaps you need to either create a log file - for debugging purposes or save your settings to the registry. If its the former then, check this one http://www.codeproject.com/ce/GenericLogFunctionality.asp it should be helpful. If its the latter, then you just search codeproject and you'll find lot of tutorials on the registry. Also, you can use CEDB which is a flat table data base that can store many data type structures including files and images, use it if you need to.
It may seem like you're lost now, but you can take an overview about the cons and pros of each technique so as to choose the best one for you.
For my config file I use plain english bounded by my own tags. I use a character sequence as a seperator for lists. I convert numerical values into text that can be human readable. There are some benefits to being able to read and edit it manually if the need arizes. I also made a class purely for writing and reading from my config file. Now when I to use a config file I can just drop that class into my project.
XML sounds good and similar but it would require a greater knowledge of xml.
Registry is easier and faster to do/execute but for data that can potentially grow too much it is probably best to keep it out of registry.
Is CArray serializable? do we just simply use CArray::Serialize and it will dump all included objects into a file?
thanks
http://msdn2.microsoft.com/en-gb/default.aspx
this site may be helpfull while you wait for somebody to answer your question
If you can it would be easier to use CObArray and ensure that the array members are subclassed from CObject with the DECLARE_SERIAL / IMPLEMENT_SERIAL macros. You could also add a new << operator to the CArchive class and write the serialization routine but that would kinda defeat the object I guess.
I solved the issue using serialization, for CArray structures I used the following method:
File<<MyArray.GetSize();//store how many objects
for(all my objects in the CArray)
serialize them one by one
I did the same when loading and it works flawlessly.
Thanks all for your help
In learning about plugins I'm struck by what seems like a real flaw in the model... the physical layout is abstracted, but the data collection isn't.
People are putting a lot of work into coding the same apps over and over. I suspect much of this is due to a desire for a different panel look. I'm suggesting that developers start separating the application development from the plugin design.
For example there are a number of weather panels. Each developer had to work out refreshing the data, html scrapping/xml parsing, and storing the data to form pages of their own design before being displayed by a layout that is locked to the program code. Now if I want to change a font or graphic size I can simply mod my .cpr file and I'm set.
But what if I want fewer pages, or different pages, or heaven forbid, what if I want the same panel to display weather info with something else... I need to start from scratch and develop a whole new weather+ app and do all that work again.
If we could come up with a "standard" format to describe mapping a piece of information to a panel\page\attribute with an optional formating string, then the plugin programs could do their own thing and gather data and the designers could use that data to form whatever panels they wanted.
Personally, I'm partial to xml...
Code:
<DataMappings>
<DataMapping source="TitaniumWeatherCurrentTemp" panel="MyWeatherPlusPanel" page="CondensedPage" format="{0} degrees" />
<DataMapping source="MoonPhaseCurrentPhaseIcon" panel="MyWeatherPlusPanel" page="CondensedPage" />
<DataMapping source="TitaniumWeatherCurrentTemp" panel="MyWeatherPlusPanel" page="Page1" format="{0} degrees" />
...
</DataMappings>
This example shows how data from two different apps could be mapped to a single panel and a data element could be mapped to several pages. Of course we'd be able to map data to multiple panes.
The most efficient way to handle this would probably be to have the original applications subscribe to the new model and implement the mapping. But since a number of apps already exist and because some app developers wouldn't subscribe to the idea, maybe this should be a standalone app that polls for changes in the existing registry keys and do the mapping. The problem here is the overhead of the polling technique.
Any thoughts?
Hi guys,
I'm working for Avocarrot and we are developing a new app monetization product to embed mobile ads inside content streams (more details at: avocarrot.com/docs/#/android/instream).
If you are working with lists for your apps, we have a few questions we'd like to ask:
1) Do you use usually use ListView, ExpandableListView or both?
2) Do you use usually create your own adapter by extending and overriding the BaseAdapter, ArrayAdapter, CursorAdapter?
3) Would you prefer fully customizing appearance of the ads using your own XML or drag-and-drop templates that are quick to integrate?
Any brief answers will be appreciated!
Thanks,
George
I'm going to fetch the questions and answers from my web server using JSON, this data are dynamic, sometimes a question has two or three answers, question type can be any combination of the following: multiple choice, true or false, identification, fill in the blanks etc.
The answer on how to do a dynamic layout on android is to let java takeover on adding layout and components instead of XML. (is this correct?)
How can I make my app to have one activity/view per question? Is this memory intensive? For example the data from the web server contains a hundred questions.
I want the user to have access to previous questions. For example I'm currently on question number 21 and I want to go back to question number 11 for some reasons, is this possible? How can I do this? (All questions are randomized)
clonedaccnt said:
I'm going to fetch the questions and answers from my web server using JSON, this data are dynamic, sometimes a question has two or three answers, question type can be any combination of the following: multiple choice, true or false, identification, fill in the blanks etc.
The answer on how to do a dynamic layout on android is to let java takeover on adding layout and components instead of XML. (is this correct?)
How can I make my app to have one activity/view per question? Is this memory intensive? For example the data from the web server contains a hundred questions.
I want the user to have access to previous questions. For example I'm currently on question number 21 and I want to go back to question number 11 for some reasons, is this possible? How can I do this? (All questions are randomized)
Click to expand...
Click to collapse
For your view, you'd make one Layout containing multiple TextViews whose texts you set only in your java code, that way it can have different questions.
Then there is a ListView for scrolling between the questions or for instance a ViewPager.
Remember to start with small components like the question screen and worry about getting the questions from the server and stuff later
Is there anybody else wants to share their insights on this?
clonedaccnt said:
Is there anybody else wants to share their insights on this?
Click to expand...
Click to collapse
Even though it may not seem like it, this is a very simple app...and it comes down to "simple" understanding of "listview,adapters,intents,asyncTasks,JSON/GSON" and then quite a simple design flow.... if you start to learn this most of what you need you will know and what you don't you will be able to ask direct questions about (cause you will have knowledge to do so)
I am going to develop an android examination but I can't decide what kind of layout to use, the app will contain different type of questions(randomized), identification, multiple choice, matching, and true-false. Different examination types are commonly organized by category on a paper-based examination. The exam must also have a timer which is available on every view of the app. I want to give the user the functionality to get back on the questions that he/she skipped. How I am going to send the data back to the web server after.
Thank you and God bless!
Guys, I really need some help here.
Relative Layout is a good one always
clonedaccnt said:
I am going to develop an android examination but I can't decide what kind of layout to use, the app will contain different type of questions(randomized), identification, multiple choice, matching, and true-false. Different examination types are commonly organized by category on a paper-based examination. The exam must also have a timer which is available on every view of the app. I want to give the user the functionality to get back on the questions that he/she skipped. How I am going to send the data back to the web server after.
Thank you and God bless!
Click to expand...
Click to collapse
I would go with a RelativeLayout and then for the multiple choice a LinearLayout and maybe a FrameLayout for the going back and forth between questions and what not. Honestly , I would wait to send the info to the web server till the exam is done. So I would set up a timer lets say 30 seconds per question and if they don't answer it in time it automatically moves on and lets say at the end you were able to answer other questions faster and the total time isn't equal too 10 mins then the spare time they have can be used on questions they weren't able to answer in time and once that is done i would submit it to the server this way they don't use battery like crazy.
Relative Layout.
clonedaccnt said:
I am going to develop an android examination but I can't decide what kind of layout to use, the app will contain different type of questions(randomized), identification, multiple choice, matching, and true-false. Different examination types are commonly organized by category on a paper-based examination. The exam must also have a timer which is available on every view of the app. I want to give the user the functionality to get back on the questions that he/she skipped. How I am going to send the data back to the web server after.
Thank you and God bless!
Click to expand...
Click to collapse
A list of questions is perfectly suited for a linear layout (vertical). Inside the linear layout you could use a second linear layout (horizonal) to separate different parts of your question that should go next to each other.
This typically gives you the cleanest view.
Parts that do not fit a linear layout can be put in a relative layout. In most applications you will end up with several nested lay-outs.
Finally, are you designing for phone or tablet? For the latter, you may consider using frames, where you have the questions in one frame and other information (buttons, options, settings, login) in another. This creates a much nicer and cleaner overall application (otherwise your screen is filled with the questions only, which is a waste of good screen space).
Check the layout section on the google developer website (via training). I think this is useful for you.