I’m developing and android application for my Final Year Project. I successfully stored some user information and details to the database, referring to a few online tutorials and examples. However I need help to display the user and some user input information to the main page. Similar to facebook homepage. Can someone give me a clue of direction or any online articles or tutorials to look to? Kindly appreciate your help, thanks.
This is part of my php files that storing users information and user’s input. I wanted to display all of them in a single page. What should I code my xml files and main activity class file?
else if ($tag == 'report') {
//Request type is report location report
$name = $_POST['name'];
$address = $_POST['address'];
$traffic = $_POST['traffic'];
$whathappen = $_POST['whathappen'];
$comment = $_POST['comment'];
//store information
$report = $db->storeReport($address, $traffic, $whathappen, $comment);
if($report) {
//report stored successfully
//$response["success"] = 1;
$responce["report"]["name"] = $report["name"];
$responce["report"]["address"] = $report["address"];
$responce["report"]["traffic"] = $report["traffic"];
$responce["report"]["whathappen"] = $report["whathappen"];
$responce["report"]["comment"] = $report["comment"];
$responce["report"]["created_at"] = $report["created_at"];
$responce["report"]["updated_at"] = $report["updated_at"];
echo json_encode($responce);
}
There are many options for your requirements. You can create an activity with a bunch of
EditTextboxes for user input and a bunch ofTextViewsfor displaying the information.Seems like you need a good beginners course in Android development to get the hang of actvities, layouts, buttons, listeners etc. I recommend the excellent official Google developer’s guide here:
http://developer.android.com/training/index.html
If you know these, then you can read up on databases. Here’s a good tutorial:
http://www.androidhive.info/2011/11/android-sqlite-database-tutorial/
Once you get the data from the databse, you can just assign these values to the
TextViewsusing the
TextView.setText()method.