Retrieve data from MySQL database by using Android QR Scanner - java

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.

Related

Insert into Firebase Database in Java

Is it possible to insert data into firebase Database using Java? I have created an app and want to save its data inside my firebase account.
If yes, how do I achieve this?
I read that using the SDK for android can also be used in the Java application, but I want to confirm.
I am planning to use a JS file to send data to Firebase and just call it inside the Java Application, with the Data to be sent as arguments. Still have to test this, but I'm also looking for an easier alternative.
Thank you!
Yes.
Read the docs: https://firebase.google.com/docs/admin/setup
There is the example from the Google itself: https://github.com/firebase/quickstart-java/tree/master/database

Storing currency exchange data for android app

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

How to use my own sqlite database and search through it in android?

I'm a beginner in Android development. I'm trying to make an app where you search for name and show the matching results (from a database) in a listview. Since there's a lot of data, I thought it would be best to write a database without using the SQLiteOpenHandler. So now that I have my .db file, I need a way to be able to use it in my app from the assets folder and also to be able to search through it.
I found to links which I thought could be useful.
http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/
This shows how to use an existing database.
http://developer.android.com/training/search/search.html
And this is Google's information on storing and searching data. I need to know is it possible to somehow combine these two methods together to achieve what I'm looking for?
You can use this extended SQLiteOpenHelper. It helps to copy the db file from assets folder in your application.

Java BlackBerry - How to call a php script properly with GET method?

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.

How to create a desktop application to mimic what I've already written in PHP?

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.

Categories