diff options
Diffstat (limited to 'Android/02-Intents/MyBrowser/src/course/labs/intentslab/MyBrowserActivity.java')
-rw-r--r-- | Android/02-Intents/MyBrowser/src/course/labs/intentslab/MyBrowserActivity.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Android/02-Intents/MyBrowser/src/course/labs/intentslab/MyBrowserActivity.java b/Android/02-Intents/MyBrowser/src/course/labs/intentslab/MyBrowserActivity.java new file mode 100644 index 0000000..e165ea2 --- /dev/null +++ b/Android/02-Intents/MyBrowser/src/course/labs/intentslab/MyBrowserActivity.java @@ -0,0 +1,24 @@ +package course.labs.intentslab.mybrowser; + +import android.app.Activity; +import android.os.Bundle; +import android.widget.TextView; + +public class MyBrowserActivity extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.my_browser_activity); + + // Save the String passed with the intent + String url = getIntent().getDataString(); + + if (null == url) + url = "No Data Provided"; + + // Get a reference to the TextView and set the text it to the String + TextView textView = (TextView) findViewById(R.id.url); + textView.setText(url); + } +} |