帮忙看看这个android错误 !

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.lenovo.push, PID: 17578
java.lang.NullPointerException: Attempt to write to field 'int android.support.v7.widget.RecyclerView$ViewHolder.mItemViewType' on a null object reference
at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6368)
at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5555)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5440)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5436)
at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2224)
at android.support.v7.widget.GridLayoutManager.layoutChunk(GridLayoutManager.java:556)
at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1511)
at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:595)
at android.support.v7.widget.GridLayoutManager.onLayoutChildren(GridLayoutManager.java:170)
at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3583)
at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3312)
at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3844)
at android.view.View.layout(View.java:18799)
at android.view.ViewGroup.layout(ViewGroup.java:5952)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
at android.view.View.layout(View.java:18799)
at android.view.ViewGroup.layout(ViewGroup.java:5952)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
at android.view.View.layout(View.java:18799)
at android.view.ViewGroup.layout(ViewGroup.java:5952)
at android.support.design.widget.HeaderScrollingViewBehavior.layoutChild(HeaderScrollingViewBehavior.java:131)
at android.support.design.widget.ViewOffsetBehavior.onLayoutChild(ViewOffsetBehavior.java:42)
at android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onLayoutChild(AppBarLayout.java:1391)
at android.support.design.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:870)
at android.view.View.layout(View.java:18799)
at android.view.ViewGroup.layout(ViewGroup.java:5952)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
at android.view.View.layout(View.java:18799)
at android.view.ViewGroup.layout(ViewGroup.java:5952)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1741)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1585)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1494)
at android.view.View.layout(View.java:18799)
at android.view.ViewGroup.layout(ViewGroup.java:5952)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
at android.view.View.layout(View.java:18799)
at android.view.ViewGroup.layout(ViewGroup.java:5952)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1741)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1585)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1494)
at android.view.View.layout(View.java:18799)
at android.view.ViewGroup.layout(ViewGroup.java:5952)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
at com.android.internal.policy.DecorView.onLayout(DecorView.java:822)
at android.view.View.layout(View.java:18799)
at android.view.ViewGroup.layout(ViewGroup.java:5952)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2627)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2343)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1502)
E/AndroidRuntime: at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7044)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:927)
at android.view.Choreographer.doCallbacks(Choreographer.java:702)
at android.view.Choreographer.doFrame(Choreographer.java:638)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:913)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6692)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
Application terminated.

4个回答

空指针异常,你debug下程序喽,一步一步跟着走,看看那里没有获取的值。

空指针,检查下你的Viewholder

tydqcjj
tydqcjj 回复qq_38034939: 你还是发截图吧,或是直接上传你的java文件。这样都看不到你写的什么
接近 3 年之前 回复
qq_38034939
qq_38034939 /* * 适配器 */ private class Adapter extends RecyclerAdapter<Image>{ protected ViewHolder<Image> onCreateViewHolder(View root, int viewType) { return new GalleyView.ViewHolder(root); } protected int getItemViewType(int position, Image image) { return R.layout.cell_galley; } }
接近 3 年之前 回复

ViewHoder里面的变量接收到null值,检查下这个mItemViewType变量

对,mItemViewType为空

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Android http client response500错误,求大神帮忙看看代码!

http://121.42.195.113/usay/register.jsp服务器这里没错啊。。。。但不知道为什么放到安卓上就不行 package com.example.demo_jsom1; import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.protocol.HTTP; import org.apache.http.util.EntityUtils; import org.json.JSONObject; import android.app.Activity; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; public class MainActivity extends Activity implements OnClickListener { // 声明控件 //private EditText et_name, et_pass; private TextView tv_result; Handler handler =new Handler(){ @Override //当有消息发送出来的时候就执行Handler的这个方法 public void handleMessage(Message msg){ super.handleMessage(msg); //根据msg需求处理UI switch(msg.what){ case 1: String response = (String) msg.obj; tv_result.setText(response); } } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // 获取控件对象 //et_name = (EditText) findViewById(R.id.et_name); //用户名控件 //et_pass = (EditText) findViewById(R.id.et_pass);//密码控件 //tv_result = (TextView) findViewById(R.id.tv_result);//服务器端返回数据显示的控件 Button a = (Button) findViewById(R.id.login); tv_result = (TextView)findViewById(R.id.JSONtextView); a.setOnClickListener(this); } @Override public void onClick(View v) { // TODO Auto-generated method stub switch(v.getId()) { case R.id.login: SENDREQUEST(); Log.i("connectbutton", "1"); break; default: break; } } private void SENDREQUEST() { // TODO Auto-generated method stub new Thread() { @Override public void run() { try{ //网络传输 HttpClient httpclient = new DefaultHttpClient(); String uri = "http://121.42.195.113/usay/register.action"; HttpPost httppost = new HttpPost(uri); JSONObject obj = new JSONObject(); //放入键值对 obj.put("userAccount", "15602385611"); obj.put("userPassword", "123qwertyuiop"); //封装好发送 httppost.setEntity(new StringEntity(obj.toString()) ); //创建接收实例 HttpResponse reponse = httpclient.execute(httppost); //检验状态吗,如果成功接收数据 HttpEntity entity = reponse.getEntity(); int code = reponse.getStatusLine().getStatusCode(); Log.i("connectif", code +""); if(code == 200) { String rev = EntityUtils.toString(reponse.getEntity()); obj = new JSONObject(rev); //接收数据 String result = obj.getString("result"); //将服务器中返回的结果存放进message中 Message message = new Message(); message.what = 1; //obj传入对象 message.obj = result; handler.sendMessage(message); Log.i("result", result); }else{ Log.i("connectfalse", "4"); } }catch(ClientProtocolException e) { }catch(IOException E){ } catch (Exception e){ e.printStackTrace(); } } }.start(); } } ``` ```

android studio为什么程序运行时会闪退,自己找不出错误,寻求帮忙

为什么运行的时候这两张图片按钮时会闪退,找不到是哪里错了,我把所有代码都放到压缩包里了,请大神们帮我看解答一下,谢谢。 哪位大神可以教我一下android,想要拜师一下,我的qq是1070672265 ![图片说明](https://img-ask.csdn.net/upload/201910/09/1570617881_767688.png)![图片说明](https://img-ask.csdn.net/upload/201910/09/1570617907_501688.png) ![图片说明](https://img-ask.csdn.net/upload/201910/09/1570618099_624444.png)![图片说明](https://img-ask.csdn.net/upload/201910/09/1570618110_109302.png)![图片说明](https://img-ask.csdn.net/upload/201910/09/1570618124_143505.png)

android 运行报错。 各位大神帮忙看看

在 problems 里面 没有提示错误,但是 运行起来就 一打开程序 就直接退出了。。看着貌似线程的问题。。 具体看不懂 请教各位大神。。 01-11 10:57:25.741: E/AndroidRuntime(25259): FATAL EXCEPTION: main 01-11 10:57:25.741: E/AndroidRuntime(25259): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.marenbo.baidumap/com.marenbo.baidumap.MainActivity}: java.lang.NullPointerException 01-11 10:57:25.741: E/AndroidRuntime(25259): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2071) 01-11 10:57:25.741: E/AndroidRuntime(25259): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2096) 01-11 10:57:25.741: E/AndroidRuntime(25259): at android.app.ActivityThread.access$600(ActivityThread.java:138) 01-11 10:57:25.741: E/AndroidRuntime(25259): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1207) 01-11 10:57:25.741: E/AndroidRuntime(25259): at android.os.Handler.dispatchMessage(Handler.java:99) 01-11 10:57:25.741: E/AndroidRuntime(25259): at android.os.Looper.loop(Looper.java:213) 01-11 10:57:25.741: E/AndroidRuntime(25259): at android.app.ActivityThread.main(ActivityThread.java:4787) 01-11 10:57:25.741: E/AndroidRuntime(25259): at java.lang.reflect.Method.invokeNative(Native Method) 01-11 10:57:25.741: E/AndroidRuntime(25259): at java.lang.reflect.Method.invoke(Method.java:511) 01-11 10:57:25.741: E/AndroidRuntime(25259): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789) 01-11 10:57:25.741: E/AndroidRuntime(25259): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556) 01-11 10:57:25.741: E/AndroidRuntime(25259): at dalvik.system.NativeStart.main(Native Method) 01-11 10:57:25.741: E/AndroidRuntime(25259): Caused by: java.lang.NullPointerException 01-11 10:57:25.741: E/AndroidRuntime(25259): at com.marenbo.baidumap.MyOrientationListener.Start(MyOrientationListener.java:25) 01-11 10:57:25.741: E/AndroidRuntime(25259): at com.marenbo.baidumap.MainActivity.onStart(MainActivity.java:137) 01-11 10:57:25.741: E/AndroidRuntime(25259): at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1163) 01-11 10:57:25.741: E/AndroidRuntime(25259): at android.app.Activity.performStart(Activity.java:5018) 01-11 10:57:25.741: E/AndroidRuntime(25259): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2044) 01-11 10:57:25.741: E/AndroidRuntime(25259): ... 11 more

