当前位置: 首页 > news >正文

Intent--组件通信

组件通信1 获取子活动的返回值

创建Activity时实现自动注册!【Activity必须要注册才能使用】

默认 LinearLayout 布局,注意 xml 中约束布局的使用;

若需要更改 线性布局 只需要将标签更改为 LinearLayout 即可,记得 设置线性布局的方向orientation;

 activity_main1中约束布局
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:id="@+id/main"android:layout_width="match_parent"android:layout_height="match_parent"tools:context=".MainActivity"><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="登录"app:layout_constraintBottom_toBottomOf="parent"app:layout_constraintEnd_toEndOf="parent"app:layout_constraintStart_toStartOf="parent"app:layout_constraintTop_toTopOf="parent"android:id="@+id/btn_login"/><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:gravity="center"app:layout_constraintTop_toBottomOf="@+id/btn_login"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="用户名:" /><EditTextandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:id="@+id/edt_name"/></LinearLayout></androidx.constraintlayout.widget.ConstraintLayout>
activity_main2中约束布局

父布局约束_LineayLayout(id值是linear)

app:layout_constraintBottom_toBottomOf="parent" 底部约束
app:layout_constraintEnd_toEndOf="parent" 右边约束
app:layout_constraintStart_toStartOf="parent" 左边约束
app:layout_constraintTop_toTopOf="parent" 顶部约束

子空间约束_Button

app:layout_constraintTop_toBottomOf="@+id/linear" 顶部添加约束到父布局控件的底部
app:layout_constraintEnd_toEndOf="@+id/linear" 右边添加约束到父布局控件右边
app:layout_constraintStart_toStartOf="@+id/linear" 左边添加约束到父布局控件左边

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:id="@+id/main"android:layout_width="match_parent"android:layout_height="match_parent"tools:context=".MainActivity2"><LinearLayoutandroid:id="@+id/linear"android:layout_width="match_parent"android:layout_height="wrap_content"android:gravity="center"android:orientation="horizontal"app:layout_constraintBottom_toBottomOf="parent"app:layout_constraintEnd_toEndOf="parent"app:layout_constraintStart_toStartOf="parent"app:layout_constraintTop_toTopOf="parent"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="用户名:" /><EditTextandroid:id="@+id/edt_name"android:layout_width="wrap_content"android:layout_height="wrap_content" /></LinearLayout><Buttonandroid:id="@+id/btn_return"android:layout_width="wrap_content"android:layout_height="wrap_content"android:gravity="center"android:text="返回"app:layout_constraintTop_toBottomOf="@+id/linear"app:layout_constraintEnd_toEndOf="@+id/linear"app:layout_constraintStart_toStartOf="@+id/linear" />
</androidx.constraintlayout.widget.ConstraintLayout>
MainActivity.java
package com.example.exp4_2;import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;import androidx.activity.EdgeToEdge;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;public class MainActivity extends AppCompatActivity {Button btn_login;EditText edt_name;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);EdgeToEdge.enable(this);setContentView(R.layout.activity_main);ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);return insets;});btn_login = findViewById(R.id.btn_login);btn_login.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View view) {//显式启动Intent intent = new Intent(MainActivity.this, MainActivity2.class);//以sub_activity的方式启动子Activity//参数两个 intent int(请求码)startActivityForResult(intent,0);}});}@Overrideprotected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {super.onActivityResult(requestCode, resultCode, data);edt_name = findViewById(R.id.edt_name);//得到返回值edt_name.setText(data.getStringExtra("name"));}
}
 MainActivity2.java
package com.example.exp4_2;import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;public class MainActivity2 extends AppCompatActivity {@Overrideprotected void onCreate(Bundle savedInstanceState) {Button btn_return;EditText edt_name;super.onCreate(savedInstanceState);EdgeToEdge.enable(this);setContentView(R.layout.activity_main2);ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);return insets;});btn_return = findViewById(R.id.btn_return);edt_name = findViewById(R.id.edt_name);btn_return.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View view) {Intent intent = new Intent();intent.putExtra("name",edt_name.getText().toString());//将intent容器中储存的Activity的返回值作为参数传给setResult方法;setResult(0,intent);finish();}});}
}
结果 

