android.widget.ShareActionProvider does not work on the emulator
2012-11-19 15:01
585 查看
from:http://code.google.com/p/android/issues/detail?id=25467
Reported by Lars.Vo...@gmail.com, Feb 13, 2012
Comment 1 by project member x...@android.com, Feb 23, 2012
Status:
Owner: ad...@android.com
Labels: -Component-Tools Component-Framework
Comment 2 by jakewhar...@gmail.com, Mar 29, 2012
Comment 3 by buz...@gmail.com, Mar 30, 2012
Comment 4 by Lars.Vo...@gmail.com, Mar 30, 2012
Comment 5 by project member ad...@android.com, Mar 30, 2012
Owner: svetosla...@android.com
Comment 6 by dfuern...@gmail.com, Jun 7, 2012
Comment 7 by digi...@gmail.com, Aug 1, 2012
Comment 8 by digi...@gmail.com, Aug 1, 2012
Reported by Lars.Vo...@gmail.com, Feb 13, 2012
If I add a ShareActionProvider to my application it works file on a real device but not on the emulator. If I press the Share button in the emulator nothing happens. Here is my menu: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+id/menu_share" android:title="Share" android:showAsAction="ifRoom" android:actionProviderClass="android.widget.ShareActionProvider" /> <item android:id="@+id/item1" android:showAsAction="ifRoom" android:title="Hello"> </item> <item android:id="@+id/item2" android:showAsAction="ifRoom" android:title="This will not fit in the Action bar"> </item> </menu> I add this menu to my Activity: @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.mymenu, menu); provider = (ShareActionProvider) menu.findItem(R.id.menu_share) .getActionProvider(); doShare(); return true; } public void doShare() { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, "Message"); provider.setShareIntent(intent); }
Comment 1 by project member x...@android.com, Feb 23, 2012
(No comment was entered for this change.)
Status:
Owner: ad...@android.com
Labels: -Component-Tools Component-Framework
Comment 2 by jakewhar...@gmail.com, Mar 29, 2012
This is due to their only being a single (or zero) applications which support that intent. If this is the case the provider will not allow any interaction. It would be nice if there was a Toast or the dropdown still showed with a message of some sort.
Comment 3 by buz...@gmail.com, Mar 30, 2012
I agree with Jake : this is because the emulator do not have many apps that can answer the intent.
Comment 4 by Lars.Vo...@gmail.com, Mar 30, 2012
SMS app is available and this accepts Intent.ACTION_SEND. If I trigger this directly it also works. Hence I suspect still a bug.
Comment 5 by project member ad...@android.com, Mar 30, 2012
(No comment was entered for this change.)
Owner: svetosla...@android.com
Comment 6 by dfuern...@gmail.com, Jun 7, 2012
If you add another app (see attachment for example) to your emulator supporting ShareIntents of type text/plain and accepting Intent.ACTION_SEND, the ShareProvider will work. It then also displays the already mentioned Messaging App. This however should be considered a workaround.
Comment 7 by digi...@gmail.com, Aug 1, 2012
I can reproduce this bug too, and the weird thing is it works if you've opened the list at least once, with at least two intents. For example: Two activities: Open list. Change intent to one that resolves to one activity. Open list: Still works. It doesn't work if you haven't yet opened it.
Comment 8 by digi...@gmail.com, Aug 1, 2012
Seems related to these lines in ActivityChooserView$ActivityChooserViewAdapter: if (!mShowDefaultActivity && mDataModel.getDefaultActivity() != null) { activityCount--; } IF you haven't opened the list yet, activityCount gets subtracted by 1, getCount() returns 0 and the button gets disabled. The list still contains one activity. The title should be changed, because this doesn't really have anything to do with the emulator and affects real production devices. Even if there's only 1 activity, it should still be shown instead of disabling the button.
相关文章推荐
- Android Studio编译后安装apk报错:The APK file does not exist on disk
- BUG: The Submit button on ASP.NET pages does not work after you install the .NET Framework 1.1 Service Pack 1
- Android Studio编译后安装apk报错:The APK file does not exist on
- 我的Android进阶之旅------>解决Android Studio编译后安装apk报错:The APK file does not exist on disk
- Starting the application on Mac does not work(拷贝platforms到不同的位置,才能解决问题),还可设置DYLD_PRINT_LIBRARIES=1 观察动态库
- linux c语言 rename的用法-rename() does not work across different mount points, even if the same file system is mounted on both
- Setting title-center on "< h1> " element on Android does not work, fix
- Android Studio The APK file does not exist on disk
- Android 错误(The APK file *.apk does not exist on disk Error while Installing APK)解决方法
- Unable to find a javac compiler; com.sun.tools.javac.Main is not on the classpath.Perhaps JAVA_HOME does not point to the JDK
- Android 错误:IllegalStateException: Can not perform this action after onSaveInstanceState
- MyContentProvider does not specify a android.test.InstrumentationTestRunner instrumentation or does
- toolbar使用时显示AppCompat does not support the current theme features: { windowActionBar: false, windowA
- run on server的时候,报出The server does not support version 3.0 of the J2EE Web module specification
- android异常:Can not perform this action after onSaveInstance
- Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine 错误解决
- android.intent.action.CAMERA_BUTTON not broadcasting on Desire Z (Froyo)?
- android用gdb调试时遇到报错: ERROR: The device does not support the application's targetted CPU ABIs!
- 解决Android Studio编译后安装apk报错:The APK file does not exist on disk
- A workgroup installation computer does not support the operation