Android程序崩溃,求大神帮忙看看这是什么原因

如题,代码中没错误,但是每次运行到那个方法就自动退出了。这是Logcat中的error列表,谁知道是什么原因? 04-22 15:29:54.788: E/dalvikvm(3610): threadid=11: created from interp,name=Thread-3687 04-22 15:29:54.798: E/dalvikvm(3610): threadid=11: calling run(),name=Thread-3687 04-22 15:29:54.828: E/lanageTag(3610): not use 04-22 15:30:05.589: E/dalvikvm(3610): threadid=11: exiting,name=Thread-3687 04-22 15:30:30.546: E/AndroidRuntime(3610): FATAL EXCEPTION: main 04-22 15:30:30.546: E/AndroidRuntime(3610): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=3021, result=-1, data=Intent { (has extras) }} to activity {com.example.ocr_test_13/com.example.ocr_test_13.MainActivity}: java.lang.ArithmeticException: divide by zero 04-22 15:30:30.546: E/AndroidRuntime(3610): at android.app.ActivityThread.deliverResults(ActivityThread.java:3178) 04-22 15:30:30.546: E/AndroidRuntime(3610): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3221) 04-22 15:30:30.546: E/AndroidRuntime(3610): at android.app.ActivityThread.access$1100(ActivityThread.java:140) 04-22 15:30:30.546: E/AndroidRuntime(3610): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1261) 04-22 15:30:30.546: E/AndroidRuntime(3610): at android.os.Handler.dispatchMessage(Handler.java:99) 04-22 15:30:30.546: E/AndroidRuntime(3610): at android.os.Looper.loop(Looper.java:137) 04-22 15:30:30.546: E/AndroidRuntime(3610): at android.app.ActivityThread.main(ActivityThread.java:4914) 04-22 15:30:30.546: E/AndroidRuntime(3610): at java.lang.reflect.Method.invokeNative(Native Method) 04-22 15:30:30.546: E/AndroidRuntime(3610): at java.lang.reflect.Method.invoke(Method.java:511) 04-22 15:30:30.546: E/AndroidRuntime(3610): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:808) 04-22 15:30:30.546: E/AndroidRuntime(3610): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:575) 04-22 15:30:30.546: E/AndroidRuntime(3610): at dalvik.system.NativeStart.main(Native Method) 04-22 15:30:30.546: E/AndroidRuntime(3610): Caused by: java.lang.ArithmeticException: divide by zero 04-22 15:30:30.546: E/AndroidRuntime(3610): at com.example.ocr_test_13.MainActivity.FindConnectArea(MainActivity.java:1158) 04-22 15:30:30.546: E/AndroidRuntime(3610): at com.example.ocr_test_13.MainActivity.Identify(MainActivity.java:735) 04-22 15:30:30.546: E/AndroidRuntime(3610): at com.example.ocr_test_13.MainActivity.onActivityResult(MainActivity.java:514) 04-22 15:30:30.546: E/AndroidRuntime(3610): at android.app.Activity.dispatchActivityResult(Activity.java:5276) 04-22 15:30:30.546: E/AndroidRuntime(3610): at android.app.ActivityThread.deliverResults(ActivityThread.java:3174) 04-22 15:30:30.546: E/AndroidRuntime(3610): ... 11 more 04-22 15:42:22.025: E/dalvikvm(7360): threadid=11: created from interp,name=Thread-3708 04-22 15:42:22.025: E/dalvikvm(7360): threadid=11: calling run(),name=Thread-3708 04-22 15:42:22.105: E/lanageTag(7360): not use ``` ```

android ble蓝牙广播问题!!!!!!!!!!!!!!!!!!

