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

Apps android listview with loadmore button using xml parsing

krishnaveni

Well-Known Member
Dec 16, 2011
158
0
chennai
I have developed one android application listview with loadmore button using xml parsing.

I have followed this tutorial:Android ListView with Load More Button

Here i have to implement one part:

If my xml feed is empty means how can i hide the button on pervious page.please help me. I have wrote the below code means hide the button on empty page.but i wish to hide the button on lastpage(previous page of empty page).

For Eg:

Totally i have 4 pages.the 4 pages have feed values and 5th page have empty feed means i have to hide the button on 4th page.how can i do.please help me.

Code:
if(nl.getLength() == 0 )
        {
            btnLoadMore.setVisibility(View.GONE);
            pDialog.dismiss();
        }
This is my php code:
<?php
require "./auth.php";

set_time_limit ( 186400 );
$catid=1;

$catname = func_query_first_cell("select status from $sql_tbl[orders] ORDER BY orderid DESC");

$_xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>";
$_xml .= "<Feed>";
$_xml .= "<order>";
$page = (int)(!isset($_GET["page"]) ? 1 : $_GET["page"]);
$limit = 5;
$startpoint = ($page * $limit) - $limit;
$statement = "`xcart_orders` where `active` = 1";
$counterr = 0;
$r=func_query("select * from $sql_tbl[orders] ORDER BY orderid DESC LIMIT {$startpoint}, {$limit}");
foreach ($r as $n)
{
$products = func_query_first("select * from $sql_tbl[orders] ORDER BY orderid DESC");
$products = func_query_first("select product from $sql_tbl[order_details] where orderid=$n[orderid]");
$infeed_counter++;
if ($row[avail] > 0)
$avail = 'Y';
else
$avail = 'N';
$_xml .= "<Order>";
$_xml .= "<orderid>" . $n[orderid] . "</orderid>";
$_xml .= "<login>" . htmlspecialchars(strip_tags(substr($n[login], 0, 50)), ENT_QUOTES) . "</login>";
$_xml .= "<total>" . $n[total] . "</total>";
$_xml .= "<product>" . $products[product] . "</product>";
$_xml .="\t<status>" .$n[status]. "</status>\r\n";
$_xml .= "</Order>";
}

$_xml .= "</order>";
$_xml .= "</Feed>";

header ("Content-Type:text/xml");
echo $_xml;
?>

How can i hide the button on last page.
 
I have developed one android application listview with loadmore button using xml parsing.

I have followed this tutorial:Android ListView with Load More Button

Here i have to implement one part:

If my xml feed is empty means how can i hide the button on pervious page.please help me. I have wrote the below code means hide the button on empty page.but i wish to hide the button on lastpage(previous page of empty page).

For Eg:

Totally i have 4 pages.the 4 pages have feed values and 5th page have empty feed means i have to hide the button on 4th page.how can i do.please help me.

Code:
if(nl.getLength() == 0 )
        {
            btnLoadMore.setVisibility(View.GONE);
            pDialog.dismiss();
        }
This is my php code:


How can i hide the button on last page.
First of all, it would be more clearly to understand your problem, if you post your java-code from android project here.
Try to do this trick - put an attr with total feed elements to your <Feed> tag, so it would be <Feed total="N">.
And then in your android app just track what page you've loaded and how much feed data is left
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones