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.
pva-sharetarget.zip
147 KB Download
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.
Comment 9 by adla...@gmail.com, Dec 10 (6 days ago)
I wonder, based on the title, whether this bug is as visible as it should be. Is there a way to update the title to more closely reflect the nature of the bug?
I can imagine that emulator-related bugs hover somewhere near the bottom of the priority list, and this is not an emulator-only bug. A proper title might also help with searching, which might prevent a few developers from spending 3 hours wondering why their shiny new share button just... does... nothing.
分享到:
相关推荐
**Android SDK中的emulator.exe详解** 在Android应用开发过程中,Android SDK(Software Development Kit)扮演着至关重要的角色。它提供了一系列工具,使得开发者能够在没有实际设备的情况下,通过模拟器(Android...
本次我们关注的是“Locale.Emulator.2.4.1.0”版本,这个小巧而强大的工具能够帮助用户顺利地运行那些对Unicode或非Unicode语言有严格依赖的应用程序。 区域模拟器的主要功能在于其转区机制。在Windows操作系统中,...
Locale Emulator is a tool similar to MS AppLocale and NTLEA, providing a simulation function that can make an application recognize your OS as in a language other than the real one. It is quite useful...
【Locale.Emulator.2.3.1.1.rar】是一个用于解决地区限制问题的工具,主要用于帮助用户在不改变系统区域设置的情况下运行特定地域版本的应用程序或游戏。这个压缩包包含的是“Locale Emulator”软件的版本2.3.1.1。...
标题 "Locale.Emulator.2.5.0.1.zip" 指的是 Locale Emulator 的一个特定版本,这是由 Microsoft 开发的一款实用工具,旨在帮助用户在不支持特定语言环境的操作系统上运行那些需要特定区域设置的应用程序。...
Android, the next-generation open mobile platform from Google and the Open Handset Alliance, is poised to become a significant player in the mobile device market. The Android platform gives developers...
1.3 Running on the Emulator.... . 23 1.4 Running on a Real Phone.... . 28 1.5 Fast-Forward >>.....29 2 Key Concepts 30 2.1 The Big Picture.....30 2.2 It’s Alive!......35 2.3 Building Blocks.......
TEAM.R2R.Roland.Cloud.Emulator.v1.1.0-R2R
"android terminal emulator.apk"是一款专为Android设备设计的终端模拟器,它允许用户在手机或平板电脑上运行Linux命令行工具,如ADB(Android Debug Bridge)。对于开发者来说,这是一个极其实用的工具,可以无需...
【Locale.Emulator.1.2.0.1.zip】是一个软件压缩包,其中包含的“Locale Emulator”是一款用于Windows系统的工具,旨在帮助用户在不改变系统全局区域设置的情况下,运行那些要求特定地区设置的应用程序。这个工具...
android studio中文路径错误中的解决方案3所需资源,下载此文档,在你所报错误的路径下新建一个错误提示的文件夹,将此文件复制到文件夹下,即可
Locale Emulator 是运行在 Windows 7 和 Windows 8/8.1 和WIN10系统下的一个软件,可以提供类似 NTLEA 和 AppLocale 的转区功能:即将系统区域设置(包括语言,时区,代码页等)虚拟为目标系统(例如日本区域)。...
OS.Build Reader This is a development tool to show values of android.os.Build.* ...For more information about how to manage AVDs, see developer.android.com Startup emulator now, startup your avd using
描述中提到的“HAXM is not working and emulator runs in emulation mode”是Android Studio用户在尝试运行模拟器时可能会遇到的一个常见问题。这通常意味着HAXM未正确安装或启用,或者计算机的BIOS设置不支持VT-x...
android-sdk_r11-windows 中提取的emulator.exe 用于解决android-sdk_r16-windows中emulator.exe 任务栏 图标 异常问题。将原emulator.exe 改名或用此文件直接替换。
This isn't a game emulator. This won't help you root your phone or change your phone's IMIE. You need to know (or be willing to learn) how to use Linux command line to use this program. You may want ...
而“emulator.exe”是这个目录下的一个重要组件,它是Android模拟器的执行程序,允许开发者在没有实体设备的情况下运行和测试Android应用。 当我们更新Android SDK后,可能会遇到一些问题,比如任务栏图标显示异常...
例如,使用BlueStacks、Genymotion或Google官方的Android Emulator,开发者和安全研究人员可以在桌面环境中运行Android应用,方便进行功能测试、性能评估或安全审计。对于"Image Kitchen for Android.apk",通过...
该错误是由于模拟器未关闭或非法关闭所致,解决方法是删除 C:Documents and Settings/Administrator/.android/avd 对应版本.avd 下所有以.lock 结尾的文件夹,或者在 Window-Preferences-Android-DDMS-ADB ...