hi,i want to redirect to particular URL while clicking on button
+3
A:
You can start a 'view' activity, which would be the browser given a URL:
public class HelloWorld extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Assuming you are using xml layout
Button button = (Button)findViewById(R.id.Button01);
button.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
Intent viewIntent =
new Intent("android.intent.action.VIEW",
Uri.parse("http://www.stackoverflow.com/"));
startActivity(viewIntent);
}
});
}
}
Maxwell Troy Milton King
2010-02-10 11:54:17
Thank you very much it's working
deepthi
2010-02-10 11:59:10
A:
very nice, there is a way to send a URL but without showing the response in a navigator, o receive the response ina string so you can analizite. thank you
htcdroid
2010-02-18 14:16:14
If the intent is set to 'android.intent.action.VIEW' and a URI scheme of http:, il will launch the web browser. If the scheme is mailto:, it will launch the mail client ...http://developer.android.com/intl/fr/reference/android/content/Intent.html#ACTION_VIEW
ccheneson
2010-02-18 14:32:03