当我在Android上收到推送通知时,我收到以下错误.我似乎无法找到任何有关它的信息.有人可以帮忙吗?我真的很茫然.
致命异常:pool-1-thread-1进程:com.mycompany.myerror,PID:22712 java.lang.AbstractMethodError:abstract method"void com.google.firebase.iid.zzb.handleIntent(android.content.Intent)"来自java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)的com.google.firebase.iid.zzb $ 1.run(未知来源),位于java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java) :588)在java.lang.Thread.run(Thread.java:818)
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support:support-v4:25.3.0'
compile 'com.android.support:design:25.3.0'
//https://developers.google.com/android/guides/setup
compile 'com.google.android.gms:play-services-places:10.2.1'
compile 'com.google.android.gms:play-services-maps:10.2.1'
compile 'com.google.android.gms:play-services-location:10.2.1'
compile 'com.google.android.gms:play-services-vision:10.2.1'
compile 'com.google.android.gms:play-services-gcm:10.2.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.zxing:core:3.2.0'
compile 'com.journeyapps:zxing-android-embedded:3.5.0'
compile 'com.loopj.android:android-async-http:1.4.9'
testCompile 'junit:junit:4.12'
}
Run Code Online (Sandbox Code Playgroud)
FirebaseMessagingService.java
public class FirebaseMessagingService extends FirebaseMessagingService {
private static final String TAG = "FCM Service";
@Override
public void onMessageReceived(RemoteMessage remoteMessage) { …Run Code Online (Sandbox Code Playgroud) 我试图在图像上放置"通知"样式徽章.我使用Twitters Bootstrap作为基础框架并创建一个名为的自定义CSS类notify-badge.但我无法正常排队.
这是我的CSS代码.
.notify-badge{
position: absolute;
background: rgba(0,0,255,1);
height:2rem;
top:1rem;
right:1.5rem;
width:2rem;
text-align: center;
line-height: 2rem;;
font-size: 1rem;
border-radius: 50%;
color:white;
border:1px solid blue;
}
Run Code Online (Sandbox Code Playgroud)
我希望能够在徽章中放置任何小的文字,并展开红色圆圈以适应.
这是我的HTML代码.
<div class="col-sm-4">
<a href="#">
<span class="notify-badge">NEW</span>
<img src="myimage.png" alt="" width="64" height="64">
</a>
<p>Some text</p>
</div>
Run Code Online (Sandbox Code Playgroud)
编辑:
这是APAD1答案的图像.
添加margin-top:-20px;以.item修复对齐问题.
我正在尝试使用EPPLUS 4.0.3打开一个XLSX文件作为模板(我甚至使用了一个空白的XLSX文件).
如果我不打开模板文件(空白或真实的),只需创建一个新工作簿并创建一个工作表,它就可以正常工作.或者如果我打开模板文件,并创建一个新的工作表,那么它工作正常.只有当我尝试访问模板中的FIRST工作表时才会出现错误:工作表位置超出范围.
像这样访问第一个工作表:workBook.Worksheets.First()不工作.
首先不再是定义.
因此,我尝试按名称访问第一个工作表,并使用此方法同时workBook.Worksheets[1]使用0和1来尝试获取第一个工作表.
我的代码:
var existingTemplate = new FileInfo(_ExcelTemplateFilePath);
using (ExcelPackage p = new ExcelPackage(existingTemplate)) {
// Get the work book in the file
ExcelWorkbook workBook = p.Workbook;
ExcelWorksheet ws = workBook.Worksheets[1];
// MY OTHER EXCEL CELL CODE HERE
}}
Run Code Online (Sandbox Code Playgroud)
有谁知道如何访问第一张和Excel文件?
我正在尝试重构我的应用程序以使用ViewBinding. 我已经浏览了所有的片段和活动;但是,我不确定ArrayAdapter使用视图绑定来防止内存泄漏的正确约定。
viewbinding在 ArrayAdapter 中使用 a 的正确方法是什么?
我一直在使用这种方法来处理片段:
private var _binding: BINDING_FILE_NAME? = null
private val binding get() = _binding!!
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
_binding = BINDING_FILE_NAME.inflate(inflater, container, false)
return binding.root
}
override fun onDestroyView() {
super.onDestroyView()
_binding = null
}
Run Code Online (Sandbox Code Playgroud)
我这样称呼我的适配器:
var myadapter : MyCustomAdapter = MyCustomAdapter(requireContext(), R.layout.row_autocomplete_item, myListOfStrings())
Run Code Online (Sandbox Code Playgroud)
MyCustomAdapter类
class MyCustomAdapter(ctx: Context, private val layout: Int, private val allItems: List<String>) : ArrayAdapter<String>(ctx, layout, allItems) {
var …Run Code Online (Sandbox Code Playgroud) 我想传递一个参数来定义我想在数据库播种期间创建多少条记录,而无需手动编辑工厂。
我尝试了不同的变体 php artisan db:seed --class=UsersTableSeeder [using different args here]
我似乎找不到任何文档,所以我不知道在功能上是否存在。这样的东西存在吗?
class UsersTableSeeder extends Seeder
{
public $limit = null;
public function __construct($limit = 1) {
$this->limit = $limit;
}
public function run()
{
echo $this->limit;
}
}
Run Code Online (Sandbox Code Playgroud)
是否可以在XCode中选择多行代码,当我按下TAB按钮时,所有选定的行都缩进?
我知道CMD+[会不知不觉而且CMD+]会不会.但我希望同样的原则发生在'TAB
andSHIFT + TAB'上.
现在,它只是在TAB用于结构键绑定时删除突出显示的行.我无法让我的键绑定工作正常.谁知道我可能做错了什么?
我在谷歌上EGL_emulation: eglMakeCurrent搜索了为什么会不断出现这种情况的解决方案 - 但我找不到与我正在做的事情真正匹配的东西。有几个未回答的 SO 问题涉及这个主题。但同样,我仍然不确定是什么原因造成的。我正在构建一个 Kotlin 应用程序。
我不想只是将其正则表达式 -如果存在实际问题,我想解决它。
我的应用程序可以什么都不做。我可以清除日志,在短短几秒钟内我就有数百个这样的事件。
但是当我的应用程序正在运行时,这只是一个恒定的流,它使得我很难找到自己的日志输出。
我该如何解决这个问题?我什至不知道是什么导致它发布任何代码。
我在显示Toast消息时遇到运行时异常
java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
Run Code Online (Sandbox Code Playgroud)
当用户从应用程序的任何位置收到推送通知时,我想将消息正文显示为Toast消息.
有帮助吗?
public class MyAppFirebaseMessagingService extends FirebaseMessagingService {
private static final String TAG = "FCM Service";
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
if (remoteMessage.getNotification() != null) {
if (AppConfig.SYSTEM_WIDE_DEBUG) {
Log.d(TAG, "Message Notification Body: " + remoteMessage.getNotification().getBody());
}
sendNotification(remoteMessage.getNotification().getBody());
}
}
private void sendNotification(String messageBody) {
Toast.makeText(getApplicationContext(),messageBody,Toast.LENGTH_LONG).show();
Intent intent = new Intent(this, HomeActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent, PendingIntent.FLAG_ONE_SHOT);
Uri …Run Code Online (Sandbox Code Playgroud) android push-notification firebase android-toast firebase-cloud-messaging
我两年前就问过这个问题。由于一直没有成功,直到最近我才放弃了这个想法。
从那以后我就能够半修复/复制这个机制了。然而,所有物体似乎都跳到了下一个位置,其中一些物体重复了它们的“领导者”位置。
橙色的是头部,身体部位是绿色的。
正如您从下面注释掉的代码中看到的,我尝试了多种排列来让孩子们顺利地跟随他们的领导者,每个身体部位之间的距离只是圆形碰撞器的半径。
我的想法是,如果“领导者”移动了半径的距离,那么跟随者就可以向领导者原来的位置移动。这给了领导者行动的时间。
但唯一似乎半工作的,是未注释的。
任何人都可以看到问题吗?
FollowTheLeader.cs
public class FollowTheLeader : MonoBehaviour
{
[Header("Head")]
public GameObject bodyPart;
public int bodyLength = 6;
[Header("Move Speed")]
[Range(0.25f, 2.0f)] public float moveMin = 0.5f;
[Range(0.25f, 2.0f)] public float moveMax = 2.0f;
[Header("Change Directions")]
[Range(0.25f, 2.0f)] public float changeMin = 0.5f;
[Range(0.25f, 2.0f)] public float changeMax = 2.0f;
[SerializeField]
private Vector2 oldPosition;
public Vector2 OldPosition { get => oldPosition; set => oldPosition = value; }
[SerializeField] …Run Code Online (Sandbox Code Playgroud)