简体   繁体   English

我将名称存储在mysql中,如何在android应用中显示该信息

[英]I have names stored in mysql how do I display that information in my android app

I have names stored in my mysql database i created a table called users and when you login into my android app you can input data into that table. 我在我的mysql数据库中存储了名称,我创建了一个名为users的表,当您登录到我的android应用程序时,可以将数据输入该表中。 How do I display the names of the database entries added in a android application. 如何显示添加在android应用程序中的数据库条目的名称。 I want when I click on search users it to bring up the names added in the database. 我想在单击搜索用户时调出数据库中添加的名称。

In short you would need to load the mysql jdbc drivers into your android application. 简而言之,您需要将mysql jdbc驱动程序加载到android应用程序中。 I am not sure if this can be done. 我不确定是否可以做到。 Android does not support connecting to a MySQL server out of the box as far as I know. 据我所知,Android不支持直接连接到MySQL服务器。

If you could include the mysql drivers into your android application by adding the mysql jdbc drivers jar to the application you would need to expose your MySQL server directly to the internet for the Android device to able to communicate to the server directly. 如果您可以通过将mysql jdbc驱动程序jar添加到应用程序中,从而将mysql驱动程序包含在android应用程序中,则需要将MySQL服务器直接公开到Internet上,以使Android设备能够直接与该服务器通信。 NOTE By putting your MySQL server directly on the internet it is a open invite for hackers etc. to try and break into your database. 注意通过将您的MySQL服务器直接放在互联网上,这是黑客等的公开邀请,他们试图侵入您的数据库。 Thus it is not advised that you expose your MySQL server directly to the internet. 因此,建议您不要将MySQL服务器直接暴露给Internet。

Best solution is to create a web services or service of sorts that your device connects to. 最好的解决方案是创建设备连接到的Web服务或各种服务。 This service then retrieves the data from the database and returns it to your device. 然后,该服务从数据库中检索数据并将其返回到您的设备。

See this SO question for some more answers. 请参阅此SO问题以获取更多答案。

load the mysql driver in android emulator . 在android模拟器中加载mysql驱动程序

In my case I developed a simple Camel IP server that sits between my device and the MySQL database. 就我而言,我开发了一个简单的Camel IP服务器,该服务器位于我的设备和MySQL数据库之间。 I used google protocol buffers to create a very simple RPC protocol and then I could upload files and data to mysql via the service and then also download and display data from the MySQL server via the service. 我使用Google协议缓冲区创建了一个非常简单的RPC协议,然后可以通过该服务将文件和数据上传到mysql,然后还可以通过该服务从MySQL服务器下载并显示数据。

Follow this tuto and you will learn how to do it exactly 遵循此教程,您将学到确切的方法

Tuto Mysql/android Tuto Mysql /安卓

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Android的第二个活动中显示信息 - How do I display information in my second activity in Android 如何输出我已存储的信息? - How do I output this information that I have stored? 如何在我的PC上获取我的应用程序(Android)存储的文件? - How do I get the files I stored with my app (Android) on my PC? 如何将我的Android应用程序连接到远程MySQL数据库? - How do I connect my Android app to a remote MySQL database? 如何在Android应用中显示字符串? - How do I display a string in an Android app? 如何从网页(HTML)获取相关信息到我的Android应用程序? - How do i get relevant Information from a Webpage (HTML) into my Android App? 如何将存储在AWS S3服务器中的sqlite数据库远程连接到我的android应用 - How do I connect a sqlite DB stored in AWS S3 server to my android app remotely 我希望我的Android应用程序有一个简单的表单,可以发送信息到我的Gmail - I want my android app to have a simple form that can send information to my gmail 我已经从android.com获得了我的HelloListView应用程序,什么是添加信息的最佳方法 - I have got my HelloListView app working from android.com what is the best way to add information 如何使用JSON从远程数据库检索数据并显示在android应用程序xml文件中? - How do i retrieve the data using JSON from the Remote Database and display in my android app xml file?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM