Android獲取設備信息

使用java:

 List<TableMessage> dataList=new ArrayList<TableMessage>();//獲取設備信息Hashtable<String,String> ht= MyDeviceInfo.getDeviceAllInfo2(LoginActivity.this);for (Map.Entry<String, String> entry : ht.entrySet()) {String key = entry.getKey();String value = entry.getValue();Log.d("Hashtable", "Key: " + key + ", Value: " + value);dataList.add(new TableMessage(key,value));}// String cpuABI = Build.CPU_ABI; // CPU架構(如arm64、x86)//int cpuCount = Runtime.getRuntime().availableProcessors(); // 邏輯核心數
//        String info = "架構:" + cpuABI + "+
//        核心數:" + cpuCount;// dataList.add(new TableMessage("核心數:",cpuCount+""));DialogTableDeviceInfo dialogTableDeviceInfo=new DialogTableDeviceInfo();dialogTableDeviceInfo.show(LoginActivity.this,"設備信息",dataList);

顯示xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"><TextViewandroid:id="@+id/TextViewTitleSucces"android:layout_width="match_parent"android:layout_height="wrap_content"android:text=""android:textAlignment="center"android:textColor="@color/btnsetting"android:textSize="16sp" /><LinearLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"android:layout_marginTop="5dp"android:orientation="horizontal"><ScrollViewandroid:layout_width="fill_parent"android:layout_height="match_parent"><HorizontalScrollViewandroid:layout_width="match_parent"android:layout_height="match_parent"><RelativeLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"android:orientation="horizontal"><!--  此處省略的組件的配置  --><LinearLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"><LinearLayoutandroid:id="@+id/LinearLayout1"android:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"><TextViewandroid:id="@+id/TextViewId"android:layout_width="30dp"android:layout_height="wrap_content"android:background="@drawable/border_background"android:text="@string/txt_dialog_id"android:textAlignment="center" /><TextViewandroid:id="@+id/TextViewName"android:layout_width="140dp"android:layout_height="wrap_content"android:background="@drawable/border_background"android:text="@string/txt_login_menu_about_name"android:textAlignment="center" /><TextViewandroid:id="@+id/TextViewQuantity"android:layout_width="300dp"android:layout_height="wrap_content"android:background="@drawable/border_background"android:text="@string/txt_login_menu_about_size"android:textAlignment="center" /></LinearLayout><androidx.recyclerview.widget.RecyclerViewandroid:id="@+id/recyclerView"android:layout_width="match_parent"android:layout_height="match_parent"android:clipToPadding="false"android:padding="0dp"android:scrollbars="horizontal|vertical" /></LinearLayout></RelativeLayout></HorizontalScrollView></ScrollView></LinearLayout>
<!--    <ListView-->
<!--        android:id="@+id/ListView_table"-->
<!--        android:layout_width="match_parent"-->
<!--        android:layout_height="wrap_content"-->
<!--        android:layout_weight="1"--><!--        android:scrollbars="horizontal|vertical">--><!--    </ListView>--><!--    <ListView-->
<!--        android:id="@+id/ListView_table_fail"-->
<!--        android:layout_width="match_parent"-->
<!--        android:layout_height="wrap_content"-->
<!--        android:layout_weight="1"--><!--        android:scrollbars="horizontal|vertical" />--></LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="wrap_content"android:textAlignment="center"tools:ignore="MissingDefaultResource"><TextViewandroid:id="@+id/TextViewId"android:layout_width="30dp"android:layout_height="wrap_content"android:background="@drawable/border_background"android:text="@string/txt_dialog_id"android:textAlignment="center" /><TextViewandroid:id="@+id/TextViewName"android:layout_width="140dp"android:layout_height="wrap_content"android:background="@drawable/border_background"android:paddingRight="5dp"android:text=""android:textAlignment="textEnd" /><TextViewandroid:id="@+id/TextViewQuantity"android:layout_width="400dp"android:layout_height="wrap_content"android:background="@drawable/border_background"android:text=""android:textAlignment="viewStart" /></LinearLayout>

設備信息java代碼:

package com.demo.util;import static android.content.Context.ACTIVITY_SERVICE;
import static android.util.Log.ERROR;
import static com.demo.util.FileUtilsPi.externalMemoryAvailable;import android.app.ActivityManager;
import android.content.Context;
import android.icu.text.DecimalFormat;
import android.os.Build;
import android.os.Environment;
import android.os.StatFs;
import android.telephony.TelephonyManager;
import android.util.Log;import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Hashtable;
import java.util.Locale;
public class MyDeviceInfo {//內存(RAM)信息獲取public void getMemoryInfo() {String str1 = "/proc/meminfo";String str2="";try {FileReader fr = new FileReader(str1);BufferedReader localBufferedReader = new BufferedReader(fr, 8192);while ((str2 = localBufferedReader.readLine()) != null) {Log.d("TAG", "---" + str2);}} catch (IOException e) {}}/*** 獲取可用手機內存(RAM)* @return*/public static long getAvailMemory(Context context) {ActivityManager am = (ActivityManager)context.getSystemService(ACTIVITY_SERVICE);ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();am.getMemoryInfo(mi);return mi.availMem;}/*** 獲取手機內部空間大小* @return*/public static long getTotalInternalStorgeSize() {File path = Environment.getDataDirectory();StatFs mStatFs = new StatFs(path.getPath());long blockSize = mStatFs.getBlockSize();long totalBlocks = mStatFs.getBlockCount();return totalBlocks * blockSize;}/*** 獲取手機內部可用空間大小* @return*/public static long getAvailableInternalStorgeSize() {File path = Environment.getDataDirectory();StatFs mStatFs = new StatFs(path.getPath());long blockSize = mStatFs.getBlockSize();long availableBlocks = mStatFs.getAvailableBlocks();return availableBlocks * blockSize;}/*** 獲取手機外部空間大小* @return*/public static long getTotalExternalStorgeSize() {if (externalMemoryAvailable()) {File path = Environment.getExternalStorageDirectory();StatFs mStatFs = new StatFs(path.getPath());long blockSize = mStatFs.getBlockSize();long totalBlocks = mStatFs.getBlockCount();return totalBlocks * blockSize;} else {return ERROR;}}/*** 獲取手機外部可用空間大小* @return*/public static long getAvailableExternalStorgeSize() {if (externalMemoryAvailable()) {File path = Environment.getExternalStorageDirectory();StatFs mStatFs = new StatFs(path.getPath());long blockSize = mStatFs.getBlockSize();long availableBlocks = mStatFs.getAvailableBlocks();return availableBlocks * blockSize;} else {return ERROR;}}/* 返回為字符串數組[0]為大小[1]為單位KB或MB */public static String formatSize(long size) {String suffix = "";float fSzie = 0;if (size >= 1024) {suffix = "KB";fSzie = size / 1024;if (fSzie >= 1024) {suffix = "MB";fSzie /= 1024;if (fSzie >= 1024) {suffix = "GB";fSzie /= 1024;}}}DecimalFormat formatter = new DecimalFormat("#0.00");// 字符顯示格式/* 每3個數字用,分隔,如1,000 */formatter.setGroupingSize(3);StringBuilder resultBuffer = new StringBuilder(formatter.format(fSzie));if (suffix != null) {resultBuffer.append(suffix);}return resultBuffer.toString();}/* 返回為字符串數組[0]為大小[1]為單位KB或MB */public static String[] formatSizeArr(long size) {String[] arr = new String[2];String suffix = "";float fSzie = 0;arr[0]="";if (size >= 1024) {suffix = "KB";fSzie = size / 1024;if (fSzie >= 1024) {suffix = "MB";fSzie /= 1024;if (fSzie >= 1024) {suffix = "GB";fSzie /= 1024;}}}DecimalFormat formatter = new DecimalFormat("#0.00");// 字符顯示格式/* 每3個數字用,分隔,如1,000 */formatter.setGroupingSize(3);StringBuilder resultBuffer = new StringBuilder(formatter.format(fSzie));if (suffix != null) {resultBuffer.append(suffix);}return arr;}/*** 獲取設備寬度(px)**/public static int getDeviceWidth(Context context) {return context.getResources().getDisplayMetrics().widthPixels;}/*** 獲取設備高度(px)*/public static int getDeviceHeight(Context context) {return context.getResources().getDisplayMetrics().heightPixels;}/*** 獲取設備的唯一標識, 需要 “android.permission.READ_Phone_STATE”權限*/public static String getIMEI(Context context) {TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);String deviceId = tm.getDeviceId();if (deviceId == null) {return "UnKnown";} else {return deviceId;}}/*** 獲取廠商名* **/public static String getDeviceManufacturer() {return android.os.Build.MANUFACTURER;}/*** 獲取產品名* **/public static String getDeviceProduct() {return android.os.Build.PRODUCT;}/*** 獲取手機品牌*/public static String getDeviceBrand() {return android.os.Build.BRAND;}/*** 獲取手機型號*/public static String getDeviceModel() {return android.os.Build.MODEL;}/*** 獲取手機主板名*/public static String getDeviceBoard() {return android.os.Build.BOARD;}/*** 設備名* **/public static String getDeviceDevice() {return android.os.Build.DEVICE;}/***** fingerprit 信息* **/public static String getDeviceFubgerprint() {return android.os.Build.FINGERPRINT;}/*** 硬件名** **/public static String getDeviceHardware() {return android.os.Build.HARDWARE;}/*** 主機** **/public static String getDeviceHost() {return android.os.Build.HOST;}/**** 顯示ID* **/public static String getDeviceDisplay() {return android.os.Build.DISPLAY;}/*** ID** **/public static String getDeviceId() {return android.os.Build.ID;}/*** 獲取手機用戶名** **/public static String getDeviceUser() {return android.os.Build.USER;}/*** 獲取手機 硬件序列號* **/public static String getDeviceSerial() {return android.os.Build.SERIAL;}/*** 獲取手機Android 系統SDK** @return*/public static int getDeviceSDK() {return android.os.Build.VERSION.SDK_INT;}/*** 獲取手機Android 版本** @return*/public static String getDeviceAndroidVersion() {return android.os.Build.VERSION.RELEASE;}/*** 獲取當前手機系統語言。*/public static String getDeviceDefaultLanguage() {return Locale.getDefault().getLanguage();}/*** 獲取當前系統上的語言列表(Locale列表)*/public static String getDeviceSupportLanguage() {Log.e("wangjie", "Local:" + Locale.GERMAN);Log.e("wangjie", "Local:" + Locale.ENGLISH);Log.e("wangjie", "Local:" + Locale.US);Log.e("wangjie", "Local:" + Locale.CHINESE);Log.e("wangjie", "Local:" + Locale.TAIWAN);Log.e("wangjie", "Local:" + Locale.FRANCE);Log.e("wangjie", "Local:" + Locale.FRENCH);Log.e("wangjie", "Local:" + Locale.GERMANY);Log.e("wangjie", "Local:" + Locale.ITALIAN);Log.e("wangjie", "Local:" + Locale.JAPAN);Log.e("wangjie", "Local:" + Locale.JAPANESE);StringBuilder sb=new StringBuilder();sb.append(Locale.CHINESE+"、"+Locale.US);return sb.toString();}public static String getDeviceAllInfo(Context context) {return "\n\n1. IMEI:\n\t\t" + getIMEI(context)+ "\n\n2. 設備寬度:\n\t\t" + getDeviceWidth(context)+ "\n\n3. 設備高度:\n\t\t" + getDeviceHeight(context)+ "\n\n4. 是否有內置SD卡:\n\t\t" + SDCardUtils.isSDCardMount()+ "\n\n5. RAM 信息:\n\t\t" + SDCardUtils.getRAMInfo(context)+ "\n\n6. 內部存儲信息\n\t\t" + SDCardUtils.getStorageInfo(context, 0)+ "\n\n7. SD卡 信息:\n\t\t" + SDCardUtils.getStorageInfo(context, 1)//                + "\n\n8. 是否聯網:\n\t\t" + Utils.isNetworkConnected(context)
//
//                + "\n\n9. 網絡類型:\n\t\t" + Utils.GetNetworkType(context)+ "\n\n10. 系統默認語言:\n\t\t" + getDeviceDefaultLanguage()+ "\n\n11. 硬件序列號(設備名):\n\t\t" + android.os.Build.SERIAL+ "\n\n12. 手機型號:\n\t\t" + android.os.Build.MODEL+ "\n\n13. 生產廠商:\n\t\t" + android.os.Build.MANUFACTURER+ "\n\n14. 手機Fingerprint標識:\n\t\t" + android.os.Build.FINGERPRINT+ "\n\n15. Android 版本:\n\t\t" + android.os.Build.VERSION.RELEASE+ "\n\n16. Android SDK版本:\n\t\t" + android.os.Build.VERSION.SDK_INT+ "\n\n17. 安全patch 時間:\n\t\t" + android.os.Build.VERSION.SECURITY_PATCH//                + "\n\n18. 發布時間:\n\t\t" + Utils.Utc2Local(android.os.Build.TIME)+ "\n\n19. 版本類型:\n\t\t" + android.os.Build.TYPE+ "\n\n20. 用戶名:\n\t\t" + android.os.Build.USER+ "\n\n21. 產品名:\n\t\t" + android.os.Build.PRODUCT+ "\n\n22. ID:\n\t\t" + android.os.Build.ID+ "\n\n23. 顯示ID:\n\t\t" + android.os.Build.DISPLAY+ "\n\n24. 硬件名:\n\t\t" + android.os.Build.HARDWARE+ "\n\n25. 產品名:\n\t\t" + android.os.Build.DEVICE+ "\n\n26. Bootloader:\n\t\t" + android.os.Build.BOOTLOADER+ "\n\n27. 主板名:\n\t\t" + android.os.Build.BOARD+ "\n\n28. CodeName:\n\t\t" + android.os.Build.VERSION.CODENAME+ "\n\n29. 語言支持:\n\t\t" + getDeviceSupportLanguage();}public static String GetDeivceAllInfo2(){String DeviceMessage="產品 :" + android.os.Build.PRODUCT+"\nCPU_ABI :" + android.os.Build.CPU_ABI+ "\n 標簽 :" + android.os.Build.TAGS+ "\n VERSION_CODES.BASE:" + android.os.Build.VERSION_CODES.BASE+ "\n 型號:" + android.os.Build.MODEL+"\n SDK : " + android.os.Build.VERSION.SDK+"\n Android 版本 : " + android.os.Build.VERSION.RELEASE+ "\n 驅動 : " + android.os.Build.DEVICE+"\n DISPLAY: " + android.os.Build.DISPLAY+"\n 品牌 : " + android.os.Build.BRAND+"\n 基板 : " + android.os.Build.BOARD+"\n 設備標識 : " + android.os.Build.FINGERPRINT+"\n 版本號 : " + android.os.Build.ID+ "\n 制造商 : " + android.os.Build.MANUFACTURER+"\n 用戶 : " + android.os.Build.USER+"\n CPU_ABI2 : "+android.os.Build.CPU_ABI2+"\n 硬件 : "+ android.os.Build.HARDWARE+"\n 主機地址 :"+android.os.Build.HOST+"\n 未知信息 : "+android.os.Build.UNKNOWN+"\n  版本類型 : "+android.os.Build.TYPE+"\n  時間 : "+String.valueOf(android.os.Build.TIME)+"\n  Radio : "+android.os.Build.RADIO+"\n  序列號 : "+android.os.Build.SERIAL;return DeviceMessage;}public static  Hashtable<String,String> getDeviceAllInfo2(Context context) {Hashtable<String,String> ht=new Hashtable<String,String>();//  ht.put("IMEI:",getIMEI(context));ht.put("設備寬度:",getDeviceWidth(context)+"");ht.put("設備高度:",getDeviceHeight(context)+"");ht.put("RAM 信息:",SDCardUtils.getRAMInfo(context)+"");ht.put("內部存儲信息:",SDCardUtils.getStorageInfo(context, 0)+"");ht.put("是否有內置SD卡:",SDCardUtils.isSDCardMount()+"");ht.put("SD卡信息:",SDCardUtils.getStorageInfo(context, 1)+"");ht.put("系統默認語言:",getDeviceDefaultLanguage()+"");ht.put("硬件序列號(設備名):", android.os.Build.SERIAL+"");ht.put("設備型號:",android.os.Build.MODEL+"");ht.put("生產廠商:",android.os.Build.MANUFACTURER+"");//  ht.put("手機Fingerprint標識:",android.os.Build.FINGERPRINT+"");ht.put("Android 版本:",android.os.Build.VERSION.RELEASE+"");ht.put("Android SDK版本:",android.os.Build.VERSION.SDK_INT+"");ht.put("安全patch 時間:",android.os.Build.VERSION.SECURITY_PATCH+"");ht.put("版本類型:",android.os.Build.TYPE+"");ht.put("用戶名:",android.os.Build.USER+"");ht.put("ID:",android.os.Build.ID+"");ht.put("顯示ID:",android.os.Build.DISPLAY+"");ht.put("硬件名:",android.os.Build.HARDWARE+"");ht.put("產品名:",android.os.Build.DEVICE+"");ht.put("Bootloader:",android.os.Build.BOOTLOADER+"");ht.put("主板名:",android.os.Build.BOARD+"");ht.put("主機:", Build.HOST+"");ht.put("CodeName:",android.os.Build.VERSION.CODENAME+"");ht.put("語言支持:",getDeviceSupportLanguage()+"");//支持卡槽數量(sdk_version>=23才可取值,否則為0slot_count//  ht.put(" 支持卡槽數量:",android.os.Build.+"");ht.put("CPU名字:", Build.CPU_ABI+"");ht.put("CPU_ABI2:", android.os.Build.CPU_ABI2+"");ht.put("CPU核心數:", Runtime.getRuntime().availableProcessors()+"");//        ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
//        if (activityManager == null) {
//            throw new IllegalStateException("ActivityManager is not available");
//        }
//
//        // 創建MemoryInfo對象并填充數據
//        ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
//        activityManager.getMemoryInfo(memoryInfo);
//
//        // 提取總運行內存和可用運行內存
//        long totalMemory = memoryInfo.totalMem; // 總運行內存(含已用)
//        long availableMemory = memoryInfo.availMem; // 可用運行內存(不含已用)
// 轉換為 MB(保留兩位小數)
//        String totalMemoryMB = String.format("%.2f GB", totalMemory / (1024.0 * 1024*1024));
//        String availableMemoryMB = String.format("%.2f GB", availableMemory / (1024.0 * 1024*1024));
//        ht.put("運行內存:", "總運行內存/可用運行內存"+totalMemoryMB+"/"+availableMemoryMB+"");// ht.put(" 藍牙mac地址:", android.os.Build+"");//        String message= "\n\n1. IMEI:\n\t\t" + getIMEI(context)
//
//                + "\n\n2. 設備寬度:\n\t\t" + getDeviceWidth(context)
//
//                + "\n\n3. 設備高度:\n\t\t" + getDeviceHeight(context)
//
//                + "\n\n4. 是否有內置SD卡:\n\t\t" + SDCardUtils.isSDCardMount()
//
//                + "\n\n5. RAM 信息:\n\t\t" + SDCardUtils.getRAMInfo(context)
//
//                + "\n\n6. 內部存儲信息\n\t\t" + SDCardUtils.getStorageInfo(context, 0)
//
//                + "\n\n7. SD卡 信息:\n\t\t" + SDCardUtils.getStorageInfo(context, 1)
//+ "\n\n8. 是否聯網:\n\t\t" + Utils.isNetworkConnected(context)+ "\n\n9. 網絡類型:\n\t\t" + Utils.GetNetworkType(context)
//
//                + "\n\n10. 系統默認語言:\n\t\t" + getDeviceDefaultLanguage()
//
//                + "\n\n11. 硬件序列號(設備名):\n\t\t" + android.os.Build.SERIAL
//
//                + "\n\n12. 手機型號:\n\t\t" + android.os.Build.MODEL
//
//                + "\n\n13. 生產廠商:\n\t\t" + android.os.Build.MANUFACTURER
//
//                + "\n\n14. 手機Fingerprint標識:\n\t\t" + android.os.Build.FINGERPRINT
//
//                + "\n\n15. Android 版本:\n\t\t" + android.os.Build.VERSION.RELEASE
//
//                + "\n\n16. Android SDK版本:\n\t\t" + android.os.Build.VERSION.SDK_INT
//
//                + "\n\n17. 安全patch 時間:\n\t\t" + android.os.Build.VERSION.SECURITY_PATCH
//+ "\n\n18. 發布時間:\n\t\t" + Utils.Utc2Local(android.os.Build.TIME)
//
//                + "\n\n19. 版本類型:\n\t\t" + android.os.Build.TYPE
//
//                + "\n\n20. 用戶名:\n\t\t" + android.os.Build.USER
//
//                + "\n\n21. 產品名:\n\t\t" + android.os.Build.PRODUCT
//
//                + "\n\n22. ID:\n\t\t" + android.os.Build.ID
//
//                + "\n\n23. 顯示ID:\n\t\t" + android.os.Build.DISPLAY
//
//                + "\n\n24. 硬件名:\n\t\t" + android.os.Build.HARDWARE
//
//                + "\n\n25. 產品名:\n\t\t" + android.os.Build.DEVICE
//
//                + "\n\n26. Bootloader:\n\t\t" + android.os.Build.BOOTLOADER
//
//                + "\n\n27. 主板名:\n\t\t" + android.os.Build.BOARD
//
//                + "\n\n28. CodeName:\n\t\t" + android.os.Build.VERSION.CODENAME
//                + "\n\n29. 語言支持:\n\t\t" + getDeviceSupportLanguage();getCPUInfo();return ht;}public static String getCPUInfo() {StringBuilder cpuInfo = new StringBuilder();try {// 執行cat命令讀取文件Process process = Runtime.getRuntime().exec("cat /proc/cpuinfo");BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));String line;while ((line = reader.readLine()) != null) {cpuInfo.append(line).append("");Log.d("MemoryInfo", "Available RAM: " + line);}reader.close();} catch (IOException e) {e.printStackTrace();return "獲取失敗";}return cpuInfo.toString();}public static  String getRAM(Context context){//        // 獲取內存信息
//        ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
//        ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
//        activityManager.getMemoryInfo(memoryInfo);
//提取數據并轉換單位
//        long totalMemory = memoryInfo.totalMem;
//        long availableMemory = memoryInfo.availMem;
//轉換為 MB(保留兩位小數)
//        String totalMemoryMB = String.format("%.2f MB", totalMemory / (1024.0 * 1024));
//        String availableMemoryMB = String.format("%.2f MB", availableMemory / (1024.0 * 1024));
//
//        Log.d("MemoryInfo", "Total RAM: " + totalMemoryMB);
//        Log.d("MemoryInfo", "Available RAM: " + availableMemoryMB);return "";}/*** 獲取CPU總運行內存和可用運行內存(單位:字節)** @param context 應用上下文* @return 包含總運行內存和可用運行內存的數組,索引0為總內存,索引1為可用內存*/public static String[] getCpuAndAvailableMemory(Context context) {// 獲取ActivityManager實例ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);if (activityManager == null) {throw new IllegalStateException("ActivityManager is not available");}// 創建MemoryInfo對象并填充數據ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();activityManager.getMemoryInfo(memoryInfo);// 提取總運行內存和可用運行內存long totalMemory = memoryInfo.totalMem; // 總運行內存(含已用)long availableMemory = memoryInfo.availMem; // 可用運行內存(不含已用)轉換為 MB(保留兩位小數)String totalMemoryMB = String.format("%.2f MB", totalMemory / (1024.0 * 1024));String availableMemoryMB = String.format("%.2f MB", availableMemory / (1024.0 * 1024));return new String[]{totalMemoryMB, availableMemoryMB};}
}
package com.uhf200.demo.util;import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Color;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;import com.uhf200.demo.R;
import com.uhf200.demo.ui.model.TableMessage;import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;public class DialogTableDeviceInfo {public static AlertDialog alertDialog3; //輸入彈出框public static ListView dialog_ListView;public static DialogAdapter dialogAdapter;private static List<TableMessage> mArrCard;//返回失敗的信息public static ListView dialog_ListView_fail;public static DialogFailAdapter dialogFailAdapter;private static List<TableMessage> mArrCard_fail;public  void show(Context context, String title_succes,List<TableMessage> dataList) {AlertDialog.Builder alertBuilder = new AlertDialog.Builder(context);alertBuilder.setTitle("設備信息");mArrCard=new ArrayList<TableMessage>();mArrCard_fail=new ArrayList<TableMessage>();mArrCard=dataList;// 引入自己設計的xml//成功的提示信息View dialogView = LayoutInflater.from(context).inflate(R.layout.dialog_table_device_info,null);TextView TextViewSucces= dialogView.findViewById(R.id.TextViewTitleSucces);LinearLayout LinearLayout1= dialogView.findViewById(R.id.LinearLayout1);LinearLayout LinearLayout2= dialogView.findViewById(R.id.LinearLayout2);//        dialog_ListView = (ListView) dialogView.findViewById(R.id.ListView_table);
//
//        dialogAdapter = new DialogAdapter(context, mArrCard);
//
//        dialog_ListView.setAdapter(dialogAdapter);
//
//        dialog_ListView.setVerticalScrollBarEnabled(true);//失敗的信息//        dialog_ListView_fail = (ListView) dialogView.findViewById(R.id.ListView_table_fail);
//
//        dialogFailAdapter = new DialogFailAdapter(context, mArrCard_fail);
//
//        dialog_ListView_fail.setAdapter(dialogFailAdapter);
//
//        dialog_ListView_fail.setVerticalScrollBarEnabled(true);// TableLayout tableLayout = dialogView.findViewById(R.id.table_layout);TextViewSucces.setText(title_succes);//        dialogAdapter.notifyDataSetChanged();
//        dialogFailAdapter.notifyDataSetChanged();alertBuilder.setView(dialogView);alertBuilder.setPositiveButton("確定", new DialogInterface.OnClickListener() {@Overridepublic void onClick(DialogInterface dialogInterface, int i) {alertDialog3.dismiss();}});//成功的信息RecyclerView recyclerView = dialogView.findViewById(R.id.recyclerView);// 設置垂直列表布局recyclerView.setLayoutManager(new LinearLayoutManager(context));// 準備測試數據List<TableMessage> userList = new ArrayList<>();
//        for (int i=0;i<100;i++){
//            userList.add(new TableMessage("張三"+i, "2"+i));
//        }
//
//        userList.add(new TableMessage("李四", "30"));
//        userList.add(new TableMessage("王五", "28"));// 添加更多數據...if(dataList.size()>0){userList=dataList;}else {TextViewSucces.setVisibility(View.GONE);recyclerView.setVisibility(View.GONE);LinearLayout1.setVisibility(View.GONE);LinearLayout2.setVisibility(View.GONE);}// 創建并設置 AdapterUserAdapter adapter = new UserAdapter(userList);recyclerView.setAdapter(adapter);//添加數據
//        for (int i = 0; i < dataList.size(); i++) {
//
//            TableMessage tableMessage=dataList.get(i);
//            addDataRow(context,tableLayout, i + 1,
//                    tableMessage.getName(),
//                    tableMessage.getQuantity());
//        }//        alertBuilder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
//            @Override
//            public void onClick(DialogInterface dialogInterface, int i) {
//
//                alertDialog3.dismiss();
//
//            }
//        });alertDialog3 = alertBuilder.create();alertDialog3.show();}public  void show(Context context, String title_succes,String title_fail,List<TableMessage> dataList,  List<TableMessage> dataList_fail,String errorMessage) {AlertDialog.Builder alertBuilder = new AlertDialog.Builder(context);alertBuilder.setTitle("設備信息");mArrCard=new ArrayList<TableMessage>();mArrCard_fail=new ArrayList<TableMessage>();mArrCard=dataList;mArrCard_fail=dataList_fail;// 引入自己設計的xml//成功的提示信息View dialogView = LayoutInflater.from(context).inflate(R.layout.dialog_table_device_info,null);TextView TextViewSucces= dialogView.findViewById(R.id.TextViewTitleSucces);LinearLayout LinearLayout1= dialogView.findViewById(R.id.LinearLayout1);LinearLayout LinearLayout2= dialogView.findViewById(R.id.LinearLayout2);//        dialog_ListView = (ListView) dialogView.findViewById(R.id.ListView_table);
//
//        dialogAdapter = new DialogAdapter(context, mArrCard);
//
//        dialog_ListView.setAdapter(dialogAdapter);
//
//        dialog_ListView.setVerticalScrollBarEnabled(true);//失敗的信息//        dialog_ListView_fail = (ListView) dialogView.findViewById(R.id.ListView_table_fail);
//
//        dialogFailAdapter = new DialogFailAdapter(context, mArrCard_fail);
//
//        dialog_ListView_fail.setAdapter(dialogFailAdapter);
//
//        dialog_ListView_fail.setVerticalScrollBarEnabled(true);// TableLayout tableLayout = dialogView.findViewById(R.id.table_layout);TextViewSucces.setText(title_succes);//        dialogAdapter.notifyDataSetChanged();
//        dialogFailAdapter.notifyDataSetChanged();alertBuilder.setView(dialogView);alertBuilder.setPositiveButton("確定", new DialogInterface.OnClickListener() {@Overridepublic void onClick(DialogInterface dialogInterface, int i) {alertDialog3.dismiss();}});//成功的信息RecyclerView recyclerView = dialogView.findViewById(R.id.recyclerView);// 設置垂直列表布局recyclerView.setLayoutManager(new LinearLayoutManager(context));// 準備測試數據List<TableMessage> userList = new ArrayList<>();
//        for (int i=0;i<100;i++){
//            userList.add(new TableMessage("張三"+i, "2"+i));
//        }
//
//        userList.add(new TableMessage("李四", "30"));
//        userList.add(new TableMessage("王五", "28"));// 添加更多數據...if(dataList.size()>0){userList=dataList;}else {TextViewSucces.setVisibility(View.GONE);recyclerView.setVisibility(View.GONE);LinearLayout1.setVisibility(View.GONE);LinearLayout2.setVisibility(View.GONE);}// 創建并設置 AdapterUserAdapter adapter = new UserAdapter(userList);recyclerView.setAdapter(adapter);//添加數據
//        for (int i = 0; i < dataList.size(); i++) {
//
//            TableMessage tableMessage=dataList.get(i);
//            addDataRow(context,tableLayout, i + 1,
//                    tableMessage.getName(),
//                    tableMessage.getQuantity());
//        }//        alertBuilder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
//            @Override
//            public void onClick(DialogInterface dialogInterface, int i) {
//
//                alertDialog3.dismiss();
//
//            }
//        });alertDialog3 = alertBuilder.create();alertDialog3.show();}private static void addDataRow(Context context,TableLayout tableLayout,int index,String name,String quantity) {TableRow dataRow = new TableRow(tableLayout.getContext());dataRow.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT,TableRow.LayoutParams.WRAP_CONTENT));// 序號列TextView tvIndex = createTextView(context,String.valueOf(index),Color.BLACK,Gravity.LEFT);dataRow.addView(tvIndex);// 名稱列TextView tvName = createTextView(context,name,Color.BLACK,Gravity.START);dataRow.addView(tvName);// 數量列TextView tvQuantity = createTextView(context,quantity,Color.BLACK,Gravity.CENTER);dataRow.addView(tvQuantity);// 添加底部邊框
//        View divider = new View(tableLayout.getContext());
//        divider.setLayoutParams(new TableRow.LayoutParams(
//                TableRow.LayoutParams.MATCH_PARENT,
//                2));
//        divider.setBackgroundColor(Color.LTGRAY);
//        dataRow.addView(divider);tableLayout.addView(dataRow);}private static TextView createTextView(Context context,String text,int textColor,int gravity) {TextView tv = new TextView(context);tv.setLayoutParams(new TableRow.LayoutParams(0,TableRow.LayoutParams.WRAP_CONTENT,1f));tv.setText(text);tv.setTextColor(textColor);tv.setGravity(gravity);tv.setPadding(16, 12, 16, 12);return tv;}public  class DialogAdapter extends BaseAdapter {private  Context context;private LayoutInflater inflater;public List<TableMessage> arraylist;public int i=1;//刷新數據public int optionindex;public DialogAdapter(Context context) {super();this.context = context;inflater = LayoutInflater.from(context);arraylist = new ArrayList<TableMessage>();}public DialogAdapter( Context context, List<TableMessage> arraylist) {super();inflater = LayoutInflater.from(context);this.context = context;this.arraylist = arraylist;}@Overridepublic int getCount() {// TODO Auto-generated method stubreturn arraylist.size();}@Overridepublic Object getItem(int arg0) {// TODO Auto-generated method stubreturn arg0;}@Overridepublic long getItemId(int arg0) {// TODO Auto-generated method stubreturn arg0;}@Overridepublic View getView(final int position, View convertView, ViewGroup parent) {// TODO Auto-generated method stubViewDialog viewDialog=null;try {if (convertView == null) {viewDialog=new ViewDialog();convertView=inflater.inflate(R.layout.device_item_info, null);viewDialog.tvId = (TextView)convertView.findViewById(R.id.TextViewId);viewDialog.tv_Name= (TextView) convertView.findViewById(R.id.TextViewName);viewDialog.tv_Quantity= (TextView) convertView.findViewById(R.id.TextViewQuantity);}else {viewDialog = (ViewDialog)convertView.getTag();// resetViewHolder(viewDialog);}TableMessage tableMessage = arraylist.get(position);viewDialog.tvId.setText((position+1)+"");viewDialog.tv_Name.setText(tableMessage.getName());viewDialog.tv_Quantity.setText(tableMessage.getQuantity());return convertView;} catch (Exception e) {Log.d("debugAdd", "3測試添加數據有誤" + e.toString());return convertView;// throw new RuntimeException(e);}/// return view;}protected void resetViewHolder(ViewDialog p_ViewHolder){p_ViewHolder.tvId.setText(null);p_ViewHolder.tv_Name.setText(null);p_ViewHolder.tv_Quantity.setText(null);}private class ViewDialog{private TextView tvId;private TextView tv_Name;private TextView tv_Quantity;}}public  class DialogFailAdapter extends BaseAdapter {private  Context context;private LayoutInflater inflater;public List<TableMessage> arraylist;public Hashtable<String,String> ht_AssetNames;public int i=1;//刷新數據public int optionindex;public DialogFailAdapter(Context context) {super();this.context = context;inflater = LayoutInflater.from(context);arraylist = new ArrayList<TableMessage>();ht_AssetNames=new Hashtable<String,String>();}public DialogFailAdapter( Context context, List<TableMessage> arraylist) {super();inflater = LayoutInflater.from(context);this.context = context;this.arraylist = arraylist;ht_AssetNames=new Hashtable<String,String>();}@Overridepublic int getCount() {// TODO Auto-generated method stubreturn arraylist.size();}@Overridepublic Object getItem(int arg0) {// TODO Auto-generated method stubreturn arg0;}@Overridepublic long getItemId(int arg0) {// TODO Auto-generated method stubreturn arg0;}@Overridepublic View getView(final int position, View view, ViewGroup parent) {// TODO Auto-generated method stubViewDialog3 viewDialog3=null;try {if (view == null) {viewDialog3=new ViewDialog3();view=inflater.inflate(R.layout.device_item_info, null);viewDialog3.tvId = (TextView)view.findViewById(R.id.TextViewId3);viewDialog3.tv_Name= (TextView) view.findViewById(R.id.TextViewName3);viewDialog3.tv_Quantity= (TextView) view.findViewById(R.id.TextViewQuantity3);}else {viewDialog3 = (ViewDialog3)view.getTag();// resetViewHolder3(viewDialog3);}TableMessage tableMessage = arraylist.get(position);viewDialog3.tvId.setText((position+1)+"");viewDialog3.tv_Name.setText(tableMessage.getName());viewDialog3.tv_Quantity.setText(tableMessage.getQuantity());return view;} catch (Exception e) {Log.d("debugAdd", "3測試添加數據有誤" + e.toString());return view;// throw new RuntimeException(e);}/// return view;}protected void resetViewHolder3(ViewDialog3 p_ViewHolder){p_ViewHolder.tvId.setText(null);p_ViewHolder.tv_Name.setText(null);p_ViewHolder.tv_Quantity.setText(null);}private class ViewDialog3{private TextView tvId;private TextView tv_Name;private TextView tv_Quantity;}}public class UserAdapter extends RecyclerView.Adapter<UserAdapter.ViewHolder> {private List<TableMessage> userList;public UserAdapter(List<TableMessage> userList) {this.userList = userList;}@NonNull@Overridepublic ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.device_item_info, parent, false);return new ViewHolder(view);}@Overridepublic void onBindViewHolder(@NonNull ViewHolder holder, int position) {// 獲取當前數據TableMessage tableMessage = userList.get(position);// 設置序號(position 從 0 開始,需 +1)holder.tvId.setText(String.valueOf(position + 1));// 設置姓名和年齡holder.tv_Name.setText(tableMessage.getName());holder.tv_Quantity.setText(tableMessage.getQuantity());}@Overridepublic int getItemCount() {return userList.size();}// ViewHolder 內部類public  class ViewHolder extends RecyclerView.ViewHolder {TextView tvId, tv_Name, tv_Quantity;public ViewHolder(@NonNull View itemView) {super(itemView);tvId = itemView.findViewById(R.id.TextViewId);tv_Name = itemView.findViewById(R.id.TextViewName);tv_Quantity = itemView.findViewById(R.id.TextViewQuantity);}}}public class UserFailAdapter extends RecyclerView.Adapter<UserFailAdapter.ViewHolder> {private List<TableMessage> userList;public UserFailAdapter(List<TableMessage> userList) {this.userList = userList;}@NonNull@Overridepublic ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.device_item_info, parent, false);return new ViewHolder(view);}@Overridepublic void onBindViewHolder(@NonNull ViewHolder holder, int position) {// 獲取當前數據TableMessage tableMessage = userList.get(position);// 設置序號(position 從 0 開始,需 +1)holder.tvId.setText(String.valueOf(position + 1));// 設置姓名和年齡holder.tv_Name.setText(tableMessage.getName());holder.tv_Quantity.setText(tableMessage.getQuantity());}@Overridepublic int getItemCount() {return userList.size();}// ViewHolder 內部類public  class ViewHolder extends RecyclerView.ViewHolder {TextView tvId, tv_Name, tv_Quantity;public ViewHolder(@NonNull View itemView) {super(itemView);tvId = itemView.findViewById(R.id.TextViewId3);tv_Name = itemView.findViewById(R.id.TextViewName3);tv_Quantity = itemView.findViewById(R.id.TextViewQuantity3);}}}}

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/web/82074.shtml
繁體地址,請注明出處:http://hk.pswp.cn/web/82074.shtml
英文地址,請注明出處:http://en.pswp.cn/web/82074.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

WIN11使用vscode搭建c語言開發環境

安裝 VS Code 下載地址: Visual Studio Code - Code Editing. Redefined 安裝時勾選 "添加到 PATH"&#xff08;方便在終端中調用 code 命令 下載 MSYS2 官網&#xff1a;MSYS2 下載 msys2-x86_64-xxxx.exe&#xff08;64位版本&#xff09;并安裝。 默認安裝路徑…

微信小程序帶數組參數跳轉頁面,微信小程序跳轉頁面帶數組參數

在微信小程序中&#xff0c;帶數組參數跳轉頁面需要通過JSON序列化和URL編碼處理&#xff0c;以下是具體實現方法 傳遞數組參數?&#xff08;發送頁面&#xff09; wx.navigateTo({url: /pages/targetPage?arr encodeURIComponent(JSON.stringify(yourArray)) });接收數組參…

Mac M1編譯OpenCV獲取libopencv_java490.dylib文件

Window OpenCV下載地址 https://opencv.org/releases/OpenCV源碼下載 https://github.com/opencv/opencv/tree/4.9.0 https://github.com/opencv/opencv_contrib/tree/4.9.0OpenCV依賴 brew install libjpeg libpng libtiff cmake3 ant freetype構建open CV cmake -G Ninja…

前端面試準備-3

1.let、const、var的區別 ①&#xff1a;let和const為塊級作用域&#xff0c;var為全局作用域 ②&#xff1a;let和var可以重新賦值定義&#xff0c;而const不可以 ③&#xff1a;var會提升到作用域頂部&#xff0c;但不會初始化&#xff1b;let和const也會提升到作用不頂部…

Java 中 Lock 接口詳解:靈活強大的線程同步機制

在 Java 中&#xff0c;Lock 是一個接口&#xff0c;它提供了比 synchronized 關鍵字更靈活、更強大的線程同步機制。以下將詳細介紹 Lock 接口及其實現類&#xff0c;以及它與 synchronized 相比的優點。 Lock 接口及其實現類介紹 Lock 接口 Lock 接口定義了一系列用于獲取…

實驗分享|基于sCMOS相機科學成像技術的耐高溫航空涂層材料損傷檢測實驗

1實驗背景 航空發動機外殼的耐高溫涂層材料在長期高溫、高壓工況下易產生微小損傷與裂紋&#xff0c;可能導致嚴重安全隱患。傳統光學檢測手段受限于分辨率與靈敏度&#xff0c;難以捕捉微米級缺陷&#xff0c;且檢測效率低下。 某高校航空材料實驗室&#xff0c;采用科學相機…

python訓練營day40

知識點回顧&#xff1a; 彩色和灰度圖片測試和訓練的規范寫法&#xff1a;封裝在函數中展平操作&#xff1a;除第一個維度batchsize外全部展平dropout操作&#xff1a;訓練階段隨機丟棄神經元&#xff0c;測試階段eval模式關閉dropout 作業&#xff1a;仔細學習下測試和訓練代碼…

Baklib企業CMS全流程管控與智能協作

企業CMS全流程管控方案解析 現代企業內容管理中&#xff0c;全流程管控的實現依賴于對生產、審核、發布及迭代環節的系統化整合。通過動態發布引擎與元數據智能標記技術&#xff0c;系統可自動匹配內容與目標場景&#xff0c;實現標準化模板驅動的快速部署。針對多分支機構的復…

Qt程序添加調試輸出窗口:CONFIG += console

目錄 1.背景 2.解決方案 3.原理詳解 4.控制臺窗口的行為 5.條件編譯&#xff08;僅調試模式顯示控制臺&#xff09; 6.替代方案 7.總結 1.背景 在Qt程序開發中&#xff0c;開發者經常遇到這樣的困擾&#xff1a; 開發機上程序運行正常 發布到其他機器后程序無法啟動 …

《江西棒球資訊》棒球運動發展·棒球1號位

聯賽體系結構 | League Structure MLB模式 MLB采用分層體系&#xff08;大聯盟、小聯盟&#xff09;&#xff0c;強調梯隊建設和長期發展。 MLB operates a tiered system (Major League, Minor League) with a focus on talent pipelines and long-term development. 中國現…

Python爬蟲實戰:研究Tornado框架相關技術

1. 引言 1.1 研究背景與意義 網絡爬蟲作為一種自動獲取互聯網信息的程序,在信息檢索、數據挖掘、輿情分析等領域有著廣泛的應用。隨著互聯網數據量的爆炸式增長,對爬蟲的性能和效率提出了更高的要求。傳統的同步爬蟲在處理大量 URL 時效率低下,而異步爬蟲可以顯著提高并發…

Vue-列表過濾排序

列表過濾 基礎環境 數據 persons: [{ id: "001", name: "劉德華", age: 19 },{ id: "002", name: "馬德華", age: 20 },{ id: "003", name: "李小龍", age: 21 },{ id: "004", name: "釋小龍&q…

JDK21深度解密 Day 9:響應式編程模型重構

【JDK21深度解密 Day 9】響應式編程模型重構 引言&#xff1a;從Reactor到虛擬線程的范式轉變 在JDK21中&#xff0c;虛擬線程的引入徹底改變了傳統的異步編程模型。作為"JDK21深度解密"系列的第91天&#xff0c;我們將聚焦于響應式編程模型重構這一關鍵主題。通過…

UE5打包項目設置Project Settings(打包widows exe安裝包)

UE5打包項目Project Settings Edit-Project Settings- Packaging-Ini Section Denylist-Advanced 1&#xff1a;打包 2&#xff1a;高級設置 3&#xff1a;勾選創建壓縮包 4&#xff1a;添加要打包地圖Map的數量 5&#xff1a;選擇要打包的地圖Maps 6&#xff1a;Project-Bui…

Fastapi 學習使用

Fastapi 學習使用 Fastapi 可以用來快速搭建 Web 應用來進行接口的搭建。 參考文章&#xff1a;https://blog.csdn.net/liudadaxuexi/article/details/141062582 參考文章&#xff1a;https://blog.csdn.net/jcgeneral/article/details/146505880 參考文章&#xff1a;http…

java helloWord java程序運行機制 用idea創建一個java項目 標識符 關鍵字 數據類型 字節

HelloWord public class Hello{public static void main(String[] args) {System.out.print("Hello,World!");} }java程序運行機制 用idea創建一個java項目 建立一個空項目 新建一個module 注釋 標識符 關鍵字 標識符注意點 數據類型 public class Demo02 {public st…

隨機響應噪聲-極大似然估計

一、核心原因&#xff1a;噪聲機制的數學可逆性 在隨機響應機制&#xff08;Randomized Response&#xff09;中使用極大似然估計&#xff08;Maximum Likelihood Estimation, MLE&#xff09;是為了從擾動后的噪聲數據中無偏地還原原始數據的統計特性。隨機響應通過已知概率的…

SMT貼片機工藝優化與效率提升策略

內容概要 現代電子制造領域中&#xff0c;SMT貼片機作為核心生產設備&#xff0c;其工藝優化與效率提升直接影響企業競爭力。本文聚焦設備參數校準、吸嘴選型匹配、SPI檢測技術三大技術模塊&#xff0c;結合生產流程重構與設備維護周期優化兩大管理維度&#xff0c;形成系統性…

AI提示工程(Prompt Engineering)高級技巧詳解

AI提示工程(Prompt Engineering)高級技巧詳解 文章目錄 一、基礎設計原則二、高級提示策略三、輸出控制技術四、工程化實踐五、專業框架應用提示工程是與大型語言模型(LLM)高效交互的關鍵技術,精心設計的提示可以顯著提升模型輸出的質量和相關性。以下是經過驗證的詳細提示工…

光電設計大賽智能車激光對抗方案分享:低成本高效備賽攻略

一、賽題核心難點與備賽痛點解析 全國大學生光電設計競賽的 “智能車激光對抗” 賽題&#xff0c;要求參賽隊伍設計具備激光對抗功能的智能小車&#xff0c;需實現光電避障、目標識別、軌跡規劃及激光精準打擊等核心功能。從歷年參賽情況看&#xff0c;選手普遍面臨三大挑戰&a…