小编her*_*110的帖子

尝试在空对象引用上调用虚方法'android.os.Looper android.content.Context.getMainLooper()'

嘿伙计们,每当我尝试在我的手机或模拟器上打开应用程序时,我会在我的Log cat中收到此错误.为了概述我目前正在进行的项目,它是一个记录连接到手机上接入点的设备数据的系统,可以通过屏幕上的按钮打开和关闭.

我想赞扬:

1)Android 2.3 wifi热点API

2)https://www.whitebyte.info/android/android-wifi-hotspot-manager-class

Log cat文件的图像是:https: //i.gyazo.com/fa068fd1fce3f27f43185c0cd12568c1.png

我的主要活动课

public class MainActivity extends ActionBarActivity{

boolean wasApEnabled = false;
static AccessPoint wifiAP;
private WifiManager wifi;
static Button apButton;
static TextView textView;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    apButton = (Button) findViewById(R.id.toggleBtn);
    textView = (TextView) findViewById(R.id.wifiClients);

    wifiAP = new AccessPoint();
    wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);

    scan();

    apButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            wifiAP.toggleWifiAP(wifi, MainActivity.this);
        }
    });

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD|WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON|WindowManager.LayoutParams.FLAG_DIM_BEHIND);

}

private void scan(){
    wifiAP.getClientList(false, …
Run Code Online (Sandbox Code Playgroud)

java android wifi

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

Retrieving MAC Address Programmatically - Android

I'm having an issue with retrieving the MAC address of the device programatically, before anyone mentions anything about other posts I have read them already such as: How to find MAC address of an Android device programmatically

但是我尝试在我自己的应用程序中使用该代码并使用简单的 log.d 对其进行测试,结果发现它没有返回任何内容。“看看这是否有效”的消息,但没有别的。所以我假设mac地址为空。

Log.d("seeing if this works", macAddress2);
Run Code Online (Sandbox Code Playgroud)

我所做的代码如下所示:

//Set onclick listener for the Get Mac Address button
        getMac.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View arg0) {
                WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
                WifiInfo wInfo = wifiManager.getConnectionInfo();
                String macAddress2 = wInfo.getMacAddress();

                macAddress.setText(macAddress2);
            }
        });
Run Code Online (Sandbox Code Playgroud)

java android mac-address

5
推荐指数
2
解决办法
9545
查看次数

如何重置Google工作表,以便将表单收集的数据放入第一个免费单元格

嘿伙计这可能是一个愚蠢的问题,但我一直在谷歌搜索如何重置电子表格.我目前遇到这个问题,每次我从电子表格中删除数据,然后让用户通过表单输入一些数据,信息放在最后一个单元格曾经有信息的位置.

例如:http://gyazo.com/72b5e58fc17dae3c76cebcd0d72e30e0

然后当我删除这些数据并让用户再次输入一些信息时,它将在第8行开始发布数据,依此类推.

有没有办法重置这个数据,以便将数据存储在第1行.

google-api google-sheets google-forms

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