点击 登录 按钮进入子活动2,在子活动2中点击 返回 按钮,将活动2页面中的用户名作为子活动的返回信息通过 intent 传递给父活动1,并显示在父活动1中的EditText;   

 

 

组件通信2 

题目要求 

用户点击“启动Activity1”和“启动Activity2”按钮时,程序将分别启动子SubActivity1和SubActivity2;

SubActivity1提供了一个输入框,以及“接受”和“撤销”两个按钮。如果在输入框中输入信息后点击“接受”按钮,程序会把输入框中的信息传递给其父Activity,并在父Activity的界面上显示。 如果用户点击“撤销”按钮,则程序不会向父Activity传递任何信息。 SubActivity2主要是为了说明如何在父Activity中处理多个子Activity,因此仅提供了用于关闭SubActivity2的“关闭”按钮。 

注意:在启动 子Activity 时用的是显式启动;和隐式启动的区别在于 Intent 对象的构造形式不同;

在两个 子Activity 的时候 Requestcode 和 Resultcode 的重要性;

activity_main.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:id="@+id/main"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"tools:context=".MainActivity"><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="启动Activity1"android:id="@+id/btn_1"/><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="启动Activity2"android:id="@+id/btn_2"/><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:id="@+id/txt_result"/>
</LinearLayout>
activity_main2.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:id="@+id/main"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"tools:context=".MainActivity2"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="sub_activity1"/><EditTextandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:id="@+id/edt_input"/><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="接受"android:id="@+id/btn_accept"/><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="撤销"android:id="@+id/btn_conceal"/>
</LinearLayout>
activity_main3.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:id="@+id/main"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"tools:context=".MainActivity3"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="sub_activity2"/><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="关闭"android:id="@+id/btn_close"/>
</LinearLayout>
MainActivity.java
package com.example.exp4_3;import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;import androidx.activity.EdgeToEdge;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;public class MainActivity extends AppCompatActivity {Button btn_1,btn_2;TextView txt_result;//必须设置成final 否则switch case 报错static final int request_flag1 = 1;static final int request_flag2 = 2;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);EdgeToEdge.enable(this);setContentView(R.layout.activity_main);ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);return insets;});btn_1 = findViewById(R.id.btn_1);btn_2 = findViewById(R.id.btn_2);btn_1.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View view) {Intent intent = new Intent(MainActivity.this, MainActivity2.class);//参数两个 Intent 请求码requestcode-intstartActivityForResult(intent,request_flag1);}});btn_2.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View view) {Intent intent = new Intent(MainActivity.this, MainActivity3.class);//参数两个 Intent 请求码requestcode-intstartActivityForResult(intent,request_flag2);}});}@Overrideprotected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {super.onActivityResult(requestCode, resultCode, data);txt_result = findViewById(R.id.txt_result);switch(requestCode){case request_flag1://判断结果码是 接受 还是 撤销if(resultCode==RESULT_OK){txt_result.setText(data.getStringExtra("name"));}else{txt_result.setText("sub_activity1返回空信息");}break;case request_flag2:txt_result.setText("sub_activity2返回空信息");break;}}
}
MainActivity2.java 
package com.example.exp4_3;import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;public class MainActivity2 extends AppCompatActivity {Button btn_accept,btn_conceal;EditText edt_input;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);EdgeToEdge.enable(this);setContentView(R.layout.activity_main2);ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);return insets;});btn_accept = findViewById(R.id.btn_accept);btn_conceal = findViewById(R.id.btn_conceal);edt_input = findViewById(R.id.edt_input);btn_accept.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View view) {//显式启动Intent intent = new Intent();intent.putExtra("name",edt_input.getText().toString());//参数两个 结果码Result_OK IntentsetResult(RESULT_OK,intent);finish();}});btn_conceal.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View view) {//Intent intent = new Intent();//setResult(RESULT_CANCELED,intent);//参数两个 结果码Result_CANCELED NULLsetResult(RESULT_CANCELED,null);finish();}});}
}
MainActivity3.java
package com.example.exp4_3;import android.os.Bundle;
import android.view.View;
import android.widget.Button;import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;public class MainActivity3 extends AppCompatActivity {Button btn_close;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);EdgeToEdge.enable(this);setContentView(R.layout.activity_main3);ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);return insets;});Button btn_close = findViewById(R.id.btn_close);btn_close.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View view) {setResult(RESULT_CANCELED,null);finish();}});}
}
结果 

 

