summaryrefslogtreecommitdiffstats
path: root/Android/02-Intents/MyBrowser/src/course/labs/intentslab/MyBrowserActivity.java
blob: e165ea2851471df835a46ffcba957c44833c88f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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);
    }
}