我有一个C#Windows服务.该OnStart()方法包含3行,他们所做的只是启动一个线程.类本身没有会导致延迟的静态对象.它就像服务一样简单.我的代码由自制密钥签名.
编辑:我只是发现装配没有签名,剩下的就是.它使用了一些已签名的程序集,但服务本身却没有.
此代码在虚拟机内运行,只要主机运行缓慢并且此VM正在启动,该服务将无法启动此错误:
等待ServiceName服务连接时达到超时(30000毫秒).
将服务设置为延迟启动会修复它,但这是一个很长的延迟,这非常烦人.有没有其他人有.NET服务(2.0)这个问题?
OnStart方法:
protected override void OnStart(string[] args)
{
Thread startThread = new Thread(new ThreadStart(StartThread));
startThread.IsBackground = true;
startThread.Start();
}
Run Code Online (Sandbox Code Playgroud)
StartThread方法,其中我所做的就是调用另一个类,以便OnStart不必等待静态变量初始化或结束构造函数方法.
private void StartThread()
{
Worker mainThread = new Worker(this);
mainThread.RunWorker();
}
Run Code Online (Sandbox Code Playgroud)
谢谢.
是否可以更改 chromecast 发送到服务器的用户代理?
我正在尝试加载移动视频,服务器要求用户代理来自移动设备。
谢谢。
有没有人在Android上看过这个例外?我开始从用户那里得到一些关于crashlytics的报告.
Fatal Exception: java.lang.NullPointerException
com.google.android.gms.analytics.w$b.run
java.util.Timer$TimerImpl.run (Timer.java:284)
Run Code Online (Sandbox Code Playgroud)
谢谢.
我有一个AppCompatAutoCompleteTextView锚比一个更低的锚AppCompatAutoCompleteTextView.这是设计使然无法更改的.当我在下拉列表上滚动时,下拉列表向上移动并在上方AppCompatAutoCompleteTextView.
这是应该的方式吗?
这是我的代码:
主要活动xml:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.autocompletetest.MainActivity">
<android.support.v7.widget.AppCompatAutoCompleteTextView
android:id="@+id/autocomplete"
android:layout_width="match_parent"
android:layout_height="32dp"
android:layout_gravity="center"
android:layout_marginLeft="8dp"
android:layout_weight="1"
android:alpha="0.87"
android:background="#ffffff"
android:dropDownWidth="match_parent"
android:dropDownAnchor="@+id/anchor"
android:gravity="center_vertical"
android:hint="entervalue"
android:inputType="textUri"
android:popupBackground="@null"
android:selectAllOnFocus="true"
android:singleLine="true"
android:textColor="#000000"
android:textSize="14sp"
android:layout_alignParentTop="true"
android:textColorHint="#000000"
/>
<View
android:layout_width="match_parent"
android:layout_height="5dp"
android:layout_marginTop="3dp"
android:layout_below="@+id/autocomplete"
android:id="@+id/anchor"
android:background="#aaaaaa"/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
主要活动java:
AppCompatAutoCompleteTextView auto = (AppCompatAutoCompleteTextView) findViewById(R.id.autocomplete);
String[] countries = getResources().getStringArray(R.array.colors);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,countries);
auto.setAdapter(adapter);
Run Code Online (Sandbox Code Playgroud)
编辑:我应该提到我在棉花糖上看到了这种行为.
android android-layout android-support-library android-design-library
我在Crashlytics报道了这个奇怪的崩溃.我自己从未复制过.它只发生在Android 6.0.1上.整个堆栈跟踪没有我的一行代码,所以我不知道在哪里开始跟踪它.有任何想法吗?
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Editor$SelectionModifierCursorController.enterDrag()' on a null object reference
at android.widget.Editor.selectCurrentWordAndStartDrag(Editor.java:1773)
at android.widget.Editor.performLongClick(Editor.java:1026)
at android.widget.TextView.performLongClick(TextView.java:9230)
at android.view.View$CheckForLongPress.run(View.java:21129)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5422)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Run Code Online (Sandbox Code Playgroud) 我有一个 Android 浏览器,我可以选择清除缓存、存储、cookie 等。
代码如下所示:
webView.clearCache(true);
webView.clearFormData();
webView.clearHistory();
webView.clearSslPreferences();
CookieManager.getInstance().removeAllCookies(null);
CookieManager.getInstance().flush();
Run Code Online (Sandbox Code Playgroud)
这似乎适用于我的所有测试,但是当我去 google.com 时,我的旧搜索仍然存在。我没有清除什么?
谢谢。
我有以下标记:
<h:graphicImage value="Circle_Yellow.png" library="images" />
Run Code Online (Sandbox Code Playgroud)
在我的文件夹中,我有以下结构:
/resources/images/.....
/WEB-INF/....
/*.xhtml
Run Code Online (Sandbox Code Playgroud)
渲染时,该图像显示为:
<img src="Circle_Yellow.png">
Run Code Online (Sandbox Code Playgroud)
但是,我确实看到了其他使用资源的东西
<script type="text/javascript" src="/www/javax.faces.resource/jquery/jquery.js.xhtmlln=primefaces"></script>
Run Code Online (Sandbox Code Playgroud)
如果我去/www/javax.faces.resource/Circle_Yellow.png?ln=images它的工作.
那么,在h:graphicImage中我的库被忽略,我可能做错了什么呢?此外,它不仅仅是一个图像,我有一个失败的CSS文件.
我正在使用mojarra 2.1.16和primefaces 3.4.1.
我正在制作一个应用程序,需要能够浏览到几个网站,其中一个网站可能是vine.co. 无论如何,它几乎加载每个网站都很好,但是当我去测试vine.co时,它不会显示任何东西.我从头开始编写一个webview示例来尝试它,并遇到了同样的问题.我在4.3和4.4上尝试过.
WebView wv = (WebView) findViewById(R.id.webview);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
if (0 != (getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE)) {
wv.setWebContentsDebuggingEnabled(true);
}
}
WebSettings settings = wv.getSettings();
settings.setJavaScriptEnabled(true);
settings.setJavaScriptCanOpenWindowsAutomatically(true);
// settings.setBuiltInZoomControls(true);
settings.setSupportMultipleWindows(true);
settings.setLoadWithOverviewMode(true);
settings.setUseWideViewPort(true);
//settings.setMediaPlaybackRequiresUserGesture(true);
wv.setWebChromeClient(new WebChromeClient() {
});
wv.setWebViewClient(new WebViewClient(){
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
}
});
wv.loadUrl("https://vine.co");
Run Code Online (Sandbox Code Playgroud)
这是我得到的回复,页面看起来空白.
<html><head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Vine</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" href="/assets/1035bae3.app.min.css">
<link rel="shortcut icon" type="image/png" …Run Code Online (Sandbox Code Playgroud) 我开始使用 RXAndroid 并且我已经发布了我的第一个测试版,但出现了一个我没想到的异常。我确定这是因为我对onError方法的工作原理缺乏了解。
我的代码是这样的:
disposables.add(Observable.create(new ObservableOnSubscribe<String>() {
@Override
public void subscribe(@NonNull ObservableEmitter<String> e) throws Exception {
if (e.isDisposed()) {
return;
}
//do stuff
if (stuff didn't fail) {
e.onNext(myString);
} else {
e.onError(new Exception("stuff failed"));
}
e.onComplete();
}
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribeWith(new DisposableObserver<String>() {
@Override
public void onNext(@NonNull String myString) {
//do stuff
}
@Override
public void onError(@NonNull Throwable e) {
//handle the error
}
@Override
public void onComplete() {
}
})
);
Run Code Online (Sandbox Code Playgroud)
我在这里崩溃了:
e.onError(new Exception("stuff failed"));
但我个人认为这可以处理这种情况? …
我有一个 Fire TV 应用程序,该应用程序也将在普通 Android TV 上发布,以及一些搭载 Android(非 Android TV)的电视,也可能在平板电脑上发布。因此,我为 Android TV 设置了横幅,并且工作正常,该图标在其他设备上工作正常,但 Fire TV 在我期望显示横幅的位置显示了该图标。这是我的应用程序 xml:
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:banner="@drawable/banner"
android:theme="@style/AppTheme">
<activity
android:name=".start.MainActivity"
android:banner="@drawable/banner"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:logo="@drawable/banner"
android:roundIcon="@mipmap/ic_launcher_round"
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
</activity>
</application>
Run Code Online (Sandbox Code Playgroud)
我缺少什么?我也使用下面的内容制作了自定义 xml,但没有帮助:
<resources>
<drawable name="splash_logo">@drawable/banner</drawable>
<drawable name="app_logo">@drawable/banner</drawable>
<drawable name="company_logo">@drawable/banner</drawable>
</resources>
Run Code Online (Sandbox Code Playgroud) android ×6
.net ×1
android-tv ×1
c# ×1
chromecast ×1
chromium ×1
google-cast ×1
image ×1
jsf ×1
jsf-2 ×1
leanback ×1
mojarra ×1
rx-android ×1
rx-java ×1
webview ×1