Android网站注册应用程序
我必须构建一个android应用程序。它只需要传达一个目的。有一个叫做www.graffititechnologies.com的网站。我必须创建此应用程序才能注册到上述网站。我只是Android的初学者。这怎么可能呢。在网站的服务器上创建一个Web服务!通过调用这些web服务并通过它们传递数据,将手机应用程序中的值发布到服务器的数据库中 教程:Android网站注册应用程序,android,Android,我必须构建一个android应用程序。它只需要传达一个目的。有一个叫做www.graffititechnologies.com的网站。我必须创建此应用程序才能注册到上述网站。我只是Android的初学者。这怎么可能呢。在网站的服务器上创建一个Web服务!通过调用这些web服务并通过它们传递数据,将手机应用程序中的值发布到服务器的数据库中 教程: 如果对您有帮助,请将其标记为答案谢谢:)您必须使用Json来完成此任务您可以将注册用户的php脚本上载到网站,然后您可以从edittext获取输入并将
如果对您有帮助,请将其标记为答案谢谢:)您必须使用Json来完成此任务您可以将注册用户的php脚本上载到网站,然后您可以从edittext获取输入并将其转换为字符串,然后将数据发送到您的脚本查看此代码 发送数据:
public static void sendData(String name, String emailid, String dob, String password, String lastname)
{
String content = "";
try
{
/* Sends data through a HTTP POST request */
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost("www.graffititechnologies.com/login.php");
List <NameValuePair> params = new ArrayList <NameValuePair>();
params.add(new BasicNameValuePair("name", name));
params.add(new BasicNameValuePair("lastname", lastname));
params.add(new BasicNameValuePair("from", from));
params.add(new BasicNameValuePair("dob", dob));
params.add(new BasicNameValuePair("email", emailid));
params.add(new BasicNameValuePair("password", password));
httpPost.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8));
/* Reads the server response */
HttpResponse response = httpClient.execute(httpPost);
InputStream in = response.getEntity().getContent();
StringBuffer sb = new StringBuffer();
int chr;
while ((chr = in.read()) != -1)
{
sb.append((char) chr);
}
content = sb.toString();
in.close();
/* If there is a response, display it */
if (!content.equals(""))
{
Log.i("HTTP Response", content);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
publicstaticvoidsenddata(字符串名称、字符串emailid、字符串dob、字符串密码、字符串lastname)
{
字符串内容=”;
尝试
{
/*通过HTTP POST请求发送数据*/
DefaultHttpClient httpClient=新的DefaultHttpClient();
HttpPost HttpPost=新的HttpPost(“www.graffititechnologies.com/login.php”);
List params=newarraylist();
参数添加(新的BasicNameValuePair(“名称”),名称);
添加(新的BasicNameValuePair(“lastname”,lastname));
参数添加(新的BasicNameValuePair(“from”,from));
参数添加(新的BasicNameValuePair(“dob”,dob));
添加(新的BasicNameValuePair(“电子邮件”,emailid));
添加(新的BasicNameValuePair(“密码”,password));
setEntity(新的UrlEncodedFormEntity(params,HTTP.UTF_8));
/*读取服务器响应*/
HttpResponse response=httpClient.execute(httpPost);
InputStream in=response.getEntity().getContent();
StringBuffer sb=新的StringBuffer();
int-chr;
而((chr=in.read())!=-1)
{
sb.附加((char)chr);
}
content=sb.toString();
in.close();
/*如果有响应,请显示它*/
如果(!content.equals(“”)
{
Log.i(“HTTP响应”,内容);
}
}
捕获(例外e)
{
e、 printStackTrace();
}
}
您使用哪种技术phonegap/Native????