韩国三级高清手机在线版-韩国三级电影久久-韩国三级hd中文字幕一男多女-韩国三级hd中文字幕久久精品-日本精品在线视频-日本精品在线观看视频

相信每個項目都會有用戶反饋建議等功能,這個實現的方法很多,下面是我實現的方法,供大家交流。首先看具體界面,三個字段。名字,郵箱為選填,可以為空,建議不能為空。如有需要可以給我留言。
 
下面貼出布局代碼,這里用到一個<include layout="@layout/uphead">就是把另外一個布局文件引入到這個布局中。

復制代碼 代碼如下:


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/bg_gray" >
<include layout="@layout/uphead"/>
<!-- Name Label -->
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="名字(選填)"
android:paddingLeft="10dip"
android:paddingRight="10dip"
android:textColor="@color/coffee"
android:paddingTop="10dip"
android:textSize="12sp"/>
<!-- Input Name -->
<EditText android:id="@+id/inputName"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="5dip"
android:layout_marginBottom="15dip"
android:singleLine="true"/>
<!-- Price Label -->
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="郵箱(選填)"
android:paddingLeft="10dip"
android:paddingRight="10dip"
android:textColor="@color/coffee"
android:paddingTop="10dip"
android:textSize="12sp"/>
<!-- Input Price -->
<EditText android:id="@+id/inputEmail"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="5dip"
android:layout_marginBottom="15dip"
android:singleLine="true"/>
<!-- Description Label -->
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="建議(必填)"
android:paddingLeft="10dip"
android:paddingRight="10dip"
android:paddingTop="10dip"
android:textColor="@color/coffee"
android:textSize="12sp"/>
<!-- Input description -->
<EditText android:id="@+id/inputDesc"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="5dip"
android:layout_marginBottom="15dip"
android:lines="4"
android:gravity="top"/>
<!-- Button Create Product -->
<Button android:id="@+id/btnCreateProduct"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="提交"
android:textSize="20sp"
android:textColor="@color/coffee"
/>
</LinearLayout>


下面貼出uphead的布局代碼,里面用到一個TextView,一個Button為返回按鈕。

復制代碼 代碼如下:


<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:background="@drawable/top" >
<TextView
android:id="@+id/tv_head"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:shadowColor="#ff000000"
android:shadowDx="2"
android:shadowDy="0"
android:shadowRadius="1"
android:text=""
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold" />
<Button
android:id="@+id/upback"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="17dp"
android:drawableLeft="@id/tv_head"
android:background="@drawable/back" />
</RelativeLayout>


下面貼出android客戶端代碼,三個類,一個用于與服務器交互發送post請求,以及json的傳遞。還有一個Dailog實例。

復制代碼 代碼如下:


package com.android.up;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONObject;
import com.android.MainActivity;
import com.android.R;
import com.anroid.net.DialogUtil;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class up extends Activity {
// Progress Dialog
private ProgressDialog pDialog;
private TextView tv_head;
JSONParser jsonParser = new JSONParser();
EditText inputName;
EditText inputEmail;
EditText inputDesc;
Button upback;
// url to create new product
private static String url_up = "http://10.0.2.2/up/up.php";//此處寫的是你的服務器端的地址
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.up);
tv_head = (TextView)findViewById(R.id.tv_head);
tv_head.setText("建議");
// Edit Text
inputName = (EditText) findViewById(R.id.inputName);
inputEmail = (EditText) findViewById(R.id.inputEmail);
inputDesc = (EditText) findViewById(R.id.inputDesc);
upback = (Button)findViewById(R.id.upback);
upback.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent back = new Intent(up.this,MainActivity.class);
back.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(back);
up.this.finish();
}
});
// Create button
Button btnCreateProduct = (Button) findViewById(R.id.btnCreateProduct);
// button click event
btnCreateProduct.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
// creating new product in background thread
if(validate()){
new Up().execute();
}
}
});
}
private boolean validate()
{
String description = inputDesc.getText().toString().trim();
if (description.equals(""))
{
DialogUtil.showDialog(this, "您還沒有填寫建議", false);
return false;
}
return true;
}
/**
* Background Async Task to Create new product
* */
class Up extends AsyncTask<String, String, String> {
/**
* Before starting background thread Show Progress Dialog
* */
@Override
protected void onPreExecute() {
super.onPreExecute();
pDialog = new ProgressDialog(up.this);
pDialog.setMessage("正在上傳..");
pDialog.setIndeterminate(false);
pDialog.setCancelable(true);
pDialog.show();
}
/**
* Creating product
* */
protected String doInBackground(String... args) {
String name = inputName.getText().toString();
String price = inputEmail.getText().toString();
String description = inputDesc.getText().toString();
// Building Parameters
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("name", name));
params.add(new BasicNameValuePair("email", price));
params.add(new BasicNameValuePair("description", description));
// getting JSON Object
// Note that create product url accepts POST method
try{
JSONObject json = jsonParser.makeHttpRequest(url_up,
"POST", params);
}catch(Exception e){
e.printStackTrace();
}
// check for success tag
return null;
}
/**
* After completing background task Dismiss the progress dialog
* **/
protected void onPostExecute(String file_url) {
pDialog.setMessage("上傳成功");
pDialog.dismiss();

}
}
}


