#2
月暗2013-03-19 21:27
On your buttons, you should set OnClickListener, and to do some required actions you could see the example below:
设置OnClickListener监听事件: To Open a Map with Certain Location // 打开特定地点的地图,使用以下代码: mapButton.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=" + your-location-geo-address)); startActivity(i); } }); To call certain number // 呼叫某个号码: callButton.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { Intent i = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + telephone-number)); startActivity(i); } }); To open a website // 打开web站点: linkButton.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(website-address)); startActivity(i); } }); Change "location-address", "telephone-number", and "website-address" with your own String value. I hope this helps. //使用你的字符串修改变量"location-address", "telephone-number", and "website-address" |
只有本站会员才能查看附件,请 登录
只有本站会员才能查看附件,请 登录
想要实现点击这个button就会跳出来一个网站,比如www.baidu.com.请问怎么写code?
[ 本帖最后由 wwyymm516 于 2013-3-5 12:56 编辑 ]