点击 启动Activity1 输入“请输入...”

 

点击 接受 

 

点击 撤销 

 

点击 启动Activity2 点击 关闭  

 

 点击 关闭 

 

相关文章:

Intent--组件通信

组件通信1 获取子活动的返回值 创建Activity时实现自动注册&#xff01;【Activity必须要注册才能使用】 默认 LinearLayout 布局&#xff0c;注意 xml 中约束布局的使用&#xff1b; 若需要更改 线性布局 只需要将标签更改为 LinearLayout 即可&#xff0c;记得 设置线性布局…...

Android14 OTA升级速度过慢问题解决方案

软件版本&#xff1a;Android14 硬件平台&#xff1a;QCS6115 问题&#xff1a;OTA整包升级接近20min&#xff0c;太长无法忍受。 该问题为Android高版本的虚拟AB分区压缩技术所致&#xff0c;其实就是时间换空间&#xff0c;个人推测AB分区压缩会节约硬件存储空间&#xff0…...

仓颉语言实战——1. 类型

仓颉语言实战——1. 类型 仓颉语言&#xff08;Cangjie Language&#xff09;是一个现代化的、简洁而强大的编程语言&#xff0c;它的类型系统为高效开发提供了极大的支持。本篇文章将围绕仓颉语言中的类型系统展开&#xff0c;结合实战代码&#xff0c;帮助开发者快速掌握这一…...

AWTK 在全志 tina linux 上支持 2D 图形加速

全志 tina linux 2D 图形加速插件。 开发环境为 全志 Tina Linux 虚拟机。 1. 准备 下载 awtk git clone https://github.com/zlgopen/awtk.git下载 awtk-linux-fb git clone https://github.com/zlgopen/awtk-linux-fb.git下载 awtk-tina-g2d git clone https://github.co…...

MySql幻读问题

认识具有反复性。 之前以为理解了幻读&#xff0c;最近看黑马的mysql教程以为再次加深了认识。然而现在认为之前的理解都是错误的&#xff0c;而且网上很多关于幻读的解释&#xff0c;都不太准确。 关于幻读的最佳解释还是要看官网mysql官网幻读解释 脏读和不可重复读比较好理…...

(南京观海微电子)——GH7009开机黑屏案例分析

一、 现象描述&#xff1a; 不良现象: LVDS模组&#xff0c;开机大概2秒后就黑屏。 二、问题分析 等主机进入Kernel 后做以下测试&#xff1a; 1、手动reset LCM 后 可以显示正常&#xff1b; 总结&#xff1a; 1&#xff09;uboot 部分HS 太窄&#xff0c;仅有4个clk宽度&am…...

【Rust自学】7.4. use关键字 Pt.2 :重导入与换国内镜像源教程

喜欢的话别忘了点赞、收藏加关注哦&#xff0c;对接下来的教程有兴趣的可以关注专栏。谢谢喵&#xff01;(&#xff65;ω&#xff65;) 7.4.1. 使用pub use重新导入名称 使用use将路径导入作用域内后。该名称在词作用域内是私有的。 以上一篇文章的代码为例&#xff1a; m…...

前端学习DAY28(水平)

元素水平方向的布局 元素在其父元素中水平方向的位置有以下几个属性共同决定 margin-left border-left padding-left width padding-right border-right margin-right 一个元素在其父元素中&#xff0c;水平布局必须要满足以下的等式 margin-left border-left …...

【MyBatis】day01搭建MyBatis框架

目录 第一章 初识Mybatis 第二章 搭建Mybatis框架 第三章 Mybatis核心配置详解【mybatis-config.xml】 第一章 初识Mybatis 1.1 框架概述 生活中“框架” 买房子 笔记本电脑 程序中框架【代码半成品】 Mybatis框架&#xff1a;持久化层框架【dao层】 SpringMVC框架&…...

yolov7算法及其改进

