How to start and App Chooser

前端 未结 5 1075
春和景丽
春和景丽 2021-01-13 07:09

The task of this application is to implicitly activate a separate application to view the URL, “http:// www.google.com”. So, App Chooser should appear and let me choose betw

5条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-13 07:29

    Here's how I am doing:

    Step 1: First in the strings,

    <a href="http://www.google.com">SomeLink</a>
    

    Step 2: My Layout:

    
    
    
        
    
    
    

    Step 3: Getting the link from the strings.

    public class OpenWeb extends Activity {
    
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            // TODO Auto-generated method stub
            super.onCreate(savedInstanceState);
            setContentView(R.layout.webopen);
    
            TextView someLink = (TextView)findViewById(R.id.textView1);
            if(someLink!=null){
    
                someLink.setMovementMethod(LinkMovementMethod.getInstance());
                someLink.setText(Html.fromHtml(getResources().getString(R.string.webklink)));
            }
    
        }
    }
    

    Hope this helps..:)

提交回复
热议问题