****************ConnectUrlActivity.java*************
package com.sampleapp;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.net.Uri;
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;
public class SampleAppActivity extends Activity {
/** Called when the activity is first created. */
private Button btn_go;
AlertDialog alertDialog;
EditText nw_name;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
btn_go = (Button) findViewById(R.id.btn_go);
btn_go.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
String url = "http://www.google.com";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
i.setData(Uri.parse(url));
startActivity(i);
}
});
}
}
No comments:
Post a Comment