How can I speed up my RSS feed Android App? I have a problem with parsing RSS from a PHP page because the app is too slow.

This is my parsing code:

public void getdataparse(String url) {

    Log.d("Do in Background","Start Call Void");

    String dbtitle = "";
    String dbDesc = "";
    String dbimgicon = "";
    String dbimg = "";
    String dblink = "";
    String dbpubdate = "";
    String dborderStg = "";
    String dbsourcename = "";
    String dbimagecheck = "";
    int dbfff = 0;


        try {

            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            DocumentBuilder db = dbf.newDocumentBuilder();
            Document doc = db.parse(new URL(url).openStream());

            doc.getDocumentElement().normalize();

            NodeList nList = doc.getElementsByTagName("item");

            for (int temp = 0; temp &lt; nList.getLength(); temp++) {


                dbtitle = "";
                dbDesc = "";
                dbimgicon = "";
                dbimg = "";
                dblink = "";
                dbpubdate = "";
                dborderStg = "";
                dbsourcename = "";
                dbimagecheck = "";
                dbfff = 0;
                Datemx = 0;
                Node nNode = nList.item(temp);
                if (nNode.getNodeType() == Node.ELEMENT_NODE) {

                    Element eElement = (Element) nNode;

                    dbtitle = getTagValue("title", eElement);

                    dbDesc = getTagValue("description", eElement);

                    String[] timeformated = new String[2];

                    timeformated = gettime(getTagValue("pubdate", eElement));

                    dbpubdate = timeformated[0];

                    dborderStg = timeformated[1];

                    Log.d("pubDate = ", "" + dbpubdate + "OrderStg = " + dborderStg);

                    dblink = getTagValue("link", eElement);


                    dbimgicon = getTagValue("sicon", eElement);

                    dbimg = "http://s14.postimg.org/cs10sq11d/whitemega.png";

                    dbsourcename = getTagValue("sname", eElement);

                    dbimagecheck = "";

                    dbfff = Datemx;

                    handler = new DataHandler(getBaseContext());
                    handler.open();
                    long id = handler.insertrssfeedData(dbtitle, dbDesc, dbimg, dbimgicon, dblink, dbpubdate, dbfff, dbsourcename , dbimagecheck);
                    handler.close();

                    Log.d("Add New Recorde","Record = " + temp + "/n Title = " + dbtitle);
                }
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
    }


The PHP page URL

The PHP code
none of those Variables need to be set to "" inside the for loop, they have already been set.



This can be set early and outside of the if block and the for loop:

 dbimg = "http://s14.postimg.org/cs10sq11d/whitemega.png";


Otherwise it is a Magic string that you will have to search for later.



The id isn't doing anything here, I don't think that you need it at all, you should be able to call the code like this

handler.insertrssfeedData(dbtitle, dbDesc, dbimg, dbimgicon, dblink, dbpubdate, dbfff, dbsourcename , dbimagecheck);


otherwise you are creating this variable and assigning a lot of data to it and never using it every time you go through the loop.