AndroidLookup  0.02
 All Classes Namespaces Files Functions Variables Pages
Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
com.jburto2.androidlookup.MainActivity Class Reference

This class implements functionality for the main activity in Android Lookup. Start here. More...

Inheritance diagram for com.jburto2.androidlookup.MainActivity:

Public Member Functions

boolean onCreateOptionsMenu (Menu menu)
 Inflate the menu; this adds items to the action bar if it is present. More...
 
boolean onOptionsItemSelected (MenuItem item)
 Handles menu item selection. Only menu item here is the "action_about" for the info activity. More...
 
void clearHostNameMessage (View view)
 Clear the fields. This should be the registered response to the "clear" button for the Hostname button. Learned how to clear a field from http://stackoverflow.com/questions/8758635/how-to-clear-the-edittext-when-onclick-on-button. More...
 
void lookupMessage (View view)
 Looks up the url or the IP address. This should be the registered response to the "lookup" button. Note: The actual lookup is done on a separate thread. More...
 
void whoisMessage (View view)
 Gets the whois information for the host. This should be the registered response to the "whois" button. Note: The actual lookup is done on a separate thread. More...
 
void displayToast (String message)
 Displays a popup "Toast" message to the user. Displaying toasts from http://developer.android.com/guide/topics/ui/notifiers/toasts.html. More...
 
void displayMessageDialog (String message, String title)
 Displays a message dialog to the user. Displaying message dialogs from http://www.mkyong.com/android/android-alert-dialog-example/. More...
 

Static Public Attributes

static final String IP_ADDRESSES = "com.jburto2.androidlookup.IP_ADDRESSES"
 Stores the ip_addresses returned from LookupAddressTask. More...
 
static final String CNAME = "com.jburto2.androidlookup.CNAME"
 Stores the CNAME returned from LookupCNAMETask. More...
 
static final String LOOKUP_NAME = "com.jburto2.androidlookup.LOOKUP_NAME"
 Stores the hostname that the user enters on the main screen. More...
 
static final String PING_RESULTS = "com.jburto2.androidlookup.PING_RESULTS"
 Stores "Yes" or "No" result from LookupPingTask. More...
 
static final String WHOIS_INFO = "com.jburto2.androidlookup.WHOIS_INFO"
 Stores the whois request returned from WHOIS_INFO. More...
 

Protected Member Functions

void onCreate (Bundle savedInstanceState)
 Method called when activity is created. Sets the content view to activity_main. More...
 
String runLookupTask (LookupTask lookupTask, String lookupString)
 This function runs the various LookupTasks on a separate thread. Android does not allow network calls to be made on the main thread, thus the need to create an AsyncTask to do the work. More from http://stackoverflow.com/questions/6343166/android-os-networkonmainthreadexception. More...
 

Detailed Description

This class implements functionality for the main activity in Android Lookup. Start here.

Author
jburton

Definition at line 27 of file MainActivity.java.

Member Function Documentation

void com.jburto2.androidlookup.MainActivity.clearHostNameMessage ( View  view)

Clear the fields. This should be the registered response to the "clear" button for the Hostname button. Learned how to clear a field from http://stackoverflow.com/questions/8758635/how-to-clear-the-edittext-when-onclick-on-button.

Parameters
view

Definition at line 114 of file MainActivity.java.

public void com.jburto2.androidlookup.MainActivity.displayMessageDialog ( String  message,
String  title 
)

Displays a message dialog to the user. Displaying message dialogs from http://www.mkyong.com/android/android-alert-dialog-example/.

Parameters
messageMessage to display
titleTitle of dialog

Definition at line 311 of file MainActivity.java.

Referenced by com.jburto2.androidlookup.MainActivity.lookupMessage(), com.jburto2.androidlookup.MainActivity.runLookupTask(), and com.jburto2.androidlookup.MainActivity.whoisMessage().

public void com.jburto2.androidlookup.MainActivity.displayToast ( String  message)

