Android 选择共享菜单时如何从浏览器获取html代码

Android 选择共享菜单时如何从浏览器获取html代码,android,android-intent,browser,android-manifest,android-browser,Android,Android Intent,Browser,Android Manifest,Android Browser,我正在尝试制作一个应用程序,当我选择共享菜单并选择我的应用程序时,它将显示我当前在浏览器中查看的url和页面标题 这是manifest.xml中的my Intent筛选器: intent-filter action android:name="android.intent.action.SEND" category android:name="android.intent.category.DEFAULT" data android:mimeType="text/plain" int

我正在尝试制作一个应用程序,当我选择共享菜单并选择我的应用程序时,它将显示我当前在浏览器中查看的url和页面标题

这是manifest.xml中的my Intent筛选器:

intent-filter

action android:name="android.intent.action.SEND"

category android:name="android.intent.category.DEFAULT" 

data android:mimeType="text/plain" 

intent-filter
这是我的活动中的代码:

public void onCreate(Bundle savedInstanceState) {    
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    TextView text = (TextView) this.findViewById(R.id.url_text);
    Intent intent = getIntent();
    if (savedInstanceState == null && intent != null) {
        Log.d(TAG, "intent != null");
        if (intent.getAction().equals(Intent.ACTION_SEND)) {
            Log.d(TAG, "intent.getAction().equals(Intent.ACTION_SEND)");
            url = intent.getStringExtra(Intent.EXTRA_TEXT);
            text.setText(url);          
        }
    }
}
}
这段代码用于获取页面的url,但我不知道如何获取在浏览器中查看的页面的标题。其中一种方法是使用HttpResponse执行一个新请求,然后获取页面内容并通过搜索获取标题。有没有更简单的方法来查找页面的标题


任何帮助都将不胜感激。谢谢。

我想你应该在
EXTRA\u主题中找到这个标题。
Intent
EXTRA。

谢谢。我所要做的就是添加一行title=intent.getStringExtra(intent.EXTRA\u SUBJECT);