如何通过触摸按钮在android中添加网站链接
我已经写了这个安卓代码,但它没有工作或显示任何东西时点击。我在这段代码中没有XML活动如何通过触摸按钮在android中添加网站链接,android,web,touch,hyperlink,Android,Web,Touch,Hyperlink,我已经写了这个安卓代码,但它没有工作或显示任何东西时点击。我在这段代码中没有XML活动 public Pro(Game game) { super(game); } @Override public void update(float deltaTime) { Graphics g = game.getGraphics(); List<TouchEvent> touchEvents = game.getInput().getTouchEvents();
public Pro(Game game) {
super(game);
}
@Override
public void update(float deltaTime) {
Graphics g = game.getGraphics();
List<TouchEvent> touchEvents = game.getInput().getTouchEvents();
int len1 = touchEvents.size();
for (int i = 0; i < len1; i++) {
TouchEvent event = touchEvents.get(i);
if (event.type == TouchEvent.TOUCH_UP) {
if (inBounds(event, 550, 350, 350, 450)) {
try {
URI uri = new URI("www.google.com");
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
}
private boolean inBounds(TouchEvent event, int x, int y, int width,
int height) {
if (event.x > x && event.x < x + width - 1 && event.y > y
&& event.y < y + height - 1)
return true;
else
return false;
}
public-Pro(游戏){
超级(游戏);
}
@凌驾
公共无效更新(浮动增量时间){
Graphics g=game.getGraphics();
List touchEvents=game.getInput().getTouchEvents();
int len1=touchEvents.size();
对于(int i=0;ix&&event.xy
&&事件y
请帮我解决这个问题。如果您想使用此URL打开浏览器,请按照此问题的答案进行操作
如果您想使用此URL打开浏览器,只需遵循此问题的答案即可 URI=newuri(“www.google.com”);这根本不起作用 startActivity(新的意图(Intent.ACTION_视图,Uri.parse(“”)) URI=newuri(“www.google.com”);这根本不起作用 startActivity(新的意图(Intent.ACTION_视图,Uri.parse(“”))