使用ble蓝牙开发 在写入数据之后 设备返回的数据证明发送成功了 但是在广播中也会返回数据,我这边接收不到 使用别人的demo 可以接收到数据 这里有demo 哪位大哥帮忙看看代码有没有什么问题。 ``` package com.example.andysong.nuclearradiation.Ble; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothGatt; import android.bluetooth.BluetoothGattCallback; import android.bluetooth.BluetoothGattCharacteristic; import android.bluetooth.BluetoothGattDescriptor; import android.bluetooth.BluetoothGattService; import android.bluetooth.BluetoothProfile; import android.companion.BluetoothDeviceFilter; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.LinearLayout; import android.widget.Toast; import com.example.andysong.nuclearradiation.Ble.Adapter.MyAdapter; import com.example.andysong.nuclearradiation.Ble.BleTool.MyBluetoothDevice; import com.example.andysong.nuclearradiation.Ble.Entity.BleData; import com.example.andysong.nuclearradiation.R; import com.example.andysong.nuclearradiation.Uitl.Progess.DialProgress; import java.io.UnsupportedEncodingException; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import java.util.UUID; public class BleActivityTest extends AppCompatActivity implements View.OnClickListener, MyAdapter.OnScan { private static final String TAG = BleActivityTest.class.getName(); private Button btn_scan; private Button btn_w; private RecyclerView rv_list; private MyAdapter myAdapter; private BluetoothAdapter bAdapter; private BluetoothGatt bluetoothGatt; private Map<String, UUID> uuidMap; //private UUID uNotify = UUID.fromString("6e400003-b5a3-f393-e0a9-e50e24dcca9e"); //private UUID N_Notify = UUID.fromString("0000ffe0-0000-1000-8000-00805f9b34fb"); private UUID N_Notify = UUID.fromString("00001000-0000-1000-8000-00805f9b34fb"); //private UUID uNotify = UUID.fromString("0000ffe4-0000-1000-8000-00805f9b34fb"); private UUID uNotify = UUID.fromString("00001002-0000-1000-8000-00805f9b34fb"); //private UUID uRead = UUID.fromString("6e400003-b5a3-f393-e0a9-e50e24dcca9e"); //private UUID uWrite = UUID.fromString("6e400003-b5a3-f393-e0a9-e50e24dcca9e"); //private UUID N_Write = UUID.fromString("0000ffe5-0000-1000-8000-00805f9b34fb"); private UUID N_Write = UUID.fromString("00001000-0000-1000-8000-00805f9b34fb"); private static final UUID CLIENT_CHARACTERISTIC_CONFIG = UUID.fromString( "00002902-0000-1000-8000-00805f9b34fb"); //private UUID uWrite = UUID.fromString("0000ffe9-0000-1000-8000-00805f9b34fb"); private UUID uWrite = UUID.fromString("00001001-0000-1000-8000-00805f9b34fb"); private String READ = "read"; private String WRITE = "write"; private String NOTICE = "notice"; private Button btn_r; private Button btn_n; private Button btn_c; private DialProgress dialProgress; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_ble); initView(); initData(); } private void initView() { btn_scan = findViewById(R.id.btn_scan); btn_w = findViewById(R.id.btn_w); btn_r = findViewById(R.id.btn_r); btn_n = findViewById(R.id.btn_n); btn_c = findViewById(R.id.btn_c); btn_scan.setOnClickListener(this); btn_w.setOnClickListener(this); btn_r.setOnClickListener(this); btn_n.setOnClickListener(this); btn_c.setOnClickListener(this); rv_list = findViewById(R.id.rv_list); rv_list.setLayoutManager(new LinearLayoutManager(this, LinearLayout.VERTICAL, false)); myAdapter = new MyAdapter(this); myAdapter.setOnScan(this); rv_list.setAdapter(myAdapter); dialProgress = findViewById(R.id.dialprog); } private void initData() { bAdapter = BluetoothAdapter.getDefaultAdapter(); uuidMap = new HashMap<>(); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.btn_scan: scan(); break; case R.id.btn_w: writeData(); break; case R.id.btn_r: readData(); break; case R.id.btn_n: notifyData(); break; case R.id.btn_c: closeNotifyData(); break; } } /*关闭广播通知*/ private void closeNotifyData() { BluetoothGattCharacteristic characteristic = bluetoothGatt.getService(N_Notify).getCharacteristic(uNotify); BluetoothGattDescriptor descriptor = characteristic.getDescriptor(UUID.fromString("00002902-0000-1000-8000-00805f9b34fb")); descriptor.setValue(BluetoothGattDescriptor.DISABLE_NOTIFICATION_VALUE); bluetoothGatt.writeDescriptor(descriptor); } /*打开广播通知*/ private void notifyData() { BluetoothGattCharacteristic characteristic = bluetoothGatt.getService(N_Notify).getCharacteristic(uNotify); boolean b = bluetoothGatt.setCharacteristicNotification(characteristic, true); int originalWriteType = characteristic.getWriteType(); BluetoothGattDescriptor descriptor = characteristic.getDescriptor(CLIENT_CHARACTERISTIC_CONFIG); descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE); boolean b1 = bluetoothGatt.writeDescriptor(descriptor); characteristic.setWriteType(originalWriteType); } /*read 读取数据 返回的数据需要在监听事件接收*/ private void readData() { if (bluetoothGatt == null) { return; } BluetoothGattCharacteristic characteristic = bluetoothGatt.getService(UUID.fromString("00001000-0000-1000-8000-00805f9b34fb")). getCharacteristic(UUID.fromString("00001001-0000-1000-8000-00805f9b34fb")); bluetoothGatt.readCharacteristic(characteristic); } /*扫描设备*/ private void scan() { if (!bAdapter.isEnabled()) { Toast.makeText(this, "请打开蓝牙", Toast.LENGTH_SHORT).show(); return; } bAdapter.startLeScan(scanCallback); btn_scan.setText("扫描中"); btn_scan.setEnabled(false); } /*扫描到新的设备*/ private BluetoothAdapter.LeScanCallback scanCallback = new BluetoothAdapter.LeScanCallback() { @Override public void onLeScan(BluetoothDevice device, int rssi, byte[] scanRecord) { MyBluetoothDevice bluetoothDevice = new MyBluetoothDevice(device, rssi); addDevice(bluetoothDevice); // Log.e(TAG, "onLeScan: " + device.getAddress() + device.getName()); if (device.getAddress().equals("F6:6D:83:80:D6:8D")) { conn(bluetoothDevice); } //F6:6D:83:80:D6:8D } }; /*添加扫描的新设备*/ private void addDevice(MyBluetoothDevice bluetoothDevice) { List<MyBluetoothDevice> devices = myAdapter.getDevices(); for (MyBluetoothDevice device : devices) { if (device.getDevice().getAddress().equals(bluetoothDevice.getDevice().getAddress())) { return; } } myAdapter.upDate(bluetoothDevice); } /*item点击链接的方法*/ @Override public void conn(MyBluetoothDevice device) { bluetoothGatt = device.getDevice().connectGatt(this, false, mBluetoothGattCallback); } /*写数据 数据不会直接返回 需要在监听事件中回调*/ public void writeData() { if (bluetoothGatt == null) { return; } // bluetoothGatt.readRemoteRssi(); BluetoothGattCharacteristic characteristic = bluetoothGatt.getService(N_Write).getCharacteristic(uWrite); //characteristic.setValue("E5015101003420"); characteristic.setValue("EF52FFFAFFFF"); //characteristic.setWriteType(BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE); bluetoothGatt.writeCharacteristic(characteristic); } /*链接状态—ready—write-*/ BluetoothGattCallback mBluetoothGattCallback = new BluetoothGattCallback() { //链接状态更改时 @Override public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) { super.onConnectionStateChange(gatt, status, newState); if (newState == BluetoothProfile.STATE_CONNECTED) { gatt.discoverServices(); //查询支持的服务 bluetoothGatt = gatt; BleActivityTest.this.runOnUiThread(new Runnable() { @Override public void run() { btn_scan.setVisibility(View.GONE); btn_w.setVisibility(View.VISIBLE); btn_r.setVisibility(View.VISIBLE); btn_n.setVisibility(View.VISIBLE); btn_c.setVisibility(View.VISIBLE); } }); } else if (newState == BluetoothProfile.STATE_DISCONNECTED) { Log.e(TAG, "onConnectionStateChange: 断开"); BleActivityTest.this.runOnUiThread(new Runnable() { @Override public void run() { btn_scan.setEnabled(true); } }); } btn_scan.setText("扫描"); } //读取数据 @Override public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { super.onCharacteristicRead(gatt, characteristic, status); bluetoothGatt = gatt; if (status == BluetoothGatt.GATT_SUCCESS) { Log.e(TAG, "读取成功"); printALL(characteristic.getValue()); } else { Log.e(TAG, "读取失败"); } } //写出数据返回状态 @Override public void onCharacteristicWrite(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { super.onCharacteristicWrite(gatt, characteristic, status); bluetoothGatt = gatt; if (status == BluetoothGatt.GATT_SUCCESS) { Log.e(TAG, "onCharacteristicWrite发送成功"); printALL(characteristic.getValue()); } else { Log.e(TAG, "onCharacteristicWrite发送失败"); } } /*一般情况是 给设备发送指令使用应该*/ @Override public void onDescriptorRead(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) { super.onDescriptorRead(gatt, descriptor, status); bluetoothGatt = gatt; if (status == BluetoothGatt.GATT_SUCCESS) { Log.e(TAG, "onDescriptorRead读取成功"); printALL(descriptor.getValue()); } else { Log.e(TAG, "onDescriptorRead读取失败"); } } /*一般情况是 给设备发送指令使用应该*/ @Override public void onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) { super.onDescriptorWrite(gatt, descriptor, status); bluetoothGatt = gatt; if (status == BluetoothGatt.GATT_SUCCESS) { Log.e(TAG, "onDescriptorWrite发送成功"); printALL(descriptor.getValue()); } else { Log.e(TAG, "onDescriptorWrite发送失败"); } } /*接收通知 广播后 接收到的数据在这里*/ @Override public void onCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) { //super.onCharacteristicChanged(gatt, characteristic); //bluetoothGatt = gatt; byte[] value = characteristic.getValue(); try { String s=new String(value,"UTF-8"); Log.e(TAG, "onCharacteristicChanged: "+s); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } printNotify(value); } //返回信号强度的 @Override public void onReadRemoteRssi(BluetoothGatt gatt, int rssi, int status) { super.onReadRemoteRssi(gatt, rssi, status); bluetoothGatt = gatt; Log.e(TAG, "onReadRemoteRssi: " + rssi); } //返回支持的服务滴 @Override public void onServicesDiscovered(BluetoothGatt gatt, int status) { super.onServicesDiscovered(gatt, status); bluetoothGatt = gatt; read(gatt); } }; public void read(BluetoothGatt gatt) { List<BluetoothGattService> services = gatt.getServices(); for (BluetoothGattService service : services) { Log.e(TAG, "服务: " + service.getUuid() + "-----"); List<BluetoothGattCharacteristic> characteristics = service.getCharacteristics(); for (BluetoothGattCharacteristic characteristic : characteristics) { if ((characteristic.getProperties() & BluetoothGattCharacteristic.PROPERTY_READ) > 0) { uuidMap.put(READ, characteristic.getUuid()); Log.e(TAG, "读写属性: " + characteristic.getUuid()); for (BluetoothGattDescriptor bluetoothGattDescriptor:characteristic.getDescriptors()){ Log.e(TAG, "蓝牙描述符+++: " + bluetoothGattDescriptor.getUuid()); } } if ((characteristic.getProperties() & BluetoothGattCharacteristic.PROPERTY_WRITE) > 0) { uuidMap.put(WRITE, characteristic.getUuid()); Log.e(TAG, "写属性: " + characteristic.getUuid()); } if ((characteristic.getProperties() & BluetoothGattCharacteristic.PROPERTY_NOTIFY) > 0) { uuidMap.put(NOTICE, characteristic.getUuid()); Log.e(TAG, "通知属性: " + characteristic.getUuid()); for (BluetoothGattDescriptor bluetoothGattDescriptor : characteristic.getDescriptors()) { Log.e(TAG, "蓝牙描述符: " + bluetoothGattDescriptor.getUuid()); } } } } Set<String> strings = uuidMap.keySet(); for (String key : strings) { UUID uuid = uuidMap.get(key); Log.e(TAG, "list: " + uuid.toString()); } } private void printALL(byte[] b) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < b.length; i++) { sb.append(Integer.toHexString(b[i]) + " "); } Log.e(TAG, "printALL--------: " + sb.toString()); } private void printALL2(final byte[] b) { Log.e(TAG, "printALL2--------: " + byteToString(b)); BleActivityTest.this.runOnUiThread(new Runnable() { @Override public void run() { dialProgress.setValue2(Double.parseDouble(formatString(byteToString(b)).getData())); } }); } private void printNotify(final byte[] b) { Log.e(TAG, "printNotify--------: " + byteToString(b)); BleActivityTest.this.runOnUiThread(new Runnable() { @Override public void run() { dialProgress.setValue2(Double.parseDouble(formatString(byteToString(b)).getData())); } }); } /*显示给客户*/ private String byteToString(byte[] b) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < b.length; i++) { String s = String.valueOf(b[i]).replace("-", ""); String s1 = Integer.toHexString(Integer.valueOf(s)); if (i == 0 || i == 1) { char c = asciiToChar(Integer.valueOf(s)); sb.append(c + " "); continue; } else if (s1.length() == 1) { sb.append("0" + s1 + " "); continue; } sb.append(s1 + " "); } return sb.toString(); } /*ascii 转 字符*/ private char asciiToChar(int a) { return (char) a; } /*代码用来计算的数据*/ private BleData formatString(String v) { String value = v.replace(" ", ""); String command = value.substring(0, 2); String date = value.substring(2, 8); String company = value.substring(8, 10); String d = value.substring(10, 18); StringBuffer data = new StringBuffer(); boolean flag = true; for (int i = 0; i < d.length(); i++) { if (i == 0) { continue; } if (i % 2 != 0) { if (flag) { data.append(Integer.valueOf(d.substring(0, i + 1)) + "."); flag = false; } else { data.append(Integer.valueOf(d.substring(i - 1, i + 1))); } } } String crc = value.substring(18, value.length()); return new BleData(command, date, company, data.toString(), crc); } }; ```

