How to connect the text view to a website?

2020-03-31 07:38发布

Hi i am new to android and i have created a app which uses the google places api and lists a few department stores.

I have made the list clickable upon clicking the name of the department store i am starting a new activity which accesses a database that i created to give the recommended or discount products in that particular store.

What i need is that when i click on the name of the department store i want the app to redirect to the stores website and list all the recommended or discount products in that particular store.

1条回答
Ridiculous、
2楼-- · 2020-03-31 08:11
list.setOnItemClickListener(new OnItemClickListener() {

        public void onItemClick(AdapterView<?> arg0, View arg1, int position,
                long arg3) {
            String url=urls[position];
            Uri uri = Uri.parse(url);
            Intent intent = new Intent(Intent.ACTION_VIEW, uri);
            startActivity(intent);

        }
    });

Here you have to place all department urls in a seperate array called urls

查看更多
登录 后发表回答