首页 \ 问答 \ PreferenceManager.getDefaultSharedPreferences中的上下文用于什么?(What is context in PreferenceManager.getDefaultSharedPreferences used for?)

PreferenceManager.getDefaultSharedPreferences中的上下文用于什么?(What is context in PreferenceManager.getDefaultSharedPreferences used for?)

鉴于传递给PreferenceManager.getDefaultSharedPreferences的任何非空上下文将返回相同的结果,PreferenceManager使用的上下文是什么,以及在不同上下文中传递的点是什么?


Given that any non-null context passed to PreferenceManager.getDefaultSharedPreferences will return the same result, what is context used for by PreferenceManager and what's the point of passing in different context?


原文:https://stackoverflow.com/questions/41554923
更新时间:2024-03-22 13:03

最满意答案

解决。 我只为文件传输创建了第二个套接字。


Resolved. I created second socket for file transfer only.

相关问答

更多
  • lz只是为了用java的socket啊,那么我给你这么介绍下,你学了java的基础语法后,你得掌握下java的多线程,因为 java的socket几乎是和多线程一起使用的,对于socket还要学习的就是流了这是socket传输内容的东西。如果lz学会了这两个东西,那么恭喜你,你可以学习socket的api了,学习socket的api在网上的文档还是有的,但是你得分辨哪些是好的,哪些是转载的,对于socket的学习建议lz不要看什么视频了因为网上的视频都太简单了,就类似于刚想java的时候的hello wor ...
  • 解决。 我只为文件传输创建了第二个套接字。 Resolved. I created second socket for file transfer only.
  • readLine(); 会读取(或阻止),直到遇到换行符,这就是你被卡住的原因。 但是你没有在你发送的命令中使用换行符,这是可疑的,因为协议中必须有一些约定的形式才能分开命令( flush()是不够的)。 我怀疑绘图仪仍在等待你用\n完成你的命令,然后才能读取它返回的任何内容。 readLine(); will read (or block) until it encounters a line feed, so that's why you're getting stuck. However you di ...
  • readLine()在读取回车符或换行符时才会返回,这是您从终端或文本文件读取时通常会得到的内容。 如果POP服务器实际上并没有在其邮件的末尾加上\ r \ n,我不会感到惊讶。 尝试使用read()。 readLine() won't return until it's read a carriage return or a line feed, which is what you normally get when you read from a terminal or a text file. I w ...
  • 至少: 从Socket.setSoTimeout() javadoc接收异常并不意味着套接字总是死的: 如果超时到期[例如,在读取时,会引发java.net.SocketTimeoutException,尽管Socket仍然有效。 套接字的关闭标志似乎只在Socket.close()方法时设置,所以我不会依赖它。 At least: Receiving an exception does NOT mean the socket is always dead, from Socket.setSoTimeout ...
  • 这个词是'块'。 它阻止了I / O. 它阻止。 不要对事件线程执行阻塞操作。 所有网络代码都应该在不同的线程上运行。 这包括readObject()和writeObject(),以及flush(),并创建流。 The word is 'blocks'. It's blocking I/O. It blocks. Don't perform blocking operations on the event thread. All the networking code should run on separ ...
  • 通过更改来修复 while (fis.read(buffer) > 0) { outStream.write(buffer); } 至 int count; while ((count = fis.read(buffer)) > 0) { outStream.write(buffer, 0, count); } 在服务器端的ClientThread.java中 Fixed by changing while (fis.read(buffer) > 0) { outStream.w ...
  • ObjectInputStream等待传入的标头。 直到标题被完全接收,你将被困在这一行: ObjectInputStream in = new ObjectInputStream(socket.getInputStream()); 要解决此问题,您需要在建立连接后立即在另一端(即服务器)的ObjectOutputStream上调用flush() 。 有关更多信息,请阅读javadoc 。 The ObjectInputStream waits for an incoming header. Until ...
  • 这可能是因为循环永远不会停止: while(true) { //code 你可以使用我为java服务器和客户端制作的类: ChatCleint package com.weebly.foxgenesis.src; import java.net.*; import java.io.*; public final class ChatClient { private Socket socket = null; private DataOutputStrea ...
  • 确定发现了问题,你必须在php中显示行结束的位置,以便套接字可以发送它,它将像魅力一样工作:) socket_write ($my_socket, $data."\r\n", strlen ($data."\r\n")); ok found the problem, you have to show where is the end of the line in php so the socket could send it, and it will work like a charm :) sock ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)