Android中级——RemoteView

news2024/9/26 3:32:11

RemoteView

  • RemoteView的应用
    • Notification
    • Widget
    • PendingIntent
  • RemoteViews内部机制
  • 模拟RemoteViews

RemoteView的应用

Notification

如下开启一个系统的通知栏,点击后跳转到某网页

public class MainActivity extends AppCompatActivity {

    private static final String TAG = "MainActivity";

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

        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.baidu.com"));
        PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);

        NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
        NotificationChannel channel1 = new NotificationChannel("0", "channel1", NotificationManager.IMPORTANCE_LOW);
        manager.createNotificationChannel(channel1);

        Notification.Builder builder = new Notification.Builder(this, "0");
        builder.setSmallIcon(R.drawable.ic_launcher)
                .setLargeIcon(Icon.createWithResource(this, R.drawable.ic_launcher))
                .setContentTitle("Notification")
                .setContentText("Hello World")
                .setContentIntent(pendingIntent);
        manager.notify(1, builder.build());
    }
}

效果如下

在这里插入图片描述

若采用RemoteView,可以自定义通知栏的布局,notification.xml文件如下

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/root"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ImageView
        android:id="@+id/iv"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1" />

    <TextView
        android:id="@+id/tv"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:gravity="center_vertical" />
</LinearLayout>

代码如下,可通过一系列set方法设置布局

public class MainActivity extends AppCompatActivity {

    private static final String TAG = "MainActivity";

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

        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.baidu.com"));
        PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);

        NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
        NotificationChannel channel1 = new NotificationChannel("0", "channel1", NotificationManager.IMPORTANCE_LOW);
        manager.createNotificationChannel(channel1);

        RemoteViews remoteViews = new RemoteViews(getPackageName(), R.layout.notification);
        remoteViews.setTextViewText(R.id.tv, "Hello Android");
        remoteViews.setImageViewResource(R.id.iv, R.drawable.ic_launcher);
        remoteViews.setOnClickPendingIntent(R.id.root, pendingIntent);

        Notification.Builder builder = new Notification.Builder(this, "0");
        builder.setSmallIcon(R.drawable.ic_launcher)
                .setCustomContentView(remoteViews);
        manager.notify(1, builder.build());
    }
}

效果如下

在这里插入图片描述

Widget

res/layout下创建widget.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ImageView
        android:id="@+id/iv"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_launcher" />
</LinearLayout>

res/xml下创建appwidget_provider_info.xml,设置最小宽高、自动更新的周期(ms)

<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
    android:initialLayout="@layout/widget"
    android:minWidth="84dp"
    android:minHeight="84dp"
    android:updatePeriodMillis="86400000">

</appwidget-provider>

创建MyAppWidgetProvider,给小组件设置一个点击动画

  • onEnable:第一次添加时调用,可添加多次,但只在第一次调用
  • onUpdate:添加或更新(周期时间到)时调用
  • onDeleted:删除时调用
  • onDisabled:最后一个小组件被删除时调用
  • onReceive :分发上面的事件
public class MyAppWidgetProvider extends AppWidgetProvider {

    private static final String TAG = "MyAppWidgetProvider";
    public static final String CLICK_ACTION = "com.demo.demo0.MyAppWidgetProvider.CLICK";

