Hey guys what's up? I'm making a very simple game for BlackBerry Curve 8520, and i need to get the ranking from the server. In order to get this data, the web programmers gave me php files that gets the data from the database and returns it as a dynamic xml file.
My question is:
How can i load that php file using java code? how can i pass a get parameter to that request?
how can i parse the xml retrieved from the php script?
Thanks in advance!
Francisco
You really have two problems here, and I think you should attempt to address them separately.
Problem 1 is getting the data from the Server
Problem 2 is parsing the data you get from the Server.
Both these problems have been covered extensively on this and other forums previously, so I suggest that you search here and elsewhere. Here are a few links from SO:
blackberry HttpConnection.GET
Parse XML file on BlackBerry
In addition, I recommend you review the documentation provided on the official BB site:
http://developer.blackberry.com/bbos/java/
including the following:
http://developer.blackberry.com/bbos/java/documentation/intro_networking_1984362_11.html
As you will see, the BB offers a number of methods of doing communication, in your case I would recommend the ConnectionFactory API:
http://developer.blackberry.com/bbos/java/documentation/network_api_1984363_11.html
And here is something on parsing XML:
http://supportforums.blackberry.com/t5/Java-Development/Use-the-XML-Parser/ta-p/445210
This should be enough to get you going. Please come back with specific questions if you have issues with any of this.
Related
How can I retrieve just the intro text (those few lines at the beginning of each article), using java?
I've seen a question like this here, the problem is that the code was in PHP and I need it in java so I can implement it to my android app...
I've tried to search all GitHub for some easy libraries that could help me get what I want and I got no success.
I've also seen that this link: https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exintro=&explaintext=&titles=Stack%20Overflow shows information about whatever I want to search. I just can't retrieve the data because, as I said, in that question, the code posted was in PHP
check this https://www.mediawiki.org/api/rest_v1/#!/Page_content/get_page_summary_title
Api for accessing content is here , rest you can normally parse the data.
hope this helps.
I'm hoping this will be a fairly basic question. I've been playing around with android development in the last couple days and I'm still missing some of the simple things.
I'm working on an app which needs to convert between currencies. I know that I can get recent data with queries like this.
I want to be able to save this information and allow it to be updated on request. I feel like the natural way to do this would be using an android resource file. It would be ideal if someone could (as explicitly as possible) explain how I could make the query, save it to a resource file, and then read the conversion rates from the resource file in the future.
I understand I could just make the request live each time the data is needed but I'd prefer to have something saved (so the rates can be used offline).
Thanks in advance all.
UPDATE:
Though Vulovic's answer is correct, and I intend to use this approach in the future. For now I have found it is simple to implement the SharedPreference class to store Currency:Rate data.
Ok, you need to create SQLite database. Here is a good tutorial: http://www.tutorialspoint.com/android/android_sqlite_database.htm
This is my first post in Stackoverflow. I'm a beginner in android and currently developing an app that uses a QR Scanner. The process is as below.
There're several objects with QR codes attached
App scans one QR code
Get the data retrieved related to that specific object (ex: name of the object, description of the object, images) from a remote MySQL database
Show the data in the app
So this is the simple process of the app. I do not know any technologies that I can use to achieve this since I'm a beginner. I would be obliged if someone could explain how I can do this.
Edit : This is different from directly calling data from MySQL database since it involves a QR code scanning part also. I can get the data from MySQL database and show it in android. But the complex part is how to get data automatically shown in the app after scanning the QR code. I have integrated Zxing QR Scanner.
Thank you.
According to your description, there are 2 main tasks you have to accomplish:
Scan QR code.
Retrieve info from a web service (which is backed by MySQL).
For (i), you would use popular QR Scanner libraries such as ZXing and ZBar. Using such libraries would require you to write some extra custom classes, just follow their instruction.
For (ii), you would use a networking library such as Retrofit, Volley, ... to get data from the web service.
Have you done any own research before asking here?
Nevertheless you can achieve your solution by trying out these steps:
1.) You need an API to scan your QR Code. By searching via Google i instantly found this page: http://code.tutsplus.com/tutorials/android-sdk-create-a-barcode-reader--mobile-17162 Here you can implement a barcode reader (but it also is able to read QC Codes as I understand)
2.) You need to find out which content the QR codes includes (e.g. an unique ID or something like that so you can identify your article)
3.) You need a database (e.g. you could use Apache Tomcat which includes a mySql database) where these IDs are stored.
4.) Your android app has to communicate with the server/database with e.g. webservices (you can google it, you will find some ways to implement webservices)
Still I can't you price "the" solution. You have to use google, read different tutorials and find out how you can solve your problem. If you are expecting difficulties you can still ask here.
I hope I still could help you a little.
My question is similar to this one, though more involved.
I need to take the xml data from this link
http://eve-central.com/api/marketstat?usesystem=30000142&typeid=34&typeid=35&typeid=36&typeid=37&typeid=38&typeid=39&typeid=40&typeid=11399
and extract the sell/min and buy/max, average them, and then do math with the results.
I would like to also store the xml data so that requests on the servers do not need to be made often.
I have a spreadsheet that does what I want, I just need to emulate that in an android app.
Thanks for pointing out to the other question at stackoverflow.
My first answer is to use the same answer than on that thread, in this case employing SAXParser for Android and see what you get.
Kind regards,
just looking for a point in the correct direction..
So I've developed a little application on the back end of our websites that allows the girls in our office to send out letter-headed PDF quotations to our potential clients via email.
I've done this using a simple HTML form, the FPDF class, and the php function mail()
It works a treat, but I'd like to take it a step further and create a desktop application so that the girls don't have to go through the login section of the website to access this functionality.
I'm thinking Java?
Would this be a difficult mission someone who has only had web-developing experience?
It would only be the smallest/simplest of applications.
Thanks for any input :)
This is just an advice.
Since you have already developed something that works over web, reuse it.
Convert the PDF converter into a service to upload and retrieve file. This service should return a token_id that can be used later to download the converted files.
Write a Java app using Swing that merely uses this web service. The logic in this application should be (a) browse file from computer, (b) Use web-service upload URL to upload the file and rec/eive appropriate response like upload_token_id and status uploaded/converted/failed, (c) the Java app, should be able to use this token to download the converted file.
You may need to look into this for help related to uploading the file
No it wouldn't be difficult job to mimic your app to java desktop app that can be Java Swing APP. you just need some practice on swing. As you are doing in php that is creating PDF and mailing it. This task can easily be done in java swing by using Java Mail API for emailing and IText for pdf generation.
For reference you can read following links:
http://www.javabeginner.com/java-swing/java-swing-tutorial
http://zetcode.com/tutorials/javaswingtutorial/
http://www.apl.jhu.edu/~hall/java/Swing-Tutorial/
http://www.oracle.com/technetwork/java/javamail/index.html
http://java.sun.com/products/javamail/javadocs/index.html
http://www.javacommerce.com/displaypage.jsp?name=javamail.sql&id=18274
http://viralpatel.net/blogs/2009/04/generate-pdf-file-in-java-using-itext-jar.html
Hope this helps.