Hello,
I Have made an application to localize pharmacy officines but with taking infos from an extrnal XML information feed
and now i want to integer only internal DB that i have made with SQLite
I have found a problem integrating it
For information :
The Used API is 7 and 19
The Screen Size is about 4''
And i wanna to integrate Geocoder (It seems to not work in Algeria)
The App is made in French languge
Thanks For Help
I have attached DB and apk
do you want to take data from external xml and store it in inapp DB ?
Sent from my GT-S5302 using Tapatalk 2
sak-venom1997 said:
do you want to take data from external xml and store it in inapp DB ?
Sent from my GT-S5302 using Tapatalk 2
Click to expand...
Click to collapse
I want to integer the DB into the app and delete the xml source
Related
Hi,
What's the best approach to load a listview contents from a backend-server (internet)? I mean, I want to populate on-the-go a listview that will retrieve data from a internet server. For example, I want to know all orders from my e-commerce from my app, and I have like 5000 orders in the last week, I won't load this 5000 orders because my app will have a great load time and memory consumation.
My idea is load more when user get close to the last element of list, but I don't know how to do this, and about memory consumation? Is better to continue with the data in memory (when user goes back to upper), or save it on a file-cache (better than memory?) and load when user scroll back to the top?
Thanks,
While the user is the activity you must hold each of the list item in memory anything other than that will cause serious lag in your app
While at other times you may cache them to save resources
Sent from my GT-S5302 using Tapatalk 2
You definetely need ASyncTask here. You can define a class as asynctask, which lets you implement a few methods to use as a background thread. So whenever you wan to load more items you can call this background thread which does not block the UI.
Also, if I remember correctly, you can implement a method which lets you know which list item is at the top of the screen, the total number of items in the listview, and the number of items on the screen.So with this method you can find out whrn you reached the last item in the listview.
I hope this helped a little, at least you got some stuff to google
Sent from my NexusHD2 using xda app-developers app
Ya as he said use a global variable and update it in getView if adapter hence ull know the last loaded view
Sent from my GT-S5302 using Tapatalk 2
i'm writing a questionnaire/survey type app and i need some help with the conceptual design.
i want my app to display 10 random questions selected from about 50 questions. Now I have a class:
public class Question {
public String questionText;
public string answerOptions;
}
What I am confused about is how do I get the 10 questions from the 50 questions?
1)Should the 50 questions be in a SQL database which I "grab" data from and populate my survey as required? In this case how do I a bundle the database with the apk?
2) Initialise 50 Question Objects in the MainActivity and just use them as variables?
I would save them in a normal text file.
Add the 50 questions to an ArrayList. Create a new Array of int with the size of 10 objects.
Add 10 random numbers to it (in the range of 0 - 49, Java: 50 * Math.round()) and before adding one, check whether it is already in the Array. If it is, get another number.
Then get your 10 questions from the list.
I would go for shared preferences rathet it ll save the time
And to be more presice i would suggest using javq.util.Random and call the nextRandom(50) method but remember to check if you havent alread recieved the number
Rest you can follow the above method
Sent from my GT-S5302 using Tapatalk 2
sak-venom1997 said:
I would go for shared preferences rathet it ll save the time
And to be more presice i would suggest using javq.util.Random and call the nextRandom(50) method but remember to check if you havent alread recieved the number
Rest you can follow the above method
Sent from my GT-S5302 using Tapatalk 2
Click to expand...
Click to collapse
Well, if I got him right, he wants to save them and include them into the apk. He asked how to do that. So there is no need for SharedPreferences.
Maybe your method for the random number is better. To be honest, I have never used that method.
nikwen said:
Well, if I got him right, he wants to save them and include them into the apk. He asked how to do that. So there is no need for SharedPreferences.
Maybe your method for the random number is better. To be honest, I have never used that method.
Click to expand...
Click to collapse
I did mean your method.was wrong or something i was just telling an easier method to implement your method in code
Sent from my GT-S5302 using Tapatalk 2
nikwen said:
I would save them in a normal text file.
Add the 50 questions to an ArrayList. Create a new Array of int with the size of 10 objects.
Add 10 random numbers to it (in the range of 0 - 49, Java: 50 * Math.round()) and before adding one, check whether it is already in the Array. If it is, get another number.
Then get your 10 questions from the list.
Click to expand...
Click to collapse
Even though it is only 50 questions now, that would over time be increased to <1000 questions. For what number will a text file be deemed "inefficient" or difficult to work with?
prtbrown said:
Even though it is only 50 questions now, that would over time be increased to <1000 questions. For what number will a text file be deemed "inefficient" or difficult to work with?
Click to expand...
Click to collapse
It would entirely depend on file size and targeted device for instance a device like mine with.300mb ram and 832Mhz proc would crawl to process a 5 mb file while a nexus 4 will do it like a breeze
I would suggest deviding the questions in sets like quesSet1 ,quesSet2 etc
Sent from my GT-S5302 using Tapatalk 2
Hi
I want to create a picture based password system, wherein the user clicks on certain positions in an image, and then that is verified..
Can anyone help me out..how to store these pixel locations. Since the size is small, i want to store them in an array using SharedPreferences and then extract it from there to verify it,
I tried saving it but when i access the file..i only get the last pixel stored. I need access to 5 pixels positions that were clicked on.
There is actually an app that was featured before that is exactly what your looking for....... I just can't remember
Sent from my Nexus 4 using xda app-developers app
Shria said:
Hi
I want to create a picture based password system, wherein the user clicks on certain positions in an image, and then that is verified..
Can anyone help me out..how to store these pixel locations. Since the size is small, i want to store them in an array using SharedPreferences and then extract it from there to verify it,
I tried saving it but when i access the file..i only get the last pixel stored. I need access to 5 pixels positions that were clicked on.
Click to expand...
Click to collapse
You can hide a small button(transparent) behind the picture. Then it would be very simple.
Bro this might get you in trouble Picture Password is a patented tech. from
Microsoft © Windows ® 8
and you definetly dont wanna get sued by a corporate gaint
Sent from my GT-S5302 using Tapatalk 2
How is your layout setup? And what are you using to get the coordinates? Some code would help.
Sent from a Toasted Devil
You could add an onTouchListener: http://stackoverflow.com/questions/4207067/how-to-implement-touch-listener-on-image
So i used an SQLite database and im done with it!
thank you for ur replies.
How do you determine what to "cast" in the code of an Android app? Fixing errors and I'm sort of new to coding Android. For example I get an error at .release and it tells me to add cast to mprinter. What do I cast?
add cast to android code
How do you determine what to "cast" in the code of an Android app? Fixing errors and I'm sort of new to coding Android. For example I get an error at .release and it tells me to add cast to mprinter. What do I cast?
yasra said:
How do you determine what to "cast" in the code of an Android app? Fixing errors and I'm sort of new to coding Android. For example I get an error at .release and it tells me to add cast to mprinter. What do I cast?
Click to expand...
Click to collapse
Dude thats raw java
No offence but you should consider learning java first
Sent from my GT-S5302 using Tapatalk 2
To answer at your very bottom line, Casting (Also known as type conversion) is needed when your data type of the LH side variable isn't the same to that of the RH side.But you cannot use cast everywhere.To better understand this, Start learning java.
add cast
this code is given by my senior and according to him code is working and I need to update the code but first i have to run and understand it properly i.e i have to resolve the issue before updating and understanding.
Well, If you dont know java, or you dont have any past programming experience. Ill try to make this as simple as i can.
A cast is basically, how you convert. For example if you want to convert decimal no. to a simple integer. You should add a cast.
Like:
Code:
float a; // a decimal number.
int b; //an integer
b = (int) a; // converted to decimal..
However, casting is not possible for every conversion. For eg:
You cannot convert a graphics object to an integer.
Hope it helps
Sent from my GT-S6102 using xda app-developers app
Casting is always upward compatible. Eg: int to long for primitive data types.
Secondly you should know the object type to be converted eg from object arraylist etc can contain objects which can be of varied data types.
just like you retrieve db result set from dataype and convert result set to column datatype and store.
Sent from my GT-S5360 using xda app-developers app
Sent from my Q800 using xda app-developers app
When possible, prefer json responses, uses less data transfer than xml and making data processing even faster... that's my personal preference, maybe another developer thinks otherwise...
Sent from my LG-P350 using xda app-developers app
dbarrera said:
When possible, prefer json responses, uses less data transfer than xml and making data processing even faster... that's my personal preference, maybe another developer thinks otherwise...
Sent from my LG-P350 using xda app-developers app
Click to expand...
Click to collapse
Very easy with Google's gson library.
XML might make sense for more complex data structures. But it is difficult to be general here. It's not possible to create precise rules when to prefer XML to others.
I'm currently working on a project which relies heavily on XML parsing, notably to generate UI components.
The XmlPullParser API is really powerful and rather easy to implement.
I'd definitely recommend using JSON if you're parsing from a backend server or even for any online parsing needs, but XML parsing can be useful for creating plugin systems/DSLs, and similar offline use cases.
XML parsing is often used in game apps for multiple levels. It can be used to store coordinates or other information for sprites that will be loaded into a certain level. For parsing large-scale data, XML is a lot faster than JSON in the Android emulator.
Advantages of JSON:
Smaller
Faster
More structural
Easy distinguish between the number 1 and the string "1", strings and booleans.
Easier to represent a null value
Advantages of XML:
Standard ways of expressing the structure of the document: XML schema, DTD, etc
Parsing standards: DOM, SAX, StAX