    public MyAppWidgetProvider() {
        super();
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        super.onReceive(context, intent);
        String action = intent.getAction();
        Log.d(TAG, "onReceive: action = " + action);
        if (CLICK_ACTION.equals(action)) {
            Toast.makeText(context, "click", Toast.LENGTH_SHORT).show();
            new Thread(new Runnable() {
                @Override
                public void run() {
                    Bitmap srcBitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_launcher);
                    AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
                    for (int i = 0; i < 37; i++) {
                        float degree = (i * 10) % 360;
                        RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget);
                        remoteViews.setImageViewBitmap(R.id.iv, rotateBitmap(context, srcBitmap, degree));
                        /*Intent clickIntent = new Intent();
                        clickIntent.setAction(CLICK_ACTION);
                        clickIntent.setComponent(new ComponentName(context, "com.demo.demo0.MyAppWidgetProvider"));
                        PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, clickIntent, 0);
                        remoteViews.setOnClickPendingIntent(R.id.iv, pendingIntent);*/
                        appWidgetManager.updateAppWidget(new ComponentName(context, MyAppWidgetProvider.class), remoteViews);
                        SystemClock.sleep(30);
                    }
                }
            }).start();
        }
    }

    @Override
    public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
        super.onUpdate(context, appWidgetManager, appWidgetIds);
        Log.d(TAG, "onUpdate: ");
        int count = appWidgetIds.length;
        Log.d(TAG, "onUpdate: count = " + count);
        for (int appWidgetId : appWidgetIds) {
            onWidgetUpdate(context, appWidgetManager, appWidgetId);
        }
    }

    private void onWidgetUpdate(Context context, AppWidgetManager appWidgetManager, int appWidgetId) {
        Log.d(TAG, "onWidgetUpdate: appWidgetId = " + appWidgetId);
        RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget);
        Intent intentClick = new Intent();
        intentClick.setAction(CLICK_ACTION);
        intentClick.setComponent(new ComponentName(context, "com.demo.demo0.MyAppWidgetProvider"));
        PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, intentClick, 0);
        remoteViews.setOnClickPendingIntent(R.id.iv, pendingIntent);
        appWidgetManager.updateAppWidget(appWidgetId, remoteViews);
    }

    private Bitmap rotateBitmap(Context context, Bitmap srcBitmap, float degree) {
        Matrix matrix = new Matrix();
        matrix.reset();
        matrix.setRotate(degree);
        return Bitmap.createBitmap(srcBitmap, 0, 0, srcBitmap.getWidth(), srcBitmap.getHeight(), matrix, true);
    }
}

AppWidgetProvider本质是一个广播,需要在Manifest中注册,第二个Action是桌面组件的标识必须要加

<receiver
    android:name=".MyAppWidgetProvider">
    <meta-data
        android:name="android.appwidget.provider"
        android:resource="@xml/appwidget_provider_info" />

    <intent-filter>
        <action android:name="com.demo.demo0.MyAppWidgetProvider.CLICK" />
        <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
    </intent-filter>
</receiver>

PendingIntent

PendingIntent是在将来的某个不确定的时刻发生,而Intent是立刻发生

在这里插入图片描述

PendingIntent通过send和cancel方法发送和取消特定的Intent

  • requesetCode一般情况下设为0
  • 当ComponentName和intent-filter相同时,两个Intent相同
  • 当Intent和requestCode相同时,两个PendingIntent相同

Flag常用的有:

  • FLAG_ONE_SHOT:当前PendingIntent只能被调用一次,随后被自动cancel,后续send会调用失败。对于消息来说,后续通知和第一条通知保持一致,单击任一条通知后,其他无法再打开
  • FLAG_NO_CREATE:当前PendingIntent不会主动创建,若之前不存在,则调用上面方法返回null
  • FLAG_CANCEL_CURRENT:若当前PendingIntent已存在,则会被cancel并创建新的,被cancel的通知再点击无作用。对于消息来说,只有最新的才能打开
  • FLAG_UPDATE_CURRENT:若当前PendingIntent已存在,则更新Intent中的Extra。对于消息来说,前面通知和最后一条通知保持一致,且都可以打开

RemoteViews内部机制

RemoteViews用于在其他进程中显示并更新UI,所支持的类型有

在这里插入图片描述

为避免每次对RemoteViews的操作都通过Binder传输,提供了Action封装对View的操作,如下

在这里插入图片描述

如对于setTextViewText()方法,传入对应操作的方法名

public void setTextViewText(int viewId, CharSequence text) {
    setCharSequence(viewId, "setText", text);
}

而在setCharSequence()中添加子类ReflectionAction

public void setCharSequence(int viewId, String methodName, CharSequence value) {
    addAction(new ReflectionAction(viewId, methodName, ReflectionAction.CHAR_SEQUENCE, value));
}

并将Action添加到ArrayList

private void addAction(Action a) {
    
    ......
    
    if (mActions == null) {
        mActions = new ArrayList<>();
    }
    mActions.add(a);
}

每当调用setxxx()方法时,并不会立即更新界面,而必须要通过NotificationManager的notify()或AppWidgetManager的updateAppWidget(),其内部会调用RemoteViews的

  • apply():加载布局并更新界面
  • reApply():只会更新界面

如下为AppWidgetHostView的updateAppWidget()方法

public void updateAppWidget(RemoteViews remoteViews) {
    applyRemoteViews(remoteViews, true);
}

protected void applyRemoteViews(RemoteViews remoteViews, boolean useAsyncIfPossible) {
   		......
        if (content == null && layoutId == mLayoutId) {
            try {
                remoteViews.reapply(mContext, mView, mOnClickHandler);
                content = mView;
                recycled = true;
                if (LOGD) Log.d(TAG, "was able to recycle existing layout");
            } catch (RuntimeException e) {
                exception = e;
            }
        }

        if (content == null) {
            try {
                content = remoteViews.apply(mContext, this, mOnClickHandler);
                if (LOGD) Log.d(TAG, "had to inflate new layout");
            } catch (RuntimeException e) {
                exception = e;
            }
        }
     	......
}

apply()方法通过inflateView()获取View返回

public View apply(Context context, ViewGroup parent, OnClickHandler handler) {
    RemoteViews rvToApply = getRemoteViewsToApply(context);
    View result = inflateView(context, rvToApply, parent);
    rvToApply.performApply(result, parent, handler);
    return result;
}

performApply()则是遍历调用Action的apply()方法

private void performApply(View v, ViewGroup parent, OnClickHandler handler) {
    if (mActions != null) {
        handler = handler == null ? DEFAULT_ON_CLICK_HANDLER : handler;
        final int count = mActions.size();
        for (int i = 0; i < count; i++) {
            Action a = mActions.get(i);
            a.apply(v, parent, handler);
        }
    }
}

再看子类ReflectionAction中apply()具体实现,可知其通过反射调用

@Override
public void apply(View root, ViewGroup rootParent, OnClickHandler handler) {
    final View view = root.findViewById(viewId);
    if (view == null) return;
    Class<?> param = getParameterType();
    if (param == null) {
        throw new ActionException("bad type: " + this.type);
    }
    try {
        getMethod(view, this.methodName, param, false /* async */).invoke(view, this.value);
    } catch (Throwable ex) {
        throw new ActionException(ex);
    }
}

模拟RemoteViews

如下模拟在MainActivity中通过广播传递RemoteViews,修改SecondActivity中的布局,manifest如下

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.demo.demo0">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

        <activity
            android:name=".SecondActivity"
            android:process=":remote">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".MainActivity">

        </activity>
    </application>

</manifest>

MainActivity创建RemoteViews并发送广播

public class MainActivity extends AppCompatActivity {

    private static final String TAG = "MainActivity";

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        RemoteViews remoteViews = new RemoteViews(getPackageName(), R.layout.notification);

        remoteViews.setTextViewText(R.id.tv, "Hello RemoteViews");
        remoteViews.setImageViewResource(R.id.iv, R.drawable.ic_launcher);

        Intent remoteViewsIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.baidu.com"));
        PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, remoteViewsIntent, PendingIntent.FLAG_UPDATE_CURRENT);
        remoteViews.setOnClickPendingIntent(R.id.root, pendingIntent);

        Intent broadcastIntent = new Intent(SecondActivity.ACTION_REMOTE_VIEWS);
        broadcastIntent.putExtra(SecondActivity.EXTRA_REMOTE_VIEWS, remoteViews);
        sendBroadcast(broadcastIntent);
        finish();
    }
}

布局notification.xml如下

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/root"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ImageView
        android:id="@+id/iv"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1" />

    <TextView
        android:id="@+id/tv"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:gravity="center_vertical" />
</LinearLayout>

SecondActivity接收广播获取RemoteViews,调用apply方法并把View添加到自身布局

public class SecondActivity extends AppCompatActivity {

    private static final String TAG = "SecondActivity";

    private LinearLayout mRemoteViesContainer;
    public static final String ACTION_REMOTE_VIEWS = "ACTION_REMOTE_VIEWS";
    public static final String EXTRA_REMOTE_VIEWS = "EXTRA_REMOTE_VIEWS";

    private BroadcastReceiver mRemoteViewsReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            RemoteViews remoteViews = intent.getParcelableExtra(EXTRA_REMOTE_VIEWS);
            if (remoteViews != null) {
                updateUI(remoteViews);
            }
        }
    };

    private void updateUI(RemoteViews remoteViews) {
        View view = remoteViews.apply(getApplicationContext(), mRemoteViesContainer);
        mRemoteViesContainer.addView(view);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_second);
        initView();
        startActivity(new Intent(this, MainActivity.class));
    }

    private void initView() {
        mRemoteViesContainer = findViewById(R.id.remote_views_container);
        IntentFilter intentFilter = new IntentFilter(ACTION_REMOTE_VIEWS);
        registerReceiver(mRemoteViewsReceiver, intentFilter);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        unregisterReceiver(mRemoteViewsReceiver);
    }
}

SecondActivity布局为一个空的LinearLayout

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/remote_views_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

</LinearLayout>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/838573.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

项目一:基于stm32的阿里云智慧消防监控系统

若该文为原创文章&#xff0c;转载请注明原文出处。 Hi&#xff0c;大家好&#xff0c;我是忆枫&#xff0c;今天向大家介绍一个单片机项目。 一、简介 智慧消防监控系统&#xff0c;是用于检测火灾&#xff0c;温度&#xff0c;烟雾的监控系统。以 stm32单片机为核心外加 MQ…

一次redis缓存不均衡优化经验

背景 高并发接口&#xff0c;引入redis作为缓存之后&#xff0c;运行一段时间发现redis各个节点在高峰时段的访问量严重不均衡&#xff0c;有的节点访问量7000次/s&#xff0c;有的节点访问量500次/s 此种现象虽然暂时不影响系统使用&#xff0c;但是始终是个安全隐患&#x…

ARM进阶:内存屏障(DMB/DSB/ISB)的20个使用例子详解

在上一节内存屏障指令之DMB、DSB和ISB详解中&#xff0c;介绍了一下内存屏障的三个指令的作用并举了一些例子&#xff0c;对于内存屏障指令的使用时机&#xff0c;与处理器架构(比如Cortex-M和Cortex-A)和处理器的系统实现(同样的架构&#xff0c;有不同的实现&#xff0c;如ST…

大厂必面:你们系统qps多少,怎么部署的?假设每天有几千万请求,该如何部署?

前言 在40岁老架构师 尼恩的读者社区(50)中&#xff0c;很多小伙伴要拿高薪&#xff0c;这就要面大厂、面架构&#xff0c;拿高薪。 在高级开发面试、大厂面试、架构师的面试过程中&#xff0c;常常会遇到下面的问题&#xff1a; 你们系统qps多少&#xff1f;怎么部署的&…

第三章 图论 No.4最小生成树的简单应用

文章目录 裸题&#xff1a;1140. 最短网络裸题&#xff1a;1141. 局域网裸题&#xff1a;1142. 繁忙的都市裸题&#xff1a;1143. 联络员有些麻烦的裸题&#xff1a;1144. 连接格点 存在边权为负的情况下&#xff0c;无法求最小生成树 裸题&#xff1a;1140. 最短网络 1140. 最…

【三极管双稳态电路】2022-3-5

缘由multisim仿真问题-嵌入式-CSDN问答

《算法竞赛·快冲300题》每日一题:“ 盲文文字编码”

《算法竞赛快冲300题》将于2024年出版&#xff0c;是《算法竞赛》的辅助练习册。 所有题目放在自建的OJ New Online Judge。 用C/C、Java、Python三种语言给出代码&#xff0c;以中低档题为主&#xff0c;适合入门、进阶。 文章目录 题目描述题解C代码Java代码Python代码 “ 盲…

《cuda c编程权威指南》05 - cuda矩阵求和

目录 1. 使用一个二维网格和二维块的矩阵加法 1.1 关键代码 1.2 完整代码 1.3 运行时间 2. 使用一维网格和一维块的矩阵加法 2.1 关键代码 2.2 完整代码 2.3 运行时间 3. 使用二维网格和一维块的矩阵矩阵加法 3.1 关键代码 3.2 完整代码 3.3 运行时间 1. 使用一个二…

==和equals():比较对象等不等?

引言&#xff1a; 在编程中&#xff0c;我们常常需要判断两个对象是否相等。而在Java中&#xff0c;有两种常用的方法&#xff1a;使用""运算符和调用equals()方法。这两个方法有什么区别呢&#xff1f;它们又有哪些有趣的应用呢&#xff1f;让我们一起来探索一下吧&…

RTT学习笔记12-KConfig 语法学习

KConfig 语法学习 RTT 官方教程 https://www.rt-thread.org/document/site/#/development-tools/build-config-system/Kconfig 我自己写的IIC配置 menuconfig BSP_USING_I2C # I2C 菜单bool "Enable I2C BUS" # 提示I2C 菜单default n # 默认不使能I2C 菜单…

