This Sample Code explain how to show another window of given url when button click in android.
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class MainWindowActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button button = (Button)findViewById(R.id.button1);
button.setOnClickListener(new OnClickListener() {
public void onClick(View arg) {
Intent viewIntent =
new Intent("android.intent.action.VIEW",
Uri.parse("https://google.com"));
startActivity(viewIntent);
}
});
}
}
Good start!
ReplyDeleteI saw your posts in stack overflow too,
Wish you all the best for your Programming Career :),
- A Friend
https://play.google.com/store/apps/details?id=com.igeniusdev.valentinecard
ReplyDelete