2010-11-03 54 views

回答

0

我不確定您的意思是書籤。也許這個教程可以幫助嗎?

http://www.tutorialforandroid.com/2009/04/open-urlwebsite-from-android.html

這是啓動指向一個網頁瀏覽器的應用程序。這是你想到的嗎?

靈光

+0

謝謝你的回覆,但我腦海中有一個書籤放置在你的主屏幕上,你可以從那裏啓動網站。如果您在Android中打開瀏覽器並轉到書籤,則實際上可以將該書籤的快捷方式放置到主屏幕上。還有什麼想法?謝謝 – dackyD 2010-11-04 08:29:50

0

我覺得這是不可能的,因爲如果是,垃圾郵件發送者可以垃圾郵件的主屏幕,鏈接到他們的垃圾:d

2

這工作對我解釋 - 添加到許可體現

<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" /> 

使用下面的代碼:

public void createGoogleSearchShortcut(Context context) { 
    String urlStr = String.format(context.getString(R.string.homescreen_shortcut_search_url), context.getString(R.string.app_id)); 
    Intent shortcutIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(urlStr)); 
    // shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 

    Intent intent = new Intent(); 
    intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent); 
    // Sets the custom shortcut's title 
    intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, context.getString(R.string.search)); 
    // Set the custom shortcut icon 
    intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(context, R.drawable.ic_action_search)); 
    intent.putExtra("duplicate", false); 

    // add the shortcut 
    intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT"); 
    context.sendBroadcast(intent); 

} 

請注意:我強烈建議在添加書籤之前詢問用戶。沒有他的許可將書籤添加到他的主屏幕是「不禮貌」...