How to connect the text view to a website?

会有一股神秘感。 提交于 2019-12-01 13:02:23

问题


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:


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



来源:https://stackoverflow.com/questions/14473242/how-to-connect-the-text-view-to-a-website

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!