100 likes | 277 Views
ECE 4564: Assignment 1 Reverse Phone Number Lookup. Steven William Brower Monday, September 26, 2011. The Reason for Creating the Application. Everyone occasionally gets calls from unknown numbers. Sometimes need to know which carrier’s network a number is on.
E N D
ECE 4564: Assignment 1Reverse Phone Number Lookup Steven William Brower Monday, September 26, 2011
The Reason for Creating the Application • Everyone occasionally gets calls from unknown numbers. • Sometimes need to know which carrier’s network a number is on. • Knowing whether the number is a land line or a cellular signal can be helpful. • Knowing where a number originated geographically can help identify calls.
What the Application Does • Takes a 10 digit phone number as input from the user. • Finds information about the number including: • The number’s carrier network • The numbers location (landline) or place of registration (cellular) • The ZIP code native to the phones location • The country the number is from • Finds a list of major cities in the area code to give the user an idea of the numbers geographic area.
How the Application Works: The Big Picture • Takes a 10 digit numeric phone number as input • Performs two concurrent http get requests • One request gets information related to the number from the website http://www.melissadata.com/lookups/phonelocation. • The other request get a list of major cities located in the number’s area code from the website http://www.allareacodes.com/reverse-phone-directory/. • A GUI is updated to display the information.
How the Application Works: The Details • The programs main Activity is called. • The Activity implements the OnClickListener interface. • The “Find Info” button is added to the listener.
How the Application Works: The Details • When the “Find Info” button is pressed, the onClick method is called. • The onClick method creates two threads that run the information finding tasks concurrently.
How the Application Works: The Details • The InfoFinderTask and CityFinderTask classes implement the Runnable and HttpCallback interfaces. • Their constructors take a parent Activity and a GUI handler as parameters. • Both have run, onResponse, and onError methods.
How the Application Works: The Details • The city finder and info finder tasks perform http get requests in their run methods. • Because the tasks themselves implement HttpCallback, the task objects are passed into the respective get requests. • After the request is performed, the onResponse method of each task is called. • The GUI is updated with the information accordingly in the onResponse methods using the handler.
The Results Land Line Results Example Cell Phone Results Example Type of Line <----> Scrollable Text Fields <---->