开发者

android form data sending to mysql database

I have an android layout with a spinner, 2 edittexts and a multiselection list. I want to send the data from these controls to a mysql database. It's like a profile kind of a thing, once it is filled and sent I want it to fetch the data inserted from mysql database and show it in a profile like view (like in textviews) instead of showing me the form again.

<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical"
    android:padding="10dip"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" android:background="@drawable/chipperstyle_bg" android:id="@+id/layout">

    <TextView 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:textColor="#848585" android:id="@+id/chipper_type" android:text="[ CHIPPER TYPE ]" andr开发者_运维知识库oid:layout_marginTop="8dip"/>
    <LinearLayout android:layout_width="fill_parent" android:id="@+id/linearLayout1" android:layout_height="wrap_content" android:layout_marginTop="-10dip" android:layout_marginBottom="10dip">
        <Spinner android:id="@+id/spinner" android:prompt="@string/select_chippertype" android:layout_height="wrap_content" android:layout_weight="0" android:layout_width="fill_parent" android:layout_marginTop="10dip"></Spinner>
    </LinearLayout>

    <TextView 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:textColor="#848585" android:text="[ INTERESTS ]" android:layout_marginTop="-10dip" android:layout_marginBottom="5dip"/>

    <EditText android:layout_width="fill_parent"
        android:clickable="true"
        android:id="@+id/interest_et" android:layout_height="wrap_content" android:paddingLeft="10dip" android:textColor="#848585" android:password="false" android:scrollbarAlwaysDrawVerticalTrack="true" android:scrollbarStyle="insideOverlay" android:scrollbarSize="2dip" android:scrollbars="vertical" android:singleLine="true" android:scrollbarFadeDuration="2" android:layout_marginTop="0dip" android:editable="false"/> 

     <TextView 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:textColor="#848585" android:text="[ TAG LINE ]" android:layout_marginBottom="10dip" android:layout_marginTop="5dip"/>

    <EditText android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:clickable="true"
        android:id="@+id/tagline_et" android:paddingLeft="10dip" android:textColor="#848585" android:scrollbarAlwaysDrawVerticalTrack="true" android:password="false" android:singleLine="true" android:layout_marginTop="0dip"/> 

    <TextView 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="10dip" android:textColor="#848585" android:text="[ COMPATIBLE CHIPPER(S) ]" android:layout_marginTop="5dip"/>
    <Spinner android:prompt="@string/select_chippertype" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/Spinner01" android:layout_marginBottom="-5dip" android:layout_marginTop="0dip"></Spinner> 


    <LinearLayout android:orientation="horizontal"
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content">
    <Button android:id="@+id/cancel_signUp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/cancel2"/>
    <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/signUp" android:layout_marginLeft="150dip" android:background="@drawable/go_buttons1"></Button>
    </LinearLayout>
    <ImageView android:scaleType="center" android:src="@drawable/plain" android:id="@+id/imageView1" android:layout_marginLeft="236dip" android:layout_height="70dip" android:layout_width="65dip" android:layout_marginBottom="0dip" android:layout_marginTop="-14dip"></ImageView>

    </LinearLayout>


This is typically done by creating a simple web service using PHP, and posting the data to it using JSON. Here are some places where you can find examples:

Android: Sending data to be stored in MySQL
http://www.helloandroid.com/tutorials/connecting-mysql-database
http://www.basic4ppc.com/forum/basic4android-getting-started-tutorials/8339-connect-android-mysql-database-tutorial.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