首页 \ 问答 \ 由listview OnItemLongClickListener创建的Android开放式微调器(Android open spinner by listview OnItemLongClickListener)

由listview OnItemLongClickListener创建的Android开放式微调器(Android open spinner by listview OnItemLongClickListener)

我正在开发我的第一个Android应用程序,但面临一个棘手的问题。 在我的应用程序中,有一个页面通过使用listview显示所有sqlite数据库记录。 我希望用户可以弹出微调器长按listview,但它会强行关闭。

    private ListView.OnItemLongClickListener modItem = new ListView.OnItemLongClickListener()
    public boolean onItemLongClick(AdapterView<?> arg0, View v,int index, long arg3)
    {
        //I don't know what should I put in the parameter of the spinner constructor 
        sp_choice = new Spinner(<???>);
        //Same problem that I don't know what should I put in <???>
        ArrayAdapter<String> adt = new ArrayAdapter<String>(<???>,android.R.layout.simple_spinner_item, getResources().getStringArray(R.array.choice_array));
        adt.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        sp_choice.setAdapter(adt);
        return true;
    } 
    };

I am developing my first android application, but face a difficult problem. In my application, there is a page that show all sqlite database records by using listview. I want the spinner can pop up by user long click the listview, but it force close.

    private ListView.OnItemLongClickListener modItem = new ListView.OnItemLongClickListener()
    public boolean onItemLongClick(AdapterView<?> arg0, View v,int index, long arg3)
    {
        //I don't know what should I put in the parameter of the spinner constructor 
        sp_choice = new Spinner(<???>);
        //Same problem that I don't know what should I put in <???>
        ArrayAdapter<String> adt = new ArrayAdapter<String>(<???>,android.R.layout.simple_spinner_item, getResources().getStringArray(R.array.choice_array));
        adt.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        sp_choice.setAdapter(adt);
        return true;
    } 
    };

原文:https://stackoverflow.com/questions/17130233
更新时间:2023-08-30 07:08

最满意答案

通常不允许JavaScript访问系统信息 - 其中包括可移植性和安全性考虑因素。

如果你真的因为某种原因需要它,你可以找到一些特定于浏览器的解决方案(不知道是否有)或者你需要用户安装你提供的自定义插件(可能是原生的NPAPI用于跨浏览器支持)为JavaScript提供信息。

另一种选择是浏览器扩展,但是使用它们会失去跨浏览器的可移植性 - 如果您不想将用户锁定到特定的浏览器,则必须至少为基于Gecko和Webkit的浏览器开发单独的扩展。


JavaScript is in general not allowed to access system information - among other things this results from portability and security considerations.

If you really need that for some reason you either find some browser-specific solutions (don't know if there are any) or you require the user to install a custom plugin you deliver (probably native with the NPAPI for cross-browser-support) that provides the information to JavaScript.

Another alternative would be browser extensions, but with them you lose the cross-browser-portability - if you don't want to lock users onto a specific browser you would have to at least develop seperate extensions for Gecko- and Webkit-based browsers.

相关问答

更多
  • 这是一个环境问题,机器上运行的软件会干扰VSHub.exe的正常运行。 潜在的问题是,它像恶意软件一样运行,将自身附加到另一个进程(您正在尝试调试的程序),然后使用命名管道与另一个进程(IDE)进行通信。 “无法定位/启动服务”是无法连接命名管道的诊断消息。 这种行为足以引发黑客攻击或触发试图阻止恶意软件执行此操作的软件中的错误。 Avast,AVG,Sophos,ESET,McAfee等产品之前已经被确定为对开发人员的机器特别不友好。 特别需要将Avast作为一种从未停止导致麻烦的产品来挑选出来。 测试很 ...
  • 不,它不使用WMI。 它通过mscorlib.dll和System.dll中System.Win32命名空间内的内部类使用直接本机API调用。 大多数类如PerformanceCounter和EventLog只访问使用对advapi32.dll的本机调用的注册表。 其他功能(如获取进程列表)使用winnt.dll或kernel32.dll中的调用,具体取决于Windows的版本。 您可以在此处找到有关此处使用的本机Win32调用的更多信息以及有关性能计数器的更多详细信息。 您可以使用dotPeek或Refl ...
  • 如果要完全禁用该功能,您可以从调试工具 - >选项 - >调试 - >常规 - >启用诊断工具 If you want to disable the feature altogether you can currently do so from Tools → Options → Debugging → General → Enable Diagnostics Tools while debugging
  • 不,在安全的跨浏览器支持方面没有。 推理归结为安全。 Cookie的目标是允许从浏览器到服务器的来回通信。 如果您可以允许任何前端脚本手动编辑cookie的域/路径/到期,只是为了知道它的名称,它会导致很多潜在的安全漏洞,如果不是为了欺骗访问,那么至少无形地追踪人。 这并不是说饼干本质上是安全的,甚至根本不安全。 我的意思是说,通过允许任何和所有JS编辑发送到服务器的任何和所有cookie数据(不仅仅是CRUD),任何安全伪装都会在心跳中消失。 No, there is none, in terms of ...
  • 一个实现可以发出(1)任意数量的诊断,只要它发出所需的诊断信息即可。 它必须接受正确的节目,达到它所能达到的程度, C ++ 14§1.4/ 2: “如果一个程序没有违反本标准中的规则,那么一致性实施应在其资源限制内接受并正确执行该程序” 但它可以发出诊断信息。 C ++标准不区分错误消息和警告消息 ,但这是事实上的标准。 错误消息意味着(按照惯例)没有产生二进制文件,因为问题太严重了。 警告消息意味着(通过约定)存在潜在的问题,但不是直接违反语言规则,因此除非出现错误,否则产生二进制文件。 有时线条有点模 ...
  • 通常不允许JavaScript访问系统信息 - 其中包括可移植性和安全性考虑因素。 如果你真的因为某种原因需要它,你可以找到一些特定于浏览器的解决方案(不知道是否有)或者你需要用户安装你提供的自定义插件(可能是原生的NPAPI用于跨浏览器支持)为JavaScript提供信息。 另一种选择是浏览器扩展,但是使用它们会失去跨浏览器的可移植性 - 如果您不想将用户锁定到特定的浏览器,则必须至少为基于Gecko和Webkit的浏览器开发单独的扩展。 JavaScript is in general not allo ...
  • 没有标志可以删除出现在导致此诊断表的弹出窗口中的“详细信息”按钮。 我相信你应该能够通过使用initOptions.js文件中的onConnectionFailure属性来全部覆盖对话框并提供你自己的对话框。 你应该在那里有下面的代码片段 // # The callback function to invoke in case application fails to connect to MobileFirst Server //onConnectionFailure: function (){}, T ...
  • 在实现诊断分析器时,目前没有获得工作空间或进行多项目分析的方法,因为这些方法需要能够仅使用命令行编译器针对单个编译运行。 但是,一旦确定诊断,您就可以在代码修复提供程序中执行此操作。 如果您只想找到一个类实现另一个类的所有位置,您可以创建一个编译范围的诊断分析器并在决定诊断之前检查所有声明。 您可以通过实现ICompilationStartedAnalyzer和ICompilationEndedAnalyzer来完成此操作。 There is no current way to get at workspa ...
  • 虽然不是库,而不是BIOS版本的详细信息,但lshw至少能够识别制造商和型号,例如 我目前的电脑: *-display UNCLAIMED description: VGA compatible controller product: GeForce 8500 GT vendor: nVidia Corporation ... 老电脑 *-display descript ...
  • 没有单个API调用来检索所有NSG上的所有诊断设置。 如果您拥有所有NSG的所有ARM资源ID,则需要多次调用Get-AzureRmDiagnosticSetting。 https://docs.microsoft.com/en-us/powershell/resourcemanager/azurerm.insights/v2.2.0/get-azurermdiagnosticsetting There is no single API call to retrieve all the diagnostic ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。