下面貼出Dailog實例類

復制代碼 代碼如下:


/**
*
*/
package com.anroid.net;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.view.View;
import android.app.Activity;
public class DialogUtil
{
// 定義一個顯示消息的對話框
public static void showDialog(final Context ctx
, String msg , boolean closeSelf)
{
// 創建一個AlertDialog.Builder對象
AlertDialog.Builder builder = new AlertDialog.Builder(ctx)
.setMessage(msg).setCancelable(false);
if(closeSelf)
{
builder.setPositiveButton("確定", new OnClickListener()
{
public void onClick(DialogInterface dialog, int which)
{
// 結束當前Activity
((Activity)ctx).finish();
}
});
}
else
{
builder.setPositiveButton("確定", null);
}
builder.create().show();
}
// 定義一個顯示指定組件的對話框
public static void showDialog(Context ctx , View view)
{
AlertDialog.Builder builder = new AlertDialog.Builder(ctx)
.setView(view).setCancelable(false)
.setPositiveButton("確定", null);
builder.create()
.show();
}
}


剩下就是如何與服務器端交互了不多說,代碼如下

復制代碼 代碼如下:


package com.android.up;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.util.List;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.protocol.HTTP;
import org.json.JSONException;
import org.json.JSONObject;
import android.util.Log;
public class JSONParser {
static InputStream is = null;
static JSONObject jObj = null;
static String json = "";
// constructor
public JSONParser() {
}
// function get json from url
// by making HTTP POST
public JSONObject makeHttpRequest(String url, String method,
List<NameValuePair> params) {
// Making HTTP request
try {
// request method is POST
// defaultHttpClient
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(url);
httpPost.setEntity(new UrlEncodedFormEntity(params,HTTP.UTF_8));
HttpResponse httpResponse = httpClient.execute(httpPost);
HttpEntity httpEntity = httpResponse.getEntity();
is = httpEntity.getContent();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(
is, "UTF-8"));
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
sb.append(line + "\n");
}
is.close();
json = sb.toString();
} catch (Exception e) {
Log.e("Buffer Error", "Error converting result " + e.toString());
Log.d("json", json.toString());
}
// try parse the string to a JSON object
try {
jObj = new JSONObject(json);
} catch (JSONException e) {
Log.e("JSON Parser", "Error parsing data " + e.toString());
}
// return JSON String
return jObj;
}
}


到此android客戶端已經完成,后天服務器端用php+mysql實現,當然這里只是個實例,存取到數據庫里面,沒有進行展示,代碼如下

復制代碼 代碼如下:


<?php
// array for JSON response
$response = array();
include("conn.php");
// check for required fields
if (isset($_POST['name']) && isset($_POST['email']) && isset($_POST['description'])) {
$name = $_POST['name'];
$price = $_POST['email'];
$description = $_POST['description'];
$result = mysql_query("INSERT INTO up(name, email, description) VALUES('$name', '$email', '$description')");
echo $result;
// check if row inserted or not
if ($result) {
// successfully inserted into database
$response["success"] = 1;
$response["message"] = "Product successfully created.";
// echoing JSON response
echo json_encode($response);
} else {
// failed to insert row
$response["success"] = 0;
$response["message"] = "Oops! An error occurred.";
// echoing JSON response
echo json_encode($response);
}
} else {
// required field is missing
$response["success"] = 0;
$response["message"] = "Required field(s) is missing";
// echoing JSON response
echo json_encode($response);
}
?>


