我有以下代码来查看远程托管的视频文件:
startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse(article.getLink())));
Run Code Online (Sandbox Code Playgroud)
其中getLink()返回与文章关联的视频的URL.
这种方法在Gingerbread上的设备上运行良好,但我最近一直在ICS上测试应用程序并发现了一个问题.ICS浏览器开始加载URL,我在导航栏中看到它,但几乎立即浏览器关闭,我被带回我的应用程序的活动.
当它发生时,我得到以下堆栈跟踪:
11-28 10:24:44.488: E/SurfaceTexture(116): [com.mypackage.myapp/com.mypackage.myapp.MyVideoActivity] connect: already connected (cur=2, req=2)
11-28 10:24:44.488: E/ViewRootImpl(25384): IllegalArgumentException locking surface
11-28 10:24:44.488: E/ViewRootImpl(25384): java.lang.IllegalArgumentException
11-28 10:24:44.488: E/ViewRootImpl(25384): at android.view.Surface.lockCanvasNative(Native Method)
11-28 10:24:44.488: E/ViewRootImpl(25384): at android.view.Surface.lockCanvas(Surface.java:76)
11-28 10:24:44.488: E/ViewRootImpl(25384): at android.view.ViewRootImpl.draw(ViewRootImpl.java:1924)
11-28 10:24:44.488: E/ViewRootImpl(25384): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1613)
11-28 10:24:44.488: E/ViewRootImpl(25384): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2418)
11-28 10:24:44.488: E/ViewRootImpl(25384): at android.os.Handler.dispatchMessage(Handler.java:99)
11-28 10:24:44.488: E/ViewRootImpl(25384): at android.os.Looper.loop(Looper.java:137)
11-28 10:24:44.488: E/ViewRootImpl(25384): at android.app.ActivityThread.main(ActivityThread.java:4340)
11-28 10:24:44.488: E/ViewRootImpl(25384): at java.lang.reflect.Method.invokeNative(Native Method)
11-28 10:24:44.488: E/ViewRootImpl(25384): at java.lang.reflect.Method.invoke(Method.java:511)
11-28 …Run Code Online (Sandbox Code Playgroud) 众所周知,在WebView中获取所选文本很困难,因为WebView文本选择实际上是由私有类WebTextView处理的.
然而,随着最近发布的Android 4.0设计指南,通过上下文操作栏(CAB)实现这一点似乎有一线希望.它说:
只要您允许用户通过长按选择数据,请使用CAB.您可以控制CAB的操作内容,以插入您希望用户能够执行的操作.
我误解了这个吗?有没有办法通过CAB从WebView检索所选文本?
在长时间单击和文本选择模式开始后,我当前可以检测到何时ActionMode启动并修改原始复制/粘贴Menu; 但是,我无法弄清楚如何实际检索所选文本.
android webview android-4.0-ice-cream-sandwich android-actionbar
我们正在构建一个Android 4.0应用程序,顶部带有选项卡式导航.这一切都在纵向模式下工作得很好但是当应用程序更改为横向模式(我们想要支持)时,默认行为是选项卡向上移动到顶部/操作栏,这似乎消除了获得屏幕标题的能力显示并且似乎拥挤在顶部/操作栏右侧显示的操作.
什么是防止这种情况的最佳方法以及覆盖此默认行为有多困难?
layout tabs android landscape android-4.0-ice-cream-sandwich
我目前正在尝试向我的应用程序添加一个小部件,并将我的实现基于此代码http://developer.android.com/resources/samples/StackWidget/index.html
我已将所有与堆栈小部件相关的类放在我的主包中的自己的包中.
当我尝试添加小部件时,它无法绑定,因此不显示卡(它只是声明默认文本"这是空视图")
以下是我的清单.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bencallis.dealpad" android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="11" android:targetSdkVersion="14" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application android:icon="@drawable/ic_launcher"
android:logo="@drawable/logo" android:theme="@style/DealPadTheme"
android:hardwareAccelerated="true" android:uiOptions="splitActionBarWhenNarrow">
<activity android:label="@string/app_name" android:name=".DealPadActivity"
android:configChanges="keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".SettingsActivity" />
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
<!-- Widgets -->
<receiver android:name=".stackwidget.StackWidgetProvider">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="@xml/stackwidgetinfo" />
</receiver>
<service android:name="stackwidget.StackWidgetService"
android:permission="android.permission.BIND_REMOTEVIEWS"
android:exported="false" />
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)
错误信息:
E/RemoteViewsAdapterServiceConnection(474): bind(): Unknown component ComponentInfo{com.bencallis.dealpad/com.bencallis.dealpad.stackwidget.StackWidgetService} …Run Code Online (Sandbox Code Playgroud) android android-widget android-3.0-honeycomb android-4.0-ice-cream-sandwich
有没有人知道如何进入快速启动模式为运行ICS的allwinner a10平板电脑?
adb reboot fastboot
Run Code Online (Sandbox Code Playgroud)
似乎只是正常重启它.
是否有一个关键组合将它带到fastboot?
我有一个BackgroundReceiver设置来接收android.intent.action.USER_PRESENT清单文件中的:
<receiver android:name="com.demo.MyBroadcastReceiver">
<intent-filter>
<action android:name="android.intent.action.USER_PRESENT" />
</intent-filter>
</receiver>
Run Code Online (Sandbox Code Playgroud)
我的重写onReceive(Context, Intent)方法很简单:
@Override
public void onReceive(Context context, Intent intent)
{
if (intent != null)
{
if (Intent.ACTION_USER_PRESENT.equals(intent.getAction())
{
// wrapper for Log.d(String, String)
Dbug.log("MyBroadcastReceiver: [" + intent.getAction() + "]");
// this calls a service
serviceExample(context, intent);
}
}
}
Run Code Online (Sandbox Code Playgroud)
问题:
android android-intent android-3.0-honeycomb android-4.0-ice-cream-sandwich
我有一个包含所有联系人的CSV文件(从Thunderbird导出).
在我的手机上我安装了Android 4冰淇淋三明治.
如何在不使用任何"间谍软件"(google,facebook,outlook等)的情况下将CSV文件中的联系人导入我的Android手机(sony ericson Xperia Ray)?
只需将久经考验的ADK配件连接到Nexus 7和Galaxy Nexus,它就无法连接"无法读取设备协议版本"消息.认为董事会死了,与ICS连接到Nexus S - 工作得很好.在Jelly Bean升级之前就开始使用Galaxy Nexus,因此可以排除硬件故障.
我一直在密切关注ADK公告,但不记得阅读或听到有关此特定更改的任何内容,也不记得支持ADK 2.0的Android设备的向后兼容性.
附件开发工具包2011指南说"Android 2.3.4(API级别10)及更高版本支持协议版本1.安卓4.1(API级别16)及更高版本支持协议版本2",它没有说版本1是不是 4.1的支持,这将是非常奇怪的发现,现有的硬件将被抛弃就这样.
我在这里错过了什么?这是一个错误还是一个功能?
android arduino adk android-4.0-ice-cream-sandwich android-4.2-jelly-bean
这是一个我只面临> Android 4.0设备的问题.
目前我有一个listView和一个自定义标题,我添加了ListActivity的onCreate().
我在应用程序中将editText用作自定义searchBar.
以下是一个代码片段,希望能够解释我的实现.
private ListView lst_Reports = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.showreportlist);
lst_Reports = (ListView) findViewById(R.id.VuoShowReportsActivity_Lst_Reports);
/*
* Initialize UI
*/
LinearLayout headerView = (LinearLayout) View.inflate(this, R.layout.report_list_header, null);
EditText reportSearchBar = (EditText) headerView.findViewById(R.id.reportSearchBar);
lst_Reports.addHeaderView(headerView);
reportSearchBar.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
public void onTextChanged(CharSequence s, int start, int before, int count) {
// do a search as and when … 我有一个GridView,可以显示您图库中的图像.当用户滚动列表时,有关图像的详细信息将从左侧生成动画.我在定义GridView项的自定义布局的类中实现了它.它扩展了LinearLayout.
OnScrollChangedListener mScrollListener = new OnScrollChangedListener() {
@Override
public void onScrollChanged() {
if (!getGlobalVisibleRect(r)) {
resetAnimation();
} else {
if (checkBounds()) {
showInfo();
}
} else {
hideInfo();
}
Run Code Online (Sandbox Code Playgroud)
方法resetAnimation()重置动画,如果它的视图在屏幕上不可见.方法checkBounds()将Rect get与getGlobalVisibleRect(r)和表示屏幕的Rect 进行比较,以检查是否应显示详细信息View.
我在onFinishInflate()中添加了这样的监听器:
getViewTreeObserver().addOnScrollChangedListener(mScrollListener);
Run Code Online (Sandbox Code Playgroud)
现在实际问题:API 19,API 18,API 17和API 13
上的一切正常,在真实设备和仿真器上都经过测试.在API 14(Android 4.0.1和4.0.2)上,onScrollChanged()永远不会在物理设备和模拟器上被触发.
这是一个错误还是我错过了什么?