yolov7算法及其改进 1、YOLOV7简介2、ELAN架构设计2.1、Partial Residual Networks2.1.1、Masked Residual Layer2.1.2、Asymmetric Residual Layer 2.2、Cross Stage Partial Networks2.2.1、Cross stage partial operation2.2.2、Gradient flow truncate operation 2.3、Effi…...

spring cloud微服务-OpenFeign的使用

OpenFeign的使用 openFeign的作用是服务间的远程调用 &#xff0c;比如通过OpenFeign可以实现调用远程服务。 已经有了LoadBalancer为什么还要用openFeign? 在微服务架构中&#xff0c;LoadBalancer和OpenFeign虽然都提供了服务间调用的能力&#xff0c;但它们的设计目的和…...

【汇编】关于函数调用过程的若干问题

1. 为什么需要bp指针&#xff1f; 因为bp是栈帧的起始地址&#xff0c;函数内的局部栈变量&#xff0c;采用相对bp的内存寻址。不能相对于sp&#xff0c;sp是一直在变的。 2. 函数调用过程&#xff1f; 函数开始&#xff0c;先压栈bp&#xff0c;保存父函数栈底指针bp&#…...

针对Kali 系统进行分区设置

手动设置分区 Kali 安装之腾讯云经验遇到坑_腾讯云安装kali-CSDN博客 安装过程中的几处关键点,文字总结如下&#xff1a; ①分区--手动 ②是否创建空的分区表 ---yes ③选择---创建一个新的分区 ④大小--默认-----主分区 ⑤分区类型----系统&#xff09;一个逻辑分区 ⑥是否…...

C语言简单测试总结

前言 在学C语言之前回顾一下C中的一些知识.选用的是中国大学MOOC中C程序设计(面向对象进阶)中的C语言水平评估测试题. 题目 ​The keyword "unsigned" can modify the keyword [ B ] A.signed B.long C.long double D.float题解:unsigned是无符号的意识,通常在…...

Android OpenGl(二) Shader

一、Shader 1、什么是Shader&#xff0c;为什么要使用Shder &#xff08;1&#xff09;shader运行在gpu上的小程序 &#xff08;2&#xff09;以前使用固定管线&#xff0c;但缺点是灵活度不够&#xff0c;无法满足复杂需求&#xff0c;为了解决固定管线的缺点&#xff0c;出…...

DevOps实战:用Kubernetes和Argo打造自动化CI/CD流程(1)

DevOps实战&#xff1a;用Kubernetes和Argo打造自动化CI/CD流程&#xff08;1&#xff09; 架构 架构图 本设计方案的目标是在一台阿里云ECS服务器上搭建一个轻量级的Kubernetes服务k3s节点&#xff0c;并基于Argo搭建一套完整的DevOps CI/CD服务平台&#xff0c;包括Argo CD…...

【已解决】“Content-Security-Policy”头缺失

1、作用 简称CSP&#xff0c;意为内容安全策略&#xff0c;通过设置约束指定可信的内容来源&#xff0c;降低异源文件攻击&#xff0c;例如&#xff1a;js/css/image等 2、相关设置值 指令名 demo 说明 default-src self cdn.example.com 默认策略,可以应用于js文件/图片…...

win系统B站播放8k视频启用HEVC编码

下载HEVC插件 点击 HEVC Video Extension 2.2.20.0 latest downloads&#xff0c;根据教程下载安装 安装 Random User-Agent 点击 Random User-Agent 安装 配置 Random User-Agent 在youtube中会导致视频无法播放&#xff0c;我选择直接屏蔽了 B站设置...

快速理解24种设计模式

简单工厂模式 建立产品接口类&#xff0c;规定好要实现方法。 建立工厂类&#xff0c;根据传入的参数&#xff0c;实例化所需的类&#xff0c;实例化的类必须实现指定的产品类接口 创建型 单例模式Singleton 保证一个类只有一个实例&#xff0c;并提供一个访问他它的全局…...

为什么深度学习和神经网络要使用 GPU?

为什么深度学习和神经网络要使用 GPU&#xff1f; 本篇文章的目标是帮助初学者了解 CUDA 是什么&#xff0c;以及它如何与 PyTorch 配合使用&#xff0c;更重要的是&#xff0c;我们为何在神经网络编程中使用 GPU。 图形处理单元 (GPU) 要了解 CUDA&#xff0c;我们需要对图…...