[Android]ExpandableListView消息响应出错!麻烦帮忙看下!

final ExAdapter listAdapter = new ExAdapter(MeterOperateActivity.this); buttonListView.setAdapter(listAdapter); buttonListView.setGroupIndicator(null); buttonListView.setDivider(null); buttonListView.setOnGroupClickListener(new OnGroupClickListener() { @Override public boolean onGroupClick(ExpandableListView parent, View v,int groupPosition, long id) { for (int i = 0; i < listAdapter.getGroupCount(); i++) { if (groupPosition != i) { if(buttonListView.isGroupExpanded(i)){ buttonListView.collapseGroup(i); } } } return false; } }); 代码如上, 我想实现,一个分组展开时,其余分组收起!结果出现问题,错误如下: ![CSDN移动问答][1] [1]: http://img.my.csdn.net/uploads/201306/09/1370769728_8441.png

android studio 错误提示 no such table: shuju

Android Studio 本人初学android ,求帮忙看看有什么问题! public class ShujuSQLiteHelper extends SQLiteOpenHelper { public ShujuSQLiteHelper(Context context){ super(context,"shuju.db",null,5); } //当goods.db创建完成的时候,调用onCreate方法,在其中创建数据表 @Override public void onCreate(SQLiteDatabase db) { db.execSQL("create table shuju(id integer primary key autoincrement," + "name varchar(20)," + "price integer)" ); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { } } Caused by: android.database.sqlite.SQLiteException: no such table: shuju (code 1): , while compiling: alter table shuju add account varchar(20) default 1000 at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method) at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889) at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:500) at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588) at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58) at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:31) at android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1674) at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1605) at com.example.lenovo.gaoxiao30.ShujuSQLiteHelper.onUpgrade(ShujuSQLiteHelper.java:24) at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:256) at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:187) at com.example.lenovo.gaoxiao30.ShujuDao.query(ShujuDao.java:51) at com.example.lenovo.gaoxiao30.ShujuActivity.onCreate(ShujuActivity.java:34) at android.app.Activity.performCreate(Activity.java:5990) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)

Android使用真机调试在登录界面显示网络连接超时,求大佬帮忙看一下

后台部分用postman测试的话 输localhost/tjz.com/public/authphone带上参数是可以成功的 但前端我用Androidstudio连真机测试的话 就点登录会显示网络连接超时 用虚拟机登录的话也是这样 有这个提示: CANNOT TRANSLATE guest DNS ip 主要还是想在自己这边运行起来 别人在这块的host改成10.0.2.2之后点登录是可以连接上的 但我这边改了还是不行 不知道是还有什么没有配置好导致连接不上 ![图片说明](https://img-ask.csdn.net/upload/201812/10/1544372079_798566.png) 求大佬帮忙看一下!

Android应用socket创建失败,抛出IOException,大神帮忙看看因为什么

上代码: 服务器端 ``` package com.boge.server.model; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.OutputStream; import java.net.ServerSocket; import java.net.Socket; import java.util.Date; import com.boge.mq.common.User; import com.boge.mq.common.YQMessage; import com.boge.mq.common.YQMessageType; public class MQServer { ServerSocket mServerSocket = null; Socket mSocket = null; ObjectInputStream oic = null; ObjectOutputStream oos = null; public MQServer() { try { mServerSocket = new ServerSocket(30000); System.out.println("MQ服务器已启动 in " + new Date()); while (true) { mSocket = mServerSocket.accept(); oic = new ObjectInputStream(mSocket.getInputStream()); oic.close(); oos.close(); mSocket.close(); } } catch (IOException e) { e.printStackTrace(); } } } ``` Android应用界面: ``` package com.boge.mq.client.view; import com.boge.mq.R; import com.boge.mq.common.User; import com.goge.mq.client.model.ClientConServerThread; import com.goge.mq.client.model.MQClient; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.view.View; import android.view.View.OnClickListener; import android.view.Window; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class LoginActivity extends Activity { Context mContext = null; EditText et_account, et_password; public Handler handler; public User user=null; public ClientConServerThread clientThread; @Override protected void onCreate(Bundle savedInstanceState) { mContext = this; super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_login); et_account = (EditText) findViewById(R.id.et_account); et_password = (EditText) findViewById(R.id.et_password); handler = new Handler() { @Override public void handleMessage(Message msg) { if (msg.what == 0x123) { Intent intent = new Intent(mContext, MainActivity.class); startActivity(intent); } } }; Button btn_login = (Button) findViewById(R.id.btn_login); btn_login.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { login(123, "123"); } }); } public void login(int a, String p) { user=new User(); user.setAccount(a); user.setPassword(p); clientThread=new ClientConServerThread(handler,user); clientThread.start(); } } ``` socket线程 ``` package com.goge.mq.client.model; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.net.InetSocketAddress; import java.net.Socket; import java.net.SocketTimeoutException; import android.os.Handler; import android.os.Message; import com.boge.mq.common.User; import com.boge.mq.common.YQMessage; public class ClientConServerThread extends Thread { Socket socket = null; ObjectOutputStream osStream = null; ObjectInputStream inStream = null; User user; YQMessage mess = null; Handler handler; public Handler revHandler; public ClientConServerThread(Handler h, User u) { user = u; handler = h; } @Override public void run() { try { socket = new Socket(); try { socket.connect(new InetSocketAddress("192.168.1.140", 30000), 2000); } catch (SocketTimeoutException e) { e.printStackTrace(); } osStream = new ObjectOutputStream(socket.getOutputStream()); inStream = new ObjectInputStream(socket.getInputStream()); Message msg = new Message(); msg.what = 0x123; handler.sendMessage(msg); socket.close(); osStream.close(); inStream.close(); } catch (IOException e) { e.printStackTrace(); } } } ``` 我已确定,就是在厦门这句除了问题,抛出IO异常 ``` try { socket.connect(new InetSocketAddress("192.168.1.140", 30000), 2000); } ``` 求大神解答

android 直播在运行时报了错误,请大神帮忙看看

![图片说明](https://img-ask.csdn.net/upload/201711/02/1509609067_202427.jpg) 各位android大神请问这是哪里出问题了,如图所示,我想了一天没想出来哪里出问题了

android开发,在后台里面有数据,但Adapter没有接收到数据,找不到原因,帮忙看一下!!!

activity文件如下: //任务列表显示 listView = (ListView)findViewById(R.id.agv_rw); adapter = new AGV任务Adapter(this,dataList); listView.setAdapter(adapter); new 查询Task().execute();//查询任务 //任务列表选中一行数据 执行操作 listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { //点击执行 任务编号 = adapter.getItem(position).get任务编号(); if(!任务编号.equals("")){ //隐藏 ScrollView.setVisibility(View.GONE); //显示 rlrenwu.setVisibility(View.VISIBLE); } } }); class 查询Task extends AsyncTask<Void, Void, Result<List<物流任务表>>>{ @Override protected Result<List<物流任务表>> doInBackground(Void... voids) { Result<List<物流任务表>> res = new Result<>(); 物流任务表 wl = new 物流任务表(); String param = App.gson.toJson(wl); String result = HttpUtil.sendPost(PathUtil.查询任务, param); res = TaskUtil.handle(res, result, new TypeToken<Result<List<物流任务表>>>() { }.getType()); return res; } //事后执行 @Override protected void onPostExecute(Result<List<物流任务表>> res) { if(res.isFlag()){ adapter.setDatalist(res.getData()); adapter.notifyDataSetChanged(); } } } Adapter文件如下: public class AGV任务Adapter extends BaseAdapter { private Context context; private List<物流任务表> datalist; public AGV任务Adapter(Context context, List<物流任务表> datalist) { this.context = context; this.datalist = datalist; } public void setDatalist(List<物流任务表> datalist) { this.datalist = datalist; } @Override public int getCount() { return datalist.size(); } @Override public 物流任务表 getItem(int position) { return datalist.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View view, ViewGroup parent) { if(view == null){ view = LayoutInflater.from(context).inflate(R.layout.list_agvexception_item,null); } boolean ifdraw = true; ViewHolder viewHolder = null; if(view.getTag() != null && view.getTag() instanceof ViewHolder){ viewHolder = (ViewHolder)view.getTag(); } if(ifdraw){ viewHolder = new ViewHolder(); viewHolder.物流任务表 = datalist.get(position); viewHolder.tv任务编号 = (TextView)view.findViewById(R.id.rwbh); viewHolder.tvAGV编号 = (TextView)view.findViewById(R.id.agvbh); viewHolder.tv任务状态 = (TextView)view.findViewById(R.id.rwzt); viewHolder.tv任务类型 = (TextView)view.findViewById(R.id.rwlx); viewHolder.tv任务优先级 = (TextView)view.findViewById(R.id.rwyxj); viewHolder.tv起始站点 = (TextView)view.findViewById(R.id.qszd); viewHolder.tv目的站点 = (TextView)view.findViewById(R.id.mdzd); viewHolder.tv任务编号.setText(viewHolder.物流任务表.get任务编号()); viewHolder.tvAGV编号.setText(viewHolder.物流任务表.getAGV编号()); if(viewHolder.物流任务表.get任务状态().equals("0")){ viewHolder.tv任务状态.setText("未执行"); }else if(viewHolder.物流任务表.get任务状态().equals("1")){ viewHolder.tv任务状态.setText("执行中"); }else if(viewHolder.物流任务表.get任务状态().equals("2")){ viewHolder.tv任务状态.setText("已完成"); }else if(viewHolder.物流任务表.get任务状态().equals("3")){ viewHolder.tv任务状态.setText("强制取消"); }else if(viewHolder.物流任务表.get任务状态().equals("4")){ viewHolder.tv任务状态.setText("强制完成"); }else if(viewHolder.物流任务表.get任务状态().equals("5")){ viewHolder.tv任务状态.setText("任务已获取"); }else if(viewHolder.物流任务表.get任务状态().equals("6")){ viewHolder.tv任务状态.setText("任务中止"); }else if(viewHolder.物流任务表.get任务状态().equals("9")){ viewHolder.tv任务状态.setText("任务解析错误"); } if(viewHolder.物流任务表.get任务类型().equals("I")){ viewHolder.tv任务类型.setText("生产入库"); }else if(viewHolder.物流任务表.get任务类型().equals("O")){ viewHolder.tv任务类型.setText("物料出库"); }else if(viewHolder.物流任务表.get任务类型().equals("M")){ viewHolder.tv任务类型.setText("生产上料"); }else if(viewHolder.物流任务表.get任务类型().equals("T")){ viewHolder.tv任务类型.setText("物料入库"); }else if(viewHolder.物流任务表.get任务类型().equals("R")){ viewHolder.tv任务类型.setText("木制托盘回收"); }else if(viewHolder.物流任务表.get任务类型().equals("S")){ viewHolder.tv任务类型.setText("成品托盘运送"); }else if(viewHolder.物流任务表.get任务类型().equals("E")){ viewHolder.tv任务类型.setText("调拨"); }else if(viewHolder.物流任务表.get任务类型().equals("F")){ viewHolder.tv任务类型.setText("塑料托盘回收"); }else if(viewHolder.物流任务表.get任务类型().equals("G")){ viewHolder.tv任务类型.setText("塑料托盘循环"); } if(viewHolder.物流任务表.get任务优先级().equals("S")){ viewHolder.tv任务优先级.setText("1"); }else if(viewHolder.物流任务表.get任务优先级().equals("P")){ viewHolder.tv任务优先级.setText("2"); }else if(viewHolder.物流任务表.get任务优先级().equals("I")){ viewHolder.tv任务优先级.setText("3"); }else if(viewHolder.物流任务表.get任务优先级().equals("O")){ viewHolder.tv任务优先级.setText("4"); } viewHolder.tv起始站点.setText(viewHolder.物流任务表.get起始站点()); viewHolder.tv目的站点.setText(viewHolder.物流任务表.get目的站点()); } return view; } class ViewHolder{ 物流任务表 物流任务表; TextView tv任务编号,tvAGV编号,tv任务状态,tv任务类型,tv任务优先级,tv起始站点,tv目的站点; } } 其他数据都显示唯独AGV编号这个不显示,DEBUG一下发现没有接收到数据,是NULL,但是其他都有数据,后台WEBserver中也用测试类测试了,可以查到数据,没有报错日志很奇怪,麻烦大家帮忙看看是什么原因造成的。

Android8.0源码编译问题

目前在研究Android8.0最新源码,虽然8.0的源码还未稳定释放,但作为Android平台有必要了解每个版本的变化和进展,源代码已经download完毕,就是在编译的时候出现了问题,总是编译不过,未找到原因,错误中说依赖系统的两个库,但已经检查过了,系统这两个库已经存在。哪位大神帮忙看看呢,先谢谢了. ** 1. repo init -u https://android.googlesource.com/platform/manifest -b refs/heads/android-o-preview-2 2. repo sync 3. make ** ![图片说明](https://img-ask.csdn.net/upload/201707/20/1500531618_88910.png)

求助!在Android Studio 中跑程序最后 虚拟机界面总是出现Unfortunately,xxx has stopped

再看高德地图开发手册,跟着官网贴出的开发流程走显示3D地图,代码也没有错误,总是在最后的虚拟机页面无法显示,图片是logcat中标红部分,我看不懂找不出错误请教一下大家请问我是哪里出错了,因为是导师布置的任务好紧急,也没有C币,老师们不要嫌弃帮帮忙看看我这个小问题吧,希望能解决,谢谢大家 。![图片说明](https://img-ask.csdn.net/upload/201912/18/1576638824_873576.png) ![图片说明](https://img-ask.csdn.net/upload/201912/18/1576638935_649636.png)![图片说明](https://img-ask.csdn.net/upload/201912/18/1576638947_750704.jpg)![图片说明](https://img-ask.csdn.net/upload/201912/18/1576638959_248114.jpg)

在用Android studio打出Jar包时,提示错误,求大大帮忙看看。。。

在用Android studio打出Jar包时,./gradview makeJar总是提示“ '.' 不是内部或外部命令,也不是可运行程序或批处理文件” 以前是可以用的,但是现在却总是提示错误。不知道该怎么办了。。。 求各位大大帮忙解决一下~ ![图片说明](https://img-ask.csdn.net/upload/201606/22/1466581133_607773.png)

android中使用模拟器闪退问题

运行模拟器后,点击界面的任意控件都会弹出 很抱歉,”caihongpai“已停止运行 不知道这是为什么,求各位大神帮忙 logcat代码: ``` 03-09 07:50:14.924 3687-3687/? I/art: Late-enabling -Xcheck:jni 03-09 07:50:15.063 3687-3687/com.example.caihongpai W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter androidx.vectordrawable.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable 03-09 07:50:15.087 3687-3687/com.example.caihongpai I/art: Rejecting re-init on previously-failed class java.lang.Class<androidx.core.view.ViewCompat$OnUnhandledKeyEventListenerWrapper> 03-09 07:50:15.087 3687-3687/com.example.caihongpai I/art: Rejecting re-init on previously-failed class java.lang.Class<androidx.core.view.ViewCompat$OnUnhandledKeyEventListenerWrapper> 03-09 07:50:15.134 3687-3687/com.example.caihongpai D/AndroidRuntime: Shutting down VM 03-09 07:50:15.134 3687-3687/com.example.caihongpai E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.caihongpai, PID: 3687 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.caihongpai/com.example.caihongpai.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ImageButton.setOnClickListener(android.view.View$OnClickListener)' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2327) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392) at android.app.ActivityThread.access$800(ActivityThread.java:153) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1305) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5305) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ImageButton.setOnClickListener(android.view.View$OnClickListener)' on a null object reference at com.example.caihongpai.MainActivity.onCreate(MainActivity.java:121) at android.app.Activity.performCreate(Activity.java:5990) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2280) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392)  at android.app.ActivityThread.access$800(ActivityThread.java:153)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1305)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:135)  at android.app.ActivityThread.main(ActivityThread.java:5305)  at java.lang.reflect.Method.invoke(Native Method)  at java.lang.reflect.Method.invoke(Method.java:372)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)  下面的是.java代码: package com.example.caihongpai; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import android.content.DialogInterface; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.TextView; public class MainActivity extends AppCompatActivity { Button b1; ImageButton ib1,ib2,ib3; ImageView i1,i2,i3; TextView t1; static int[] s1={R.drawable.fangpian,R.drawable.heitao,R.drawable.hongtao}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); b1=(Button)findViewById(R.id.button); ib1=(ImageButton) findViewById(R.id.ib1); ib2=(ImageButton) findViewById(R.id.ib2); ib2=(ImageButton) findViewById(R.id.ib2); i1=(ImageView) findViewById(R.id.i1); i2=(ImageView) findViewById(R.id.i2); i3=(ImageView) findViewById(R.id.i3); ib1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ib1.setImageResource(s1[0]); ib2.setImageResource(s1[1]); ib3.setImageResource(s1[2]); if(s1[0]==R.drawable.hongtao){ new AlertDialog.Builder(MainActivity.this) .setTitle("奥利给") .setMessage("小伙子,你答对了,真是个天才!!") .setPositiveButton("确认",null) .show(); i3.setVisibility(View.VISIBLE); ib1.setVisibility(View.INVISIBLE); ib2.setVisibility(View.INVISIBLE); ib3.setVisibility(View.INVISIBLE); }else{ new AlertDialog.Builder(MainActivity.this) .setTitle("向我开炮") .setMessage("小傻瓜,你答错了,真是个小笨蛋!!") .setPositiveButton("确认",new DialogInterface.OnClickListener(){ @Override public void onClick(DialogInterface dialogInterface, int which) { return; } }) .setNegativeButton("再试一次", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { xp(); } }) .show(); i3.setVisibility(View.VISIBLE); ib1.setVisibility(View.INVISIBLE); ib2.setVisibility(View.INVISIBLE); ib3.setVisibility(View.INVISIBLE); } } }); ib2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ib1.setImageResource(s1[0]); ib2.setImageResource(s1[1]); ib3.setImageResource(s1[2]); if(s1[1]==R.drawable.hongtao){ new AlertDialog.Builder(MainActivity.this) .setTitle("奥利给") .setMessage("小伙子,你答对了,真是个天才!!") .setPositiveButton("确认",null) .show(); i3.setVisibility(View.VISIBLE); ib1.setVisibility(View.INVISIBLE); ib2.setVisibility(View.INVISIBLE); ib3.setVisibility(View.INVISIBLE); }else{ new AlertDialog.Builder(MainActivity.this) .setTitle("向我开炮") .setMessage("小傻瓜,你答错了,真是个小笨蛋!!") .setPositiveButton("确认",new DialogInterface.OnClickListener(){ @Override public void onClick(DialogInterface dialogInterface, int which) { return; } }) .setNegativeButton("再试一次", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { xp(); } }) .show(); i3.setVisibility(View.VISIBLE); ib1.setVisibility(View.INVISIBLE); ib2.setVisibility(View.INVISIBLE); ib3.setVisibility(View.INVISIBLE); } } }); ib3.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ib1.setImageResource(s1[0]); ib2.setImageResource(s1[1]); ib3.setImageResource(s1[2]); if(s1[2]==R.drawable.hongtao){ new AlertDialog.Builder(MainActivity.this) .setTitle("奥利给") .setMessage("小伙子,你答对了,真是个天才!!") .setPositiveButton("确认",null) .show(); i3.setVisibility(View.VISIBLE); ib1.setVisibility(View.INVISIBLE); ib2.setVisibility(View.INVISIBLE); ib3.setVisibility(View.INVISIBLE); }else{ new AlertDialog.Builder(MainActivity.this) .setTitle("向我开炮") .setMessage("小傻瓜,你答错了,真是个小笨蛋!!") .setPositiveButton("确认",new DialogInterface.OnClickListener(){ @Override public void onClick(DialogInterface dialogInterface, int which) { return; } }) .setNegativeButton("再试一次", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { xp(); } }) .show(); i3.setVisibility(View.VISIBLE); ib1.setVisibility(View.INVISIBLE); ib2.setVisibility(View.INVISIBLE); ib3.setVisibility(View.INVISIBLE); } } }); } private void xp() { for (int i = 0; i < 3; i++) { int tmp = s1[i]; int s = (int) (Math.random() * 2); s1[i] = s1[s]; s1[s] = tmp; } } } 下面的是xml代码: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="#0CC6BB" tools:context=".MainActivity"> <TextView android:id="@+id/text1" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="猜猜红桃A在哪" android:textSize="30dp" android:gravity="center" android:layout_marginTop="50dp" /> <FrameLayout android:layout_width="match_parent" android:layout_height="180dp" android:layout_margin="10dp" android:orientation="horizontal"> <LinearLayout android:layout_width="match_parent" android:layout_height="180dp" android:orientation="horizontal"> <ImageButton android:id="@+id/ib1" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="10dp" android:layout_weight="1" android:foregroundGravity="top" app:srcCompat="@drawable/beimian" /> <ImageButton android:id="@+id/ib2" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="10dp" android:layout_weight="1" android:foregroundGravity="top" app:srcCompat="@drawable/beimian" /> <ImageButton android:id="@+id/ib3" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="10dp" android:layout_weight="1" android:foregroundGravity="top" app:srcCompat="@drawable/beimian" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="180dp" android:orientation="horizontal"> <ImageView android:id="@+id/i1" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="10dp" android:layout_weight="1" app:srcCompat="@drawable/heitao" android:visibility="invisible"/> <ImageView android:id="@+id/i2" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="10dp" android:layout_weight="1" app:srcCompat="@drawable/fangpian" android:visibility="invisible"/> <ImageView android:id="@+id/i3" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="10dp" android:layout_weight="1" app:srcCompat="@drawable/hongtao" android:visibility="invisible" /> </LinearLayout> </FrameLayout> <Button android:id="@+id/button" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="20dp" android:text="让我再玩一次噻" android:textSize="20dp" /> </LinearLayout> ```

Android下面代码运行时候报错,仔细核对了控件名,没有问题,求各位大神帮忙看看

button_user_alert.setOnClickListener(new OnClickListener() { View view = View.inflate(DialogComponentTest.this, R.layout.user_dialog, null); final EditText userName = (EditText) findViewById(R.id.edit_text_name); final EditText passWord = (EditText) findViewById(R.id.edit_text_password); @Override public void onClick(View v) { new AlertDialog.Builder(DialogComponentTest.this) .setView(view) .setPositiveButton("取消", null) .setNegativeButton("确定", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { //这里出现nullPointerException,不知道该怎么处理,找不出问题所在 String strUserName = userName.getText().toString(); String strPassWord = passWord.getText().toString(); Toast.makeText(DialogComponentTest.this,strUserName +" : "+strPassWord, 0).show(); } }) .show(); } }); 错误信息如下: 01-13 13:41:16.472: E/SurfaceFlinger(794): ro.sf.lcd_density must be defined as a build property 01-13 13:41:20.792: E/SurfaceFlinger(794): ro.sf.lcd_density must be defined as a build property 01-13 13:41:27.512: E/AndroidRuntime(1878): FATAL EXCEPTION: main 01-13 13:41:27.512: E/AndroidRuntime(1878): java.lang.NullPointerException 01-13 13:41:27.512: E/AndroidRuntime(1878): at com.example.uitest.DialogComponentTest$3$1.onClick(DialogComponentTest.java:97) 01-13 13:41:27.512: E/AndroidRuntime(1878): at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:166) 01-13 13:41:27.512: E/AndroidRuntime(1878): at android.os.Handler.dispatchMessage(Handler.java:99) 01-13 13:41:27.512: E/AndroidRuntime(1878): at android.os.Looper.loop(Looper.java:137) 01-13 13:41:27.512: E/AndroidRuntime(1878): at android.app.ActivityThread.main(ActivityThread.java:5041) 01-13 13:41:27.512: E/AndroidRuntime(1878): at java.lang.reflect.Method.invokeNative(Native Method) 01-13 13:41:27.512: E/AndroidRuntime(1878): at java.lang.reflect.Method.invoke(Method.java:511) 01-13 13:41:27.512: E/AndroidRuntime(1878): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 01-13 13:41:27.512: E/AndroidRuntime(1878): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 01-13 13:41:27.512: E/AndroidRuntime(1878): at dalvik.system.NativeStart.main(Native Method) 01-13 13:41:27.572: E/SurfaceFlinger(794): ro.sf.lcd_density must be defined as a build property 01-13 13:41:29.352: E/Trace(1899): error opening trace file: No such file or directory (2) 01-13 13:41:29.383: E/SurfaceFlinger(794): ro.sf.lcd_density must be defined as a build property 01-13 13:41:29.393: E/SurfaceFlinger(794): ro.sf.lcd_density must be defined as a build property

Android使用pull解析xml文件 蠢萌新手 大神帮忙看下哪里出现错误

``` public class MainActivity extends AppCompatActivity { private List<Beauty> beautyList = null; private ListView listView; private ArrayAdapter<String> adapter; List<String> mlist = new ArrayList<String>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); listView = (ListView) findViewById(R.id.listView); beautyList = parseXMLwithPull(); if (beautyList != null) { for (int i = 0; i < beautyList.size(); i++) { mlist.add(beautyList.get(i).getName()); } } adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,mlist); listView.setAdapter(adapter); } private List<Beauty> parseXMLwithPull() { List<Beauty> mList = null; Beauty beauty = null; try { InputStream in = getAssets().open("beauties.xml"); XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); XmlPullParser parser = factory.newPullParser(); parser.setInput(in,"utf-8"); int eventType = parser.getEventType(); while (eventType != XmlPullParser.END_DOCUMENT) { String nodeName = parser.getName(); switch (eventType) { case XmlPullParser.START_DOCUMENT:{ mList = new ArrayList<Beauty>(); break; } case XmlPullParser.START_TAG:{ if(nodeName.equals("beauty")) { beauty = new Beauty(); } else if (nodeName.equals("name")) { beauty.setName(parser.nextText()); Log.d("MainActivity",beauty.getName()); } else if (nodeName.equals("age")) { beauty.setAge(parser.nextText()); } break; } case XmlPullParser.END_TAG: { if(nodeName.equals("beauty")) { mList.add(beauty); beauty = null; } break; } default: break; } eventType = parser.next(); } } catch (Exception e) { e.printStackTrace(); } return mList; } } ``` Beauty为封装好的Bean类,beauties为android studio 下新建assets文件夹下的xml安装后为什么在listView中显示不出来...

Android Studio添加了内部存储读取并且判断用户名和密码之后无法跳转到下一个页面,有没有人帮忙看一下的

package com.example.test; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.TextUtils; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import java.io.FileInputStream; import java.util.HashMap; import java.util.Map; public class MainActivity extends AppCompatActivity { private Button login; private Button register; private EditText etname; private EditText etpwd; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); login = (Button) findViewById(R.id.btn_login); register = (Button) findViewById(R.id.btn_register); etname = (EditText) findViewById(R.id.et_name); etpwd = (EditText) findViewById(R.id.et_password); login.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String name = etname.getText().toString().trim(); String pwd = etpwd.getText().toString().trim(); String content=""; try { FileInputStream fis=this.openFileInput("message.txt"); byte[] buffer = new byte[fis.available()]; fis.read(buffer); content = new String(buffer); Map<String, String> userMap = new HashMap<String, String>(); String[] infos = content.split(":"); userMap.put("name", infos[0]); userMap.put("pwd", infos[1]); fis.close(); return; }catch (Exception e){ if (name.length() == 0 || pwd.length() == 0) { Toast.makeText(MainActivity.this, "输入不能为空", Toast.LENGTH_SHORT).show(); //弹出一个自动消失的提示框 return; } else if ((TextUtils.isEmpty(name)) && (TextUtils.isEmpty(pwd))) { //页面跳转延迟线程 new Thread() { public void run() { super.run(); try { Thread.sleep(500); Intent i = new Intent(MainActivity.this, Activity.class); startActivity(i); } catch (InterruptedException e) { e.printStackTrace(); } } }.start(); } Toast.makeText(MainActivity.this, "登陆成功", Toast.LENGTH_SHORT).show(); return; } } private FileInputStream openFileInput(String s) { return null; } }); register.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent i = new Intent(MainActivity.this, RegisterActivity.class); startActivity(i); } }); } }

Android Studio Gradle一直出错,有会的大佬可以帮忙看下吗。

前几天突然出现的问题,真的不知道为什么会tu'ran这样,下面是这个截图-![图片说明](https://img-ask.csdn.net/upload/202003/16/1584357062_177316.png) 这个是错误的那段详情(已经重装好几次了进去还是这,百度好几天了还没头绪) ERROR: Unable to start the daemon process. This problem might be caused by incorrect configuration of the daemon. For example, an unrecognized jvm option is used. Please refer to the User Manual chapter on the daemon at https://docs.gradle.org/5.4.1/userguide/gradle_daemon.html Process command line: D:\Professional Software\AS\jre\bin\java.exe -Xmx1536m -Dfile.encoding=GBK -Duser.country=CN -Duser.language=zh -Duser.variant -cp C:\Users\12\.gradle\wrapper\dists\gradle-5.4.1-all\3221gyojl5jsh0helicew7rwx\gradle-5.4.1\lib\gradle-launcher-5.4.1.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 5.4.1 Please read the following process output to find out more: ----------------------- 错误: 找不到或无法加载主类 org.gradle.launcher.daemon.bootstrap.GradleDaemon

大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了

大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

点沙成金:英特尔芯片制造全过程揭密

“亚马逊丛林里的蝴蝶扇动几下翅膀就可能引起两周后美国德州的一次飓风……” 这句人人皆知的话最初用来描述非线性系统中微小参数的变化所引起的系统极大变化。 而在更长的时间尺度内,我们所生活的这个世界就是这样一个异常复杂的非线性系统…… 水泥、穹顶、透视——关于时间与技艺的蝴蝶效应 公元前3000年,古埃及人将尼罗河中挖出的泥浆与纳特龙盐湖中的矿物盐混合,再掺入煅烧石灰石制成的石灰,由此得来了人...

讲一个程序员如何副业月赚三万的真实故事

loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

我说我不会算法,阿里把我挂了。

不说了,字节跳动也反手把我挂了。

优雅的替换if-else语句

场景 日常开发,if-else语句写的不少吧??当逻辑分支非常多的时候,if-else套了一层又一层,虽然业务功能倒是实现了,但是看起来是真的很不优雅,尤其是对于我这种有强迫症的程序"猿",看到这么多if-else,脑袋瓜子就嗡嗡的,总想着解锁新姿势:干掉过多的if-else!!!本文将介绍三板斧手段: 优先判断条件,条件不满足的,逻辑及时中断返回; 采用策略模式+工厂模式; 结合注解,锦...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

为什么你不想学习?只想玩?人是如何一步一步废掉的

不知道是不是只有我这样子,还是你们也有过类似的经历。 上学的时候总有很多光辉历史,学年名列前茅,或者单科目大佬,但是虽然慢慢地长大了,你开始懈怠了,开始废掉了。。。 什么?你说不知道具体的情况是怎么样的? 我来告诉你: 你常常潜意识里或者心理觉得,自己真正的生活或者奋斗还没有开始。总是幻想着自己还拥有大把时间,还有无限的可能,自己还能逆风翻盘,只不是自己还没开始罢了,自己以后肯定会变得特别厉害...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发(16k)

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

你打算用Java 8一辈子都不打算升级到Java 14,真香

我们程序员应该抱着尝鲜、猎奇的心态,否则就容易固步自封,技术停滞不前。

无代码时代来临,程序员如何保住饭碗?

编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

《经典算法案例》01-08:如何使用质数设计扫雷(Minesweeper)游戏

我们都玩过Windows操作系统中的经典游戏扫雷(Minesweeper),如果把质数当作一颗雷,那么,表格中红色的数字哪些是雷(质数)?您能找出多少个呢?文中用列表的方式罗列了10000以内的自然数、质数(素数),6的倍数等,方便大家观察质数的分布规律及特性,以便对算法求解有指导意义。另外,判断质数是初学算法,理解算法重要性的一个非常好的案例。

《Oracle Java SE编程自学与面试指南》最佳学习路线图(2020最新版)

正确选择比瞎努力更重要!

一文带你入门Java Stream流,太强了

两个星期以前,就有读者强烈要求我写一篇 Java Stream 流的文章,我说市面上不是已经有很多了吗,结果你猜他怎么说:“就想看你写的啊!”你看你看,多么苍白的喜欢啊。那就“勉为其难”写一篇吧,嘻嘻。 单从“Stream”这个单词上来看,它似乎和 java.io 包下的 InputStream 和 OutputStream 有些关系。实际上呢,没毛关系。Java 8 新增的 Stream 是为...

立即提问
相关内容推荐