我无法在mysql数据库中保存Android webview中的数据

时间:2017-09-15 19:33:54

标签: java android mysql xml

我通过Android网页浏览访问https://curj.000webhostapp.com/pmei_alumni/alumni_form.php。我想将表单数据保存到Mysql数据库中。问题是按下“保存”按钮它没有响应。它不会将数据保存到mysql中。 以下是代码。请帮忙 .. 您的回复将是值得赞赏的......

MainActivity.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.bilalkhawaja.pmeialumni.MainActivity">

<im.delight.android.webview.AdvancedWebView
    android:id="@+id/webView"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />
</RelativeLayout>

这是ManinActivity.JAVA代码

package com.example.bilalkhawaja.pmeialumni;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Build;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import im.delight.android.webview.AdvancedWebView;

public class MainActivity extends AppCompatActivity implements 
AdvancedWebView.Listener {

    String Url = 
"https://curj.000webhostapp.com/pmei_alumni/pmei_alumni.php";

    public AdvancedWebView mWebView;


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

mWebView = (AdvancedWebView) this.findViewById(R.id.webView);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.setWebViewClient(new WebViewClient());
mWebView.loadUrl(Url);
mWebView.setListener(this,this);
}

@SuppressLint("NewApi")
@Override
protected void onResume() {
super.onResume();
mWebView.onResume();
// ...
}

@SuppressLint("NewApi")
@Override
protected void onPause() {
mWebView.onPause();
// ...
super.onPause();
}

@Override
protected void onDestroy() {
mWebView.onDestroy();
// ...
super.onDestroy();
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent 
intent) {
super.onActivityResult(requestCode, resultCode, intent);
mWebView.onActivityResult(requestCode, resultCode, intent);
        // ...
}

@Override
public void onBackPressed() {
if (!mWebView.onBackPressed()) { return; }
// ...
        super.onBackPressed();
    }



@Override
public void onPageStarted(String url, Bitmap favicon) {

    }

    @Override
    public void onPageFinished(String url) {

    }

@Override
public void onPageError(int errorCode, String description, String 
failingUrl) {

    }

 @Override
 public void onDownloadRequested(String url, String suggestedFilename, 
String mimeType, long contentLength, String contentDisposition, String 
userAgent) {

    }

    @Override
    public void onExternalPageRequest(String url) {

    }
    }

**AndroidManifest.xml code**

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.bilalkhawaja.pmeialumni">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

<application
    android:allowBackup="true"
    android:icon="@drawable/icon"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".MainActivity">
    </activity>
    <activity android:name=".SplashScreen">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

</manifest>

Html Form From which i am saving data into mysql database using Android Webview

0 个答案:

没有答案