How to add a website link in android through touch button

user2846367

I have written this android code but its not working or showing anything when clicked. I have no XML activity in this code for this.

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;
}

Please help me to solve the problem.

A.S.

if you want to open a Browser with this URL just follow the answers of this question Sending an Intent to browser to open specific URL

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How do I add an "Add to Favorites" button or link on my website?

How to get a link from a website Button in Android Java

How to link button with website in android studio using kotlin

how can i set a link in website to button

How to add navigation button link in button in SwiftUI?

How to add clickable website link into Snackbar?

How to add official website link? In Huawei AGC

How to touch the overflow button in calabash-android?

Using a button to link a website

How to add facebook share button on my website?

How android app can be generated through website?

How do I add or remove roles on my Discord JS server, through a button click I have on my website or localhost?

How to link user wise sale order with website menu through code

Link a button through CSS

How do i add a link to this animated button

Fullcalendar: How to add 'link' item to custom button

How to add link to facebook Like button

How to add a button in gridview to link to web page?

How can i add hover button to the link

How to add a variable as the link of the Sendgrid button

How to add a "Done" button with in the DatePicker Through StoryBoard?

How to add a fixed button over sencha touch carousel

How to loop through a website and click on things that are not a button Selenium | BeautifulSoup

How to disable google maps touch events through a layout? (android)

How to detect touch on a devise through Javascript across Android and iOS?

Android ImageView link to a Website

touch button - how to?

How to add a menu to a button in Android

How to add an image to a button in android

TOP Ranking

HotTag

Archive