第三章 图论 No.3 flody之多源汇最短路,传递闭包,最小环与倍增

文章目录 多源汇最短路&#xff1a;1125. 牛的旅行传递闭包&#xff1a;343. 排序最小环&#xff1a;344. 观光之旅345. 牛站 flody的四个应用&#xff1a; 多源汇最短路传递闭包找最小环恰好经过k条边的最短路 倍增 多源汇最短路&#xff1a;1125. 牛的旅行 1125. 牛的旅行 …

Camera之PhysicalCameraSettingsList/SurfaceMap/CameraMetadata/RequestList的关系(三十二)

简介: CSDN博客专家,专注Android/Linux系统,分享多mic语音方案、音视频、编解码等技术,与大家一起成长! 优质专栏:Audio工程师进阶系列【原创干货持续更新中……】🚀 人生格言: 人生从来没有捷径,只有行动才是治疗恐惧和懒惰的唯一良药. 更多原创,欢迎关注:Android…

打开的idea项目maven不生效

方法一&#xff1a;CtrlshiftA&#xff08;或者help---->find action&#xff09;&#xff0c; 输入maven&#xff0c; 点击add maven projects&#xff0c;选择本项目中的pom.xml配置文件&#xff0c;等待加载........ 方法二&#xff1a;view->tools windows->mave…

使用Python将Word文档转换为PDF的方法

摘要&#xff1a; 文介绍了如何使用Python编程语言将Word文档转换为PDF格式的方法。我们将使用python-docx和pywin32库来实现这个功能&#xff0c;这些库提供了与Microsoft Word应用程序的交互能力。 正文&#xff1a; 在现实生活和工作中&#xff0c;我们可能会遇到将Word文…

软考高级架构师——2、操作系统

一、进程管理 • 进程的状态&#xff08;★&#xff09; • 进程的同步与互斥&#xff08;★★★★&#xff09; 临界资源&#xff1a;诸进程间需要互斥方式对其进行共享的资源&#xff0c;如打印机、磁带机等 临界区&#xff1a;每个进程中访问临界资源的那段代码称为临界区…

ubuntu18.04 虚拟机与主机不通,虚拟机无法上网,导致无法git clone代码

问题前置&#xff1a;修改了固定ip。 虚拟机ip&#xff1a; 虚拟机设置NAT模式&#xff1a; 主机配置网络适配器&#xff1a;分配ipv4192.168.152.2保持与虚拟机的虚拟网关192.168.152.0,192.168.152.1在同一网段。虚拟机静态ip为192.168.152.146 虚拟机&#xff0c;网关&#…

【项目 线程4】3.12生产者消费者模型 3.13条件变量 3.14信号量 C++实现生产者消费者模型

3.12生产者消费者模型 生产者消费者模型中的对象&#xff1a; 1、生产者 2、消费者 3、容器 若容器已满&#xff0c;生产者阻塞在这&#xff0c;通知消费者去消费&#xff1b;若容器已空&#xff0c;则消费者阻塞&#xff0c;通知生产者去生产。生产者可以有多个&#xff0c;消…

供水管网漏损监测,24小时保障城市供水安全

供水管网作为城市生命线重要组成部分&#xff0c;其安全运行是城市建设和人民生活的基本保障。随着我国社会经济的快速发展和城市化进程的加快&#xff0c;城市供水管网的建设规模日益增长。然而&#xff0c;由于管网老化、外力破坏和不当维护等因素导致的供水管网漏损&#xf…

RabbitMQ的安装

RabbitMQ的安装 1、Windows环境下的RabbitMQ安装步骤 使用的版本&#xff1a;otp_win64_23.2 rabbitmq-server-3.8.16 版本说明&#xff1a;https://www.rabbitmq.com/which-erlang.html#compatibility-matrix 1.1 下载并安装erlang RabbitMQ 服务端代码是使用并发式语言…

8.5作业

要求实现AB进程对话 a.A进程先发送一句话给B进程&#xff0c;B进程接收后打印 b.B进程再回复一句话给A进程&#xff0c;A进程接收后打印 c.重复1.2步骤&#xff0c;当收到quit后&#xff0c;要结束AB进程 A进程 #include<stdio.h> #include<string.h> #include&…