用于注册网站的Android应用程序

时间:2013-08-13 10:41:31

标签: android

我必须构建一个Android应用程序。它只需传达一个目的。有一个名为www.graffititechnologies.com的网站。我必须创建此应用程序以注册到上述网站。我只是Android的初学者。怎么可能。

2 个答案:

答案 0 :(得分:0)

在网站的服务器上创建Web服务!通过调用这些Web服务并通过它们传递数据,将手机应用程序中的值发布到服务器的数据库。

教程:

http://www.androidhive.info/2012/01/android-login-and-registration-with-php-mysql-and-sqlite/

如果能帮到你,请将它标记为答案谢谢:)

答案 1 :(得分:0)

你必须使用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();
        }
    }