• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Help Needed! Android chat - pc chat server

thornt

Lurker
Hi guys,

I'm new here and this is my first post. I'm new to android program as i've just started learning at university. I'm developing a chat application that interacts with a chat server on a pc. I've created a login page that has a predefined username as password within it, however i wish to implement a system that checks the login name and password to a database, how ever i have no idea how to do this. Could anyone help please?.

p.s. sorry if this is in the wrong thread.

The coding for the login page is:

package com.svennevik.andriod;


import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class AndriodPasswordActivity extends Activity
{


@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.login);



final AlertDialog.Builder adb = new AlertDialog.Builder(this);
adb.setTitle("Login Incorrect");
adb.setMessage("Try again");
adb.setPositiveButton("Ok", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int id)
{


}
});

Button send1 = (Button)findViewById(R.id.connectButton);
send1.setOnClickListener(new OnClickListener()

{
public void onClick(View v)
{

final EditText e1 = (EditText)findViewById(R.id.usernameEditText);
String username = e1.getText().toString();

final EditText e2 = (EditText)findViewById(R.id.passwordEditText);
String password = e2.getText().toString();

if (username.equals ("donald") && password.equals ("duck"))
f ();
else
adb.show ();
}
});
}

void f()
{
Intent i1 = new Intent(this, AndriodConnectionActivity.class);
startActivity (i1);
}
}
 
You'll ned to create a PHP script to handle your query on the server side and on the client side, execute the PHP script via a HttpClient connection.
 
You'll ned to create a PHP script to handle your query on the server side and on the client side, execute the PHP script via a HttpClient connection.

PHP I can handle fine thats easy, BUT I have no idea about the rest of it, i have seen a sample of a program online but i couldn't implement it onto mine..
 
jonbonazza, thanks for the link so far i've still not got a clue how to implement that to my current coding.. Thanks for you link though it's appreciated
 
The first thing that I would do is sit down and design the architecture on paper. Before you can start coding, you need to figure out the server-side stuff, such as how many tables you need, what fields should be in what table, what information does the server need from the client to query the database, etc... Once you have all of that figured out, the next step would be to write the PHP script to handle the database queries. After all of the server-side work is setup, then you can finally move on to the client side communications.

If you have any specific questions, ask them here or PM me and I will try to get an answer to you asap.
 
Back
Top Bottom