how to filter internet data -android development


Last Updated: 2012-04-28 11:32:49
  1. ankit662003

    ankit662003 Member

    i am developing an android application......and i need sum help

    its a bit difficult to understand the situation so i am explaining it with a hypothetical situation..
    say i am developing an application which uses Internet.....say a facebook application.....but i want to filter the Internet data...i.e i want to show only sum part of the information i receive but not the rest....say i dont want to show the friendlist but i only want to show the wall of the facebook.


    i dont want to create a new website i directly want to filter it through the android application,so if any 1 knows how to do it plz share

    also tell me what things i have to learn so that i may develope such an application......

    thanxs

    Advertisement
  2. Rush

    Rush {<>}~{<>} Guide

    Hello and welcome aboard. You are definitely in the right place to get some answers for your concern.

    Hopefully someone with the know-how will chime in to assist you.
    I hope this place will serve you well. :)
  3. GeorgeN

    GeorgeN Well-Known Member

    Its not totally straightforward from an Android application. Web pages are typically represented as a tree structure called a DOM (Document Object Model). You would expect the Android SDK to provide you with access to the DOM so that you can easily modify a webpage once it is loaded. Unfortunately it doesn't. The easiest thing you can do is use the WebView class to load your page, and then you can use the loadUrl API to execute javascript and manipulate the DOM that way. For example you could hide the left hand sidebar in Facebook with the following:

    Code (Text):
    1. webView.loadUrl("javascript:document.getElementById('leftColContainer').style.visibility = 'hidden'");
    2.  
    If you are just looking to mash-up Facebook you would be better off looking at the Facebook developer API rather than trying to hack the HTML, otherwise every time Facebook change their page your app will break.

    -George
    ankit662003 likes this.
  4. ankit662003

    ankit662003 Member

    thanx for ur time dude .....but u didint tell what things i need to learn......i am a beginer in dis field and i know some java and c and m following a series of android development from youtube....its gud but the guy only gives d basic idea.......i dont know anything about java scripts.....plz tell me what part of it(java and java script)should i go thru...also suppose i am making a login page.....what shuld i know before hand....
    plz if u r willing tell me the headings.....i will do the learning part :)
  5. GeorgeN

    GeorgeN Well-Known Member

    I'm not really sure I understand exactly what you are trying to do, but the easiest thing would be to use the Android WebView class to do all the hard work and use javascript to change the page. You can use the websites existing logon page.

    If you really want to do the logon stuff yourself then you have a bit of work to do. You will need an activity with text boxes for a username and password and a submit button. The submit button should connect to the websites logon cgi script. If you vist the websites logon page on your PC browser, right click it and select "View Page Source" you can see what the page does. You are looking for a HTML form, you need to read up on HTML GET and POST and then do whatever the form does in your code (see the WiktionarySimple sample app for an example of HTTP GET from an Android app). Make sure you are using HTTPS if you are sending passwords.

    I still think you would be better off using the websites API if it has one though. The WiktionarySimple app demonstrates this.

    If you use the Firefox browser on your PC you can play around with javascript. Go to facebook, then select "Tools->Web Developer->Web Console". Now you can type in javascript commands and see what they do to the page. If you type:
    Code (Text):
    1.  
    2. document.getElementById('leftColContainer').style.visibility = 'hidden';
    The side bar will disappear. You can get it back by typing:
    Code (Text):
    1.  
    2. document.getElementById('leftColContainer').style.visibility = 'visible';  
    Read up on:



    ankit662003 likes this.
  6. ankit662003

    ankit662003 Member

    "You will need an activity with text boxes for a username and password and a submit button. The submit button should *connect to the websites logon cgi script*."


    thanx dude....dis was what i was talking abut...i needed to know how to do it.....i mean i know hot to connect to d internet with an android app...but i was unable to take info from the user.....i made a browser for andorid which could show the webpage....but couldn't take the information from the user..like the browser was able to show the google page.. but i was unable to type in d "search" field of google....

    also say i make a fb app exactly same as the default fb app with comes pre installed with
    the phone....first the login activity comes......there r only 2 fields in dat activity....one for email nd oder for password.......any1 can to do xml layout part but what i need to know is how will d data dat i type in dese fields.....i.e email nd password fields,wud connect to the fb website and allow any 1 to log in.


    and also how to modify pages ....i mean the facebook app....it shows the information the way the developer wants...not the complete websit....
    or say the go facebook chat app for android ....i mean it does nt show whole of the fb website.....but only the "chat" part ...

    thnx by d way for ur help ....although any more help wud b appreciated..
    and pardon me for my english....english isnt my 1st language.
  7. GeorgeN

    GeorgeN Well-Known Member

    The Android facebook app isn't just loading the facebook page and then modifying it, it probably doesn't even use a web view at all. It will use the facebook API I mentioned below. When you use the API it will just send you the data you ask for (like your contact list or you wall posting) without any HTML formatting etc.. You then have to build a complete UI of your own using that data. If you want to do that then you can read up on JSON, but it is a huge amount of work.

    How does the web browser you wrote work? Is it a WebView? By default the WebView doesn't do a lot - it won't store cookies and JavaScript is switched off.
    ankit662003 likes this.
  8. ankit662003

    ankit662003 Member

    okay so i have to read about API and Json....thanx

    and yea i used web view in my browser and i turned on java scripts but dunno how to turn on cookies and dunno how to take input from the user....i mean dat google thing...i was unable to type in search field of google....du u know how to fix it??(i.e.the problem i mentioned in my previous post)
  9. GeorgeN

    GeorgeN Well-Known Member

    ankit662003 likes this.
  10. ankit662003

    ankit662003 Member

    thanx dude..u r like a god to me.....plz give me ur email id so that i can add u on facebook......so that i can ask any more questions ...only if u want to.....
    or if u want to send d reqst...take mine
    rixxx22@yahoo.com

Share This Page