數據庫表結構如下,連接數據庫代碼就不貼出了,記得把編碼設置為UTF-8就行了。

到此就完成了一個用戶反饋的基本功能,后臺數據里展示。

 

穩定

產品高可用性高并發

貼心

項目群及時溝通

專業

產品經理1v1支持

快速

MVP模式小步快跑

承諾

我們選擇聲譽

堅持

10年專注高端品質開發
  • 返回頂部
666西方最大但人文艺术| 亚洲综合色一区二区三区| 亚洲AV无码成H人动漫无遮挡| 精品国产乱码一区二区三区| 伊人色综合视频一区二区三区| 欧美另类精品黑人巨大| 国产成人AV区一区二区三| 亚洲AV自慰白浆喷水少妇| 久久综合亚洲色1080P| 成人区人妻精品一区二区不卡| 亚洲AV无码一区二区三区人| 男人猛躁进女人免费播放| CHINESE老熟妇老女人HD| 乱码专区一卡二卡国色天香| 办公室撕开奶罩揉吮奶头H文 | 中国大陆女RAPPER欢迎你| 青草草97久热精品视频| 国产色无码精品视频国产| 中国老太婆BB无套内射| 亚洲AV综合色区无码二区爱AV| 天天躁夜夜躁AV天天爽| 久久亚洲AV午夜福利精品一区二| 成人AV片无码免费天天看| 亚洲精品欧美二区三区中文字幕| 清纯校花挨脔日常H惩罚视频 | 国产精品JK白丝AV网站| 咬住下唇动漫在线播放完整版| 亚洲AV日韩AV无码AV| 无码专区一ⅤA亚洲V专区在线| 男朋友要再做一次才同意分手| 国产精品国产三级国产专I| 成色好的Y31S标准版| 亚洲午夜无码片在线观看影院| 日日噜噜噜夜夜爽爽狠狠视频 | 欧美日韩精品一区二区三区不卡| 国产亚洲AV综合人人澡精品| DY888午夜福利视频| 在线高清理伦片A| 五月丁香综合缴情六月小说| 欧美成人国产精品视频蜜芽| 黑人大战中国AV女叫惨了| 把腿张开让老子臊烂你的视频 | 中文字幕有码无码人妻AV蜜桃| 无码国产精成人午夜视频不卡| 老男人久久青草AV高清| 成人每日更新在线不卡| А√中文在线资源库| 亚洲码欧美码一区二区三区| 日本特黄特色AAA大片免费| 久久精品无码一区二区软件| 国产成人亚洲精品无码高潮| 91人人澡人人爽内射电影院| 亚洲国产精品一区二区第四页 | 野花韩国高清免费视频6| 亚洲中文久久精品无码| 无码aⅴ精品一区二区三区浪潮 | 女子遭遇疯狂侵犯| 狠狠躁夜夜躁人人爽天天天天97| 部长的夫人的味道中字| 岳故意装睡让我挺进去的电影| 再灬再灬再灬深一点舒服| 中文字幕亚洲综合久久综合| CHINESE老熟妇老女人HD| 成人国内精品久久久久影院VR| 公咬着小娇乳H边走边欢视频| 99亚洲乱人伦AⅤ精品| 亚洲日韩一页精品发布| 性饥渴少妇做私密SPA| 少妇爆乳无码AV专区网站寝取| 欧美黑人巨大手机在线观看| 久久久久精品无码AV| 好爽…又高潮了毛片免费看| 国产精品国产三级国产AN| 国产婷婷色一区二区三区| 精品乱码一卡2卡三卡4卡二卡| 日韩视频在线观看| 超碰97人人做人人爱少妇| 中国熟妇人妻XXXXX| 亚洲精品乱码久久久久久蜜桃图片| 亚洲日本一线产区和二线产区区别 | 男人的天堂AV网站| 日本精品一区二区三区在线视频| 免费看高清毛片AAAAAAAA| 久久AⅤ免费观看| 国产在线精品一区二区三区直播| 国产成人高清精品亚洲| 韩国电影办公室6免费完整版 | 一二三四免费观看高清在线| 亚洲毛片无码专区亚洲乱| 伊人成年网站综合网| エロドラえもんCOM中文在线| 国产精品拍天天在线| 国产精品久久久久精品三级卜| 公园小树中老年交易图片| 国内精品卡一卡二卡三| 国产自偷自偷免费一区| 美女GIF趴跪式抽搐动态图 | 久久老司机精品网站福利| 久久国产免费直播| 欧美综合在线激情专区| 青草青草视频2免费观看| 天天躁夜夜躁很很躁| 亚洲一区二区三区AV无码蜜桃| JLZZZJLZZZ国产免费观| 凹凸国产熟女精品视频| 国产凸凹视频一区二区| 妺妺窝人体色444444大粗| 欧美成人性生活视频| 无码精品久久久久久人妻中字| 尤物AV无码国产在线看| 18性欧美XXXⅩ性满足| 51精产国品一二三产区区别| 高清不卡一区二区三区| 国产精品成人99一区无码| 久久久精品中文字幕乱码18| 日韩在线观看视频一区二区| 亚洲国产成人精品无码一区二区 | 人妻插B视频一区二区三区| 亚洲AV片毛片成人观看| JAPANESEXXXⅩHD乱| 成人动漫在线观看| 九九精品99久久久香蕉| 老汉粗大不带套怀孕| 色欲丰满熟妇人妻AV无码 | 永久免费AV网站| 国产ww又大又粗又刺激孕妇| 国产久9视频这里只有精品| 黑人玩弄人妻中文在线| 琪琪电影午夜理论片YY6080| 亚洲国产精品成人一区二区在线| 超清无码熟妇人妻AV在线电影 | 久久亚洲精品AB无码播放| 天天躁日日躁狠狠躁2018| 4D肉蒲团之性奴大战奶水| 韩国19禁无遮挡啪啪无码网站| 日本少妇人妻ⅩⅩXXX厨房| 一本一本大道香蕉久在线精品| 91人妻人人揉人人躁人人 | 含羞草亚洲AV无码久久精品| 人与性动交AAAABBBB| 天堂AV旡码AV毛片毛片免费| 亚洲AV成人综合网久久成人| AV老司机福利精品导航| 公交车后车座的疯狂的做| 秘密列车动漫在线观看| 日本理论片YY4800免费| 亚洲一区二区三区自拍公司 | 欧美性受XXXX视频| 亚洲色精品AⅤ一区区三区| av 成人 亚洲无码| 教室停电了校草挺进我体内 | 亚洲A∨精品无码一区二区| 亚洲一线产区和二线产区的区别| 国产成人MV视频在线观看| 欧美精品人人做人人爱视频| 亚洲性XXXXX极品少妇| 国产午夜精品一区二区三区| 色噜噜AV男人的天堂| 亚洲国产精品久久久久制服| 吃奶呻吟打开双腿做受视频| 蜜桃传媒在线观看免费版7| 亚洲欧洲成人A∨在线观看 | 精品久久久久久中文字幕| 天天摸夜夜添狠狠添婷婷| 成 年 人 黄 色 大 片大 全| 免费国产VA在线观看中文字| 亚洲色丰满少妇高潮| 国内美女推油按摩在线播放 | 亚洲精品自偷自拍无码忘忧| 国产精品一区二区久久国产| 少妇极品熟妇人妻无码| 被带到调教室刑床惩罚挠痒痒作文 | 草草浮力影院禁止18进入| 男男av在线播放| 中国老太太WBBHD| 久久天天躁狠狠躁夜夜| 撒尿BBWBBW| СЕКС日本ВИДЕ视频| 妺妺晚上扒我内裤玩我J| 中文无码不卡中文字幕| 久久婷婷五月综合色奶水99啪| 亚洲欧洲国产综合AⅤ无码| 果冻传媒播放观看免费| 亚洲AV成人片无码| 国产女人被躁到高潮的AV| 欧美老熟妇乱子伦视频| 综合久久国产九一剧情麻豆| 乱中年女人伦AV| 在出租屋里被强高H| 久久久久亚洲精品男人的天堂| 亚洲色欲色欲WWW成人网| 精品无码国产自产拍在线观看 | 亚洲午夜福利在线观看| 精品高潮呻吟99AV无码| 亚洲大肥女ASS硕大| 成 人片 黄 色 大 片| 欧洲精品码一区二区三区免费看| A级毛片成人网站免费看| 欧美巨鞭大战丰满少妇| 99精品视频在线观看婷婷|