Displays a popup "Toast" message to the user. Displaying toasts from http://developer.android.com/guide/topics/ui/notifiers/toasts.html.

Parameters
messageMessage to display

Definition at line 293 of file MainActivity.java.

public void com.jburto2.androidlookup.MainActivity.lookupMessage ( View  view)
protected void com.jburto2.androidlookup.MainActivity.onCreate ( Bundle  savedInstanceState)
protected

Method called when activity is created. Sets the content view to activity_main.

Parameters
savedInstanceState

Definition at line 65 of file MainActivity.java.

public boolean com.jburto2.androidlookup.MainActivity.onCreateOptionsMenu ( Menu  menu)

Inflate the menu; this adds items to the action bar if it is present.

Parameters
menuMeny to be created.
Returns
true

Definition at line 80 of file MainActivity.java.

public boolean com.jburto2.androidlookup.MainActivity.onOptionsItemSelected ( MenuItem  item)

Handles menu item selection. Only menu item here is the "action_about" for the info activity.

Parameters
itemMenuItem that was selected
Returns
true

Menu from http://developer.android.com/guide/topics/ui/menus.html#options-menu

Definition at line 94 of file MainActivity.java.

protected String com.jburto2.androidlookup.MainActivity.runLookupTask ( LookupTask  lookupTask,
String  lookupString 
)
protected

This function runs the various LookupTasks on a separate thread. Android does not allow network calls to be made on the main thread, thus the need to create an AsyncTask to do the work. More from http://stackoverflow.com/questions/6343166/android-os-networkonmainthreadexception.

Parameters
lookupTaskLookupTask that is being called
lookupStringString that is the hostname/ipaddress to be looked up.
Returns
Result of lookup
If lookup failed, display exception in a dialog and return null

Definition at line 259 of file MainActivity.java.

References com.jburto2.androidlookup.MainActivity.displayMessageDialog().

Referenced by com.jburto2.androidlookup.MainActivity.lookupMessage(), and com.jburto2.androidlookup.MainActivity.whoisMessage().

public void com.jburto2.androidlookup.MainActivity.whoisMessage ( View  view)

Gets the whois information for the host. This should be the registered response to the "whois" button. Note: The actual lookup is done on a separate thread.

Parameters
view

About progress bars: http://stackoverflow.com/questions/11099012/android-spin-refresh-button-while-reloading

Definition at line 200 of file MainActivity.java.

References com.jburto2.androidlookup.MainActivity.displayMessageDialog(), com.jburto2.androidlookup.MainActivity.runLookupTask(), and com.jburto2.androidlookup.MainActivity.WHOIS_INFO.

Member Data Documentation

public final static String com.jburto2.androidlookup.MainActivity.CNAME = "com.jburto2.androidlookup.CNAME"
static
public final static String com.jburto2.androidlookup.MainActivity.IP_ADDRESSES = "com.jburto2.androidlookup.IP_ADDRESSES"
static
public final static String com.jburto2.androidlookup.MainActivity.LOOKUP_NAME = "com.jburto2.androidlookup.LOOKUP_NAME"
static

Stores the hostname that the user enters on the main screen.

Definition at line 43 of file MainActivity.java.

Referenced by com.jburto2.androidlookup.MainActivity.lookupMessage(), and com.jburto2.androidlookup.DisplayLookupActivity.onCreate().

public final static String com.jburto2.androidlookup.MainActivity.PING_RESULTS = "com.jburto2.androidlookup.PING_RESULTS"
static
public final static String com.jburto2.androidlookup.MainActivity.WHOIS_INFO = "com.jburto2.androidlookup.WHOIS_INFO"
static

Stores the whois request returned from WHOIS_INFO.

Definition at line 53 of file MainActivity.java.

Referenced by com.jburto2.androidlookup.DisplayWhoisActivity.onCreate(), and com.jburto2.androidlookup.MainActivity.whoisMessage().


The documentation for this class was generated from the following file: