小编Din*_*aru的帖子

通过USB从Android App向PC发送数据

我想创建一个应用程序,通过USB从Android-app发送数据到PC.我的代码如下:

package com.sample.dummy.app.senddatathoughserialport;

import java.io.UnsupportedEncodingException;
import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.hardware.usb.UsbConstants;
import android.hardware.usb.UsbDeviceConnection;
import android.hardware.usb.UsbEndpoint;
import android.hardware.usb.UsbInterface;
import android.hardware.usb.UsbManager;
import android.hardware.usb.UsbDevice;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends Activity 
{


@Override
protected void onCreate(Bundle savedInstanceState) 
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    final TextView tv = (TextView)findViewById(R.id.multiAutoCompleteTextView1);
    Button sButton = (Button) findViewById(R.id.button1);
    final UsbManager manager = (UsbManager) this.getSystemService(Context.USB_SERVICE);
    Toaster(""+manager);

    // -- register click event with first button ---
    sButton.setOnClickListener(new View.OnClickListener() 
    { …
Run Code Online (Sandbox Code Playgroud)

usb android

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

如何在java中保持ResultSet打开?

我正在传递一个创建JTable的java文件的值.

ResultSet res = np.InvestmentByInvestType(IType);
 String tablename = "Investment By Invest Type";
 int customAmt = np.showCustomizeInvestAmount1(IType);
 CommonTable ct = new CommonTable();
 ct.CommonSearchTable(res, customAmt,tablename);
Run Code Online (Sandbox Code Playgroud)

public void CommonSearchTable( final ResultSet res, int totally, final String tablename) throws SQLException 
{

        JButton exportTable= new JButton ("Export");

        ResultSetMetaData metaData = res.getMetaData();
        // names of columns
        Vector<String> columnNames = new Vector<String>();
        int columnCount = metaData.getColumnCount();

        for (int column = 1; column <= columnCount; column++) 
        {
            columnNames.add(metaData.getColumnName(column));
        }
        // data of the table
        Vector<Vector<String>> data = new …
Run Code Online (Sandbox Code Playgroud)

java swing resultset

0
推荐指数
1
解决办法
750
查看次数

标签 统计

android ×1

java ×1

resultset ×1

swing ×1

usb ×1