jedis.incr(byte []键)的输入(Inputs for jedis.incr(byte[] key))
我目前使用Jedis版本2.9.0,根据Redis Jedis文档,long jedis.incr(byte [] key)方法接受一个字节数组作为其键。 事情是,我使用散列值(MessageDigest.getInstance(“MD5”))作为键,但我不确定此命令中允许的键的类型/大小。 我也不知道这是否是这种情况下的“最佳做法”。 有人知道字节数组有多大,仍然可以作为参数传递给这个方法吗?
I'm currently using Jedis version 2.9.0, and according to the Redis Jedis documentation, the method long jedis.incr(byte[] key) accepts a byte array as its key. The thing is, I'm using hash values (MessageDigest.getInstance("MD5")) as keys, but I'm not sure about the types/sizes of keys allowed in this command. I also don't know if this is the 'best practice' in this cases. Does anyone know how big a byte array can be and still be passed as an argument in this method?
原文:https://stackoverflow.com/questions/43375374
最满意答案
你的
onCreate
缺少super.onCreate(savedInstanceState);
,把它放在if
语句之前,这应该可以解决问题。public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState == null) { // Add the fragment on initial activity setup mainFragment = new Fragment(); getSupportFragmentManager().beginTransaction() .add(android.R.id.content, mainFragment).commit(); } else { // Or set the fragment from restored state info mainFragment = (Fragment) getSupportFragmentManager() .findFragmentById(android.R.id.content); } }
Your
onCreate
is missingsuper.onCreate(savedInstanceState);
, put it before theif
statement and that should resolve the issue.public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState == null) { // Add the fragment on initial activity setup mainFragment = new Fragment(); getSupportFragmentManager().beginTransaction() .add(android.R.id.content, mainFragment).commit(); } else { // Or set the fragment from restored state info mainFragment = (Fragment) getSupportFragmentManager() .findFragmentById(android.R.id.content); } }
相关问答
更多-
您应该在处理程序中执行交易,如下所示: @Override protected void onPostExecute(String result) { Log.v("MyFragmentActivity", "onFriendAddedAsyncTask/onPostExecute"); new Handler().post(new Runnable() { public void run() { fm = getSupportFrag ...
-
这似乎是新添加的嵌套片段支持中的错误。 基本上,当FragmentManager从活动中分离出来时, FragmentManager内部状态将被破坏。 修复它的一个短期解决方法是将以下内容添加到您所调用getChildFragmentManager()的每个Fragment onDetach() getChildFragmentManager()上: @Override public void onDetach() { super.onDetach(); try { Fie ...
-
终于找到了它:我正在调用newTab.mFragmentContainer.setDefaultContent(null); 在提交newTab.mFragmentContainer并确保它被执行之前。 换句话说,在将ContainerFragment正确添加到视图层次结构之前,我正在操作它。 Finally found it: i was calling newTab.mFragmentContainer.setDefaultContent(null); before committing the add ...
-
java.lang.IllegalStateException:活动已被销毁(java.lang.IllegalStateException: Activity has been destroyed)[2022-09-26]
这些片段应该从Activity中显示。 流程应该是: 在FragmentActivity类中分配一个新的片段对象 让片段管理器添加新分配的片段 在你的情况下,你没有连接到真正的活动。 您使用新的FragmentActivity()分配FragmentActivity并尝试获取支持管理器。 虽然这个编译没有“真正的”活动能够管理你的片段。 片段可以添加到已经显示的活动上,但事实并非如此。 我建议阅读这个页面,因为它很好地解释了这些事情: http : //developer.android.com/guide ... -
错误java.lang.IllegalStateException:活动已被销毁(Error java.lang.IllegalStateException: Activity has been destroyed)[2022-04-24]
你的onCreate缺少super.onCreate(savedInstanceState); ,把它放在if语句之前,这应该可以解决问题。 public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState == null) { // Add the fragment on initial activity setup ... -
你实例化一个(new MainActivity). callFragmentDiary (new MainActivity). callFragmentDiary ,但它应该是((MainActivity)getActivity()).callFragmentdiary 。 另外,在onCreate方法中获取FragmentManager可能是一个好主意,因为在加载/实例化类时可能不会设置片段管理器。 只有在你打算使用它时才创建FragmentTransaction 。 You instantiating ...
-
由于GPS提供商的不可用性,您最有可能收到此错误。 如果Gps提供商或网络提供商已启用到位置设置,请让此人检查设置。希望这对您有所帮助 You are getting this error most probably, due to un-avialability of GPS Providers. Please ask the person to check settings if Gps Provider or Network Provider has been enabled into Locatio ...
-
java.lang.IllegalStateException Butterknife(java.lang.IllegalStateException Butterknife)[2023-05-21]
从基础活动中删除绑定。 当ButterKnife绑定到基类时,你的布局还没有膨胀。 您还可以将@Nullable注释添加到字段中。 Remove binding from base activity. When ButterKnife bind in base class, your layout not inflated yet. Also you can add @Nullable annotation to field. -
似乎现在最简单的解决方案是使用isDestroyed()检查来包围onReceive。 BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (!isDestroyed) { doSomeStaff(); } } }; ...
-
你可以删除这个onBackPressed因为android隐式地按下后退键完成你的活动。 并且不要调用addToBackStack : ft.addToBackStack(null); 删除上面这一行,这会在backstack中添加你的片段事务,并在返回键上按下第一个事务,然后恢复活动。 如果您删除此背面按将完成活动。 改成: if(hasFocus){ frame.postDelayed(new Runnable() { @Override public vo ...