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.
分享到:
相关推荐
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...
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...
用于一些依赖于系统Unicode语言或非Unicode语言的软件或游戏,这个软件可以让这些软件和游戏成功运行。
TEAM.R2R.Roland.Cloud.Emulator.v1.1.0-R2R
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.......
可以自动切换应用程序的语言
Locale.Emulator.1.2.0.1.zip
转区
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
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 ...
有强迫症的程序猿们,windows下Android AVD 没图标的,拿这个替换tools下同文件
Beginning with detailed instructions on how to install and configure the Android SDK, Studio, and Virtual Device Manager, the book moves on to creating a simple, but working, "Hello World" app that ...
6 Using the Command-Line Tools and the Android Emulator . . . . . . . . . . . . 83 Creating a Shell Activity Using the Windows CLI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 Running ...
解决android studio中“HAXM is not working and emulator runs in emulation mode”的提示,使用前提电脑的BIOS设置为VT-x模式
Running Your Android Application in the Emulator 76 Debugging Your Android Application in the Emulator 80 Adding Logging Support to Your Android Application 83 Adding Some Media Support to Your ...
6 Using the Command-Line Tools and the Android Emulator . . 83 7 Using Intents and the Phone Dialer . . . 117 8 Lists, Menus, and Other Views . 149 9 Using the Cell Phone’s GPS Functionality . . ...
Build compelling Java-based mobile applications using the Android SDK and the Eclipse open-source software development platform.... Test applications using the Android Emulator and Debug Bridge
11:43 Emulator: [5984]:ERROR:android/android-emu/android/qt/qt_setup.cpp:28:Qt library not found at D:\AndroidSDK\emulator\lib64\qt\lib 11:43 Emulator: Could not launch 'D:\AndroidSDK\emulator/qemu/...