从Android应用程序访问在线数据库的最佳方法? [英] best way to access online database from android app?

查看:125
本文介绍了从Android应用程序访问在线数据库的最佳方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

构建一个允许所有人共享图片的android社交应用。将图片从在线数据库显示到我的社交应用的最佳做法是什么?这些在线数据库图片也可以使用imageview进行水平滚动吗?

解决方案

您可以将图像存储在在线数据库,以Base64字节数组的形式存在,然后创建一个Web服务,该服务将从数据库中请求该图像。



您可以轻松地将Base64和位图相互转换



当您要上传任何图像时,请转换为字节数组并通过网络将其存储在数据库中。服务。当您要下载任何图像时,获取字节数组并转换为Bitmap并显示在您的应用程序中。



请随时询问我是否不清楚。

p>

编辑:创建并连接到Web服务



使用SQL Server进行管理



然后在您的应用程序中连接到该Web服务并从中设置/获取数据。



数据库。



如何制作NET中的网络服务(不包括Android中的实现)。



有关如何将服务与Android连接的链接:



http:// seesharpgears .blogspot.in / 2010/11 / basic-ksoap-android-tutorial.html



http://www.codeproject.com/Articles/304302/Calling-Asp-Net-Webservice- ASMX-From-an-Android-Ap



http://adrianandroid.blogspot.in/2012/05/access-c-net-web-service-in.html


Building an android social app that allows everyone to share pictures. What's the best practice to display the pictures from an online database to my social app? Would it also be possible to these online db pictures to do a horizontal scroll with imageview?

解决方案

You can store the images in your online database in the form of Base64 byte array and then maybe create a web-service which will request for that image from the database.

You easily inter-convert Base64 and Bitmap formats, so the conversion shouldn't be a problem.

When you want to upload any image, convert into a byte array and store it on the database via a web-service. When you want to download any image, get the byte array and convert into Bitmap and display in your application.

Feel free to ask if I failed to be clear.

EDIT : Creating and Connecting to a Web-service

Use SQL server to manage the data on your desktop and create a web-service in .Net on Visual Studio.

Then connect to the web-service in your application and set/get data from the DB.

Link on how to make a web-service in .NET (does not include the implementation in Android).

Links on how to connect your service with Android :

http://seesharpgears.blogspot.in/2010/11/basic-ksoap-android-tutorial.html

http://www.codeproject.com/Articles/304302/Calling-Asp-Net-Webservice-ASMX-From-an-Android-Ap

http://adrianandroid.blogspot.in/2012/05/access-c-net-web-service-in.html

这篇关于从Android应用程序访问在线数据库的最佳方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