安装最新elasticsearch-8.18.2

1.环境我的环境是linux麒麟服务器 (安装 es 7.8以上 java环境必须11以上,可以单独配置es的java目录) 2.下载 官网的地址:下载 Elastic 产品 | Elastic Download Elasticsearch | Elastic Elasticsearch 入门 | Elasticsearch 中文文档 文档 3.我下载的是8.18的 Elasti…...

django paramiko 跳转登录

在使用Django框架结合Paramiko进行SSH远程操作时&#xff0c;通常涉及到自动化脚本的执行&#xff0c;比如远程服务器上的命令执行、文件传输等。如果你的需求是“跳转登录”&#xff0c;即在登录远程服务器后&#xff0c;再通过该服务器的SSH连接跳转到另一台服务器&#xff0…...

Python编码格式化之PEP8编码规范

文章目录 概要PEP8编码风格py文本组织规范命名规范编码风格 PEP8编码检查工具pylintflake8PyCharm中配置检查工具 PEP8编码格式化工具blackautopep8PyCharm配置格式化工具本地git配置hook 总结 概要 在Python项目开发过程中&#xff0c;代码的可读性和一致性对于项目的长期维护…...

10万QPS高并发请求,如何防止重复下单

1. 前端拦截 首先因为是10万QPS的高并发请求&#xff0c;我们要保护好系统&#xff0c;那就是尽可能减少用户无效请求。 1.1 按钮置灰 很多用户抢票、抢购、抢红包等时候&#xff0c;为了提高抢中的概率&#xff0c;都是疯狂点击按钮。会触发多次请求&#xff0c;导致重复下…...

DeepSeek 终章:破局之路,未来已来

目录 一、DeepSeek 技术发展现状回顾二、未来发展趋势2.1 多模态融合的拓展2.2 模型可解释性的强化2.3 垂直领域的深化应用 三、面临的技术挑战3.1 数据隐私与安全难题3.2 算法偏见与公平性困境3.3 网络攻击与恶意利用威胁 四、挑战应对策略探讨4.1 技术层面的解决方案4.2 算法…...

如何借助Hyper - V在Windows 10中构建安全软件测试环境

视频演示 手把手教你激活 Hyper-V 并安装 Windows 10 虚拟机 一、引言:软件探索的风险与解决方案 在数字化时代,软件更新换代的速度日新月异,对于热衷于探索新软件的朋友而言,主系统中安装新软件时的谨慎态度无可厚非。恶意软件的威胁犹如高悬的达摩克利斯之剑,稍不留…...

怎么让自己ip显示外省?一文说清操作

在互联网时代&#xff0c;IP地址不仅关联网络连接&#xff0c;还可能影响IP属地显示。那么&#xff0c;手机和电脑用户怎么让自己IP显示外省&#xff1f;一文说清操作要点。 ‌ 二、4种主流方法详解 要让自己的IP显示为外省地址&#xff0c;主要有以下几种方法&#xff1a; …...

LangChain工具集成实战:构建智能问答系统完整指南

导读&#xff1a;在人工智能快速发展的今天&#xff0c;如何构建一个既能理解自然语言又能调用外部工具的智能问答系统&#xff0c;成为许多开发者面临的核心挑战。本文将为您提供一套完整的解决方案&#xff0c;从LangChain内置工具包的基础架构到复杂系统的工程实践。 文章深…...

从webrtc到janus简介

1.基础知识 1.1 信令的基础知识 在 WebRTC&#xff08;Web Real-Time Communication&#xff09; 中&#xff0c;信令&#xff08;Signaling&#xff09; 是实现浏览器之间实时通信的关键机制&#xff0c;负责在通信双方&#xff08;或多方&#xff09;之间传递控制信息&…...

Go 中 map 的双值检测写法详解

Go 中 map 的双值检测写法详解 在 Go 中&#xff0c;if char, exists : pairs[s[i]]; exists { 是一种利用 Go 语言特性编写的优雅条件语句&#xff0c;用于检测 map 中是否存在某个键。让我们分解解释这种写法&#xff1a; 语法结构解析 if value, ok : mapVariable[key]; …...