如何在android中使用java在mysql数据库中保存值
我是全新的安卓系统。我需要在mysql数据库中保存值。但是我不知道怎么做。我在android的sqlite数据库中保存了值。但如何在mysql数据库中保存?!!!谁能帮我一下吗?!!以下是我迄今为止所做的尝试>>> 我的活动_main.xml::如何在android中使用java在mysql数据库中保存值,java,android,mysql,Java,Android,Mysql,我是全新的安卓系统。我需要在mysql数据库中保存值。但是我不知道怎么做。我在android的sqlite数据库中保存了值。但如何在mysql数据库中保存?!!!谁能帮我一下吗?!!以下是我迄今为止所做的尝试>>> 我的活动_main.xml:: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/to
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
tools:context="com.example..savedata2mysql.MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/name" />
<EditText
android:id="@+id/name"
android:layout_height="wrap_content"
android:layout_width="fill_parent" android:inputType="text"/>
<Button
android:text="Save Value"
android:id="@+id/btnAdd"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:onClick="onClickAddName" />
</LinearLayout>
my AndroidMainfest.xml>>>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
我已经将这个jar粘贴到libs文件夹>>mysql-connector-java-5.1.18-bin.jar您需要使用webservice作为接口在mysql中存储值。 您可以参考下面的链接来了解webservice和android是如何工作的
你需要为你的android应用做一个后端,这个后端为你提供一个web服务,你可以用它来保存你的价值 你需要知道
@Duggu我看了一下,但它是用php构建的。我想在家里做这件事java@Summon然后用java找出答案,互联网上有很多可用的代码…@Duggu很抱歉这个愚蠢的问题,但我对此很好奇,但没有结果,任何源代码都可能非常有用。
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>