小编Har*_*thy的帖子

Android:写入失败:EPIPE(Broken pipe)写入文件出错

我试图以编程方式截取Android屏幕截图.我做了以下代码:

private void getsnap(){
    try{
        Process sh = Runtime.getRuntime().exec("su", null, null);
        OutputStream os = sh.getOutputStream();
        String filePath = this.getFilesDir().getPath().toString() + "/fileName1.jpeg";
        os.write(("/system/bin/screencap -p " + filePath).getBytes("ASCII"));
        os.flush();
        os.close();
        sh.waitFor();       
    } 
    catch (Exception e) 
    {
        e.printStackTrace();
    }
}
Run Code Online (Sandbox Code Playgroud)

java.io.IOException: write failed: EPIPE (Broken pipe)

请有人帮忙吗?我已经检查过其他帖子,但我找不到解决问题的方法.


编辑:

请注意,错误发生在行中os.write().

android outputstream file epipe android-permissions

18
推荐指数
1
解决办法
3万
查看次数

MVC3 asp.net错误:值不能为null.参数名称:下拉列表中的项目

在尝试发布数据时,我只在服务器中获取转储,而不是在本地系统中.有一个页面向数据库提交了一些值.我还将页面中的下拉列表建模为强制性.但是,当点击"创建"时,而不是给出"失踪"之类的错误; 它抛出一个转储.

转储跟踪:

Value cannot be null.
Parameter name: items

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: items

Source Error: 


Line 65:         </div>
Line 66:         <div class="editor-field">
Line 67:             @Html.DropDownListFor(x => x.ProjectName, new SelectList(Model.ProjectDetail, "ProjectName", "ProjectName"),"")
Line 68:             <span runat="server" style="color:Red;" visible="false"> *</span>
Line 69:             @Html.ValidationMessageFor(model => …
Run Code Online (Sandbox Code Playgroud)

c# asp.net asp.net-mvc-3

10
推荐指数
1
解决办法
3万
查看次数

Android:onClick按钮onClick永远不会被调用

我创建了一个运行服务的应用程序.该服务基本上有一个叠加按钮,点击按钮做了一些事情.但是,每次我点击按钮,按钮背景中的应用程序都会响应.请有人帮忙吗?

我已提到链接.

这是我的代码:

服务代码:

public class HUD extends Service implements OnTouchListener{
    Button mButton;
    @Override
    public IBinder onBind(Intent intent) {
        // TODO Auto-generated method stub
        String s;
        s = "Hari";

        return null;
    }
    @Override
    public void onCreate() {
        super.onCreate();
        //mView = new HUDView(this);
        mButton = new Button(this);
        mButton.setText("Overlay button");
        mButton.setOnTouchListener(this);

        WindowManager.LayoutParams params = new WindowManager.LayoutParams(
                WindowManager.LayoutParams.WRAP_CONTENT,
                WindowManager.LayoutParams.WRAP_CONTENT,
                WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
                WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,
                PixelFormat.TRANSLUCENT);
        params.gravity = Gravity.RIGHT | Gravity.TOP;
        params.setTitle("Load Average");
        WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE);
        wm.addView(mButton, params);
    }

    @Override
    public void onDestroy() …
Run Code Online (Sandbox Code Playgroud)

service android touch

5
推荐指数
1
解决办法
4524
查看次数

使用带有链接的行索引的javascript动态删除HTML表格行

我想在 HTML 中动态添加/删除表格行。我知道这个论坛中有很多类似的问题。我的疑问是使删除操作适用于每一行。为此,我使用了表索引。

//Link
var cell7 = row.insertCell(6);
var element7 = document.createElement("a");
var text = document.createTextNode("Delete");
element7.appendChild(text);
element7.setAttribute("href","javascript:deleterow("+rowcount+")");
element7.name="reqlink[]";
cell7.appendChild(element7);    
Run Code Online (Sandbox Code Playgroud)

这里的 rowcount 是当前添加的行的索引。因此,在添加行时,我也定义了删除操作。因此,每一行都会有一个删除链接。但是,问题是索引动态变化。所以,这个解决方案不会真正起作用。

请问你能帮忙吗?我不想使用解决方案之一定义的复选框。

删除行函数的脚本如下:

function deleterow(index){
    alert('working' + index);
    table.deleteRow(index);
}
Run Code Online (Sandbox Code Playgroud)

######### 试过这个###########

//Link
var cell7 = row.insertCell(6);
var element7 = document.createElement("a");
var text = document.createTextNode("Delete");
element7.appendChild(text);
element7.setAttribute("href","javascript:deleterow(this); return false");
element7.name="reqlink[]";
cell7.appendChild(element7);
Run Code Online (Sandbox Code Playgroud)

“this”指向窗口而不是表格行。

html javascript html-table delete-row

1
推荐指数
1
解决办法
2万
查看次数