实验六:Android的网络编程基础

news2024/9/28 3:26:44

实验六:Android 的网络编程基础

6.1 实验目的

本次实验的目的是让大家熟悉 Android 开发中的如何获取天气预报,包括了

解和熟悉 WebView、WebService 使用、网络编程事件处理等内容。

6.2 实验要求

  • 熟悉和掌握 WebView 使用

  • 了解 Android 的网络编程

  • 熟悉和掌握 WebService 使用

6.3 实验内容

【练习 6.1】基于 Webview 的获取天气预报

1. 项目结构

项目名:WebViewWeather

项目结构:

  • res/layout/activity_main.xml:主布局文件
  • res/values/strings.xml:字符串资源文件
  • src/com/example/webview/MainActivity.java:主Activity文件
  • AndroidManifest.xml:Android清单文件
2. 主布局文件 (activity_main.xml)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:orientation="vertical"
 android:gravity="center_horizontal"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent">

    <!-- 按钮布局 -->
    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">
        <!-- 按钮:北京 -->
        <Button
            android:id="@+id/bj"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/bj"
            android:textSize="30dp" />
        <!-- 按钮:上海 -->
        <Button
            android:id="@+id/sh"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/sh"
            android:textSize="30dp" />
        <!-- 按钮:哈尔滨 -->
        <Button
            android:id="@+id/heb"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/heb"
            android:textSize="30dp" />
    </LinearLayout>

    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">
        <!-- 按钮:广州 -->
        <Button
            android:id="@+id/gz"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/gz"
            android:textSize="30dp" />
        <!-- 按钮:长春 -->
        <Button
            android:id="@+id/cc"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/cc"
            android:textSize="30dp" />
        <!-- 按钮:沈阳 -->
        <Button
            android:id="@+id/sy"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/sy"
            android:textSize="30dp"
            android:layout_gravity="right" />
    </LinearLayout>

    <!-- WebView组件 -->
    <WebView
        android:id="@+id/webView1"
        android:layout_width="match_parent"
        android:layout_height="0dip"
        android:focusable="false"
        android:layout_weight="1"/>
</LinearLayout>
3. 字符串资源文件 (strings.xml)
<resources>
    <string name="app_name">WebViewWeather</string>
    <string name="go">GO</string>
    <string name="bj">北京</string>
    <string name="sh">上海</string>
    <string name="gz">广州</string>
    <string name="heb">哈尔滨</string>
    <string name="cc">长春</string>
    <string name="sy">沈阳</string>
</resources>
4. 主Activity文件 (MainActivity.java)
package com.example.webviewweather;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;

public class MainActivity extends Activity implements OnClickListener {

    private WebView webView;

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

        webView = (WebView) findViewById(R.id.webView1);
        webView.getSettings().setJavaScriptEnabled(true);
        webView.setWebChromeClient(new WebChromeClient());
        webView.setWebViewClient(new WebViewClient());
        webView.loadUrl("http://m.weather.com.cn/mweather/");
        webView.setInitialScale(57  4);

        Button bj = (Button) findViewById(R.id.bj);
        bj.setOnClickListener(this);

        Button sh = (Button) findViewById(R.id.sh);
        sh.setOnClickListener(this);

        Button heb = (Button) findViewById(R.id.heb);
        heb.setOnClickListener(this);

        Button cc = (Button) findViewById(R.id.cc);
        cc.setOnClickListener(this);

        Button sy = (Button) findViewById(R.id.sy);
        sy.setOnClickListener(this);

        Button gz = (Button) findViewById(R.id.gz);
        gz.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.bj:
                openUrl("101010100");
                break;
            case R.id.sh:
                openUrl("101020100");
                break;
            case R.id.heb:
                openUrl("101050101");
                break;
            case R.id.cc:
                openUrl("101060101");
                break;
            case R.id.sy:
                openUrl("101070101");
                break;
            case R.id.gz:
                openUrl("101280101");
                break;
        }
    }

    private void openUrl(String id) {
        webView.loadUrl("http://m.weather.com.cn/mweather/" + id + ".shtml");
    }
}
5. Android清单文件 (AndroidManifest.xml)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.webview" >

    <uses-permission android:name="android.permission.INTERNET"/>

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

        <activity android:name=".MainActivity" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>
6.运行效果

image-20231116232704967


【练习 6.2】基于 WebService 的手机归属地查询

1. 添加 ksoap2-android 库
  1. 在 ksoap2-android 的项目下载网站 下载 ksoap2-android-assembly-2.4-jar-with-dependencies.jar

    • 如果难以下载,可以在随书光盘中找到该 JAR 包。
  2. 将下载的 ksoap2-android JAR 包添加到工程的 lib 目录下。

  3. 右键点击 JAR 包,选择 “Add as library”,将 ksoap2-android 集成到 Android 项目中。

2. WebService 配置
  1. 打开 http://ws.webxml.com.cn/WebServices/MobileCodeWS.asmx。

  2. 点击 “getMobileCodeInfo” 进入说明页,获取以下关键信息:

    • 作用域 TargetNameSpace = http://WebXml.com.cn/
    • 查询的方法名为 “getMobileCodeInfo”,需要带上 “mobileCode” 与 “userID” 两个参数。
    • 返回的结果存在 “getMobileCodeInfoResult” 中。
  3. 在 http://ws.webxml.com.cn/WebServices/MobileCodeWS.asmx?wsdl 可以访问其 WSDL 说明。

3. 资源文件布局
  1. 创建 activity_web_client.xml 文件,定义界面布局。
<?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="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:orientation="vertical"
    tools:context="com.example.webservicephonelocationlookup.WebClient">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="输入手机号:" />

        <EditText
            android:layout_width="150dp"
            android:layout_height="wrap_content"
            android:id="@+id/etphone" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="搜索"
            android:id="@+id/btnsearch" />
    </LinearLayout>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="查询结果:" />

    <TextView
        android:id="@+id/tvinfo"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>
</LinearLayout>
4. Java 代码
  1. 创建 WebClient.java 文件,实现 WebService 调用逻辑。
package com.example.webservicephonelocationlookup;



import android.os.AsyncTask;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.SoapFault;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import org.xmlpull.v1.XmlPullParserException;

import java.io.IOException;

public class WebClient extends AppCompatActivity {
    private static final String SERVER_URL = "http://ws.webxml.com.cn/WebServices/MobileCodeWS.asmx?wsdl";
    private static final String NAMESPACE = "http://WebXml.com.cn/";
    private static final String METHOD_NAME = "getMobileCodeInfo";

    private EditText etPhone;
    private Button btnSearch;
    private TextView tvInfo;

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

        etPhone = (EditText) findViewById(R.id.etphone);
        btnSearch = (Button) findViewById(R.id.btnsearch);
        tvInfo = (TextView) findViewById(R.id.tvinfo);

        btnSearch.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String phoneNumber = etPhone.getText().toString();
                if (phoneNumber.length() > 0) {
                    getPhoneLocation(phoneNumber);
                }
            }
        });
    }

    private void getPhoneLocation(String phoneNumber) {
        new AsyncTask<String, Void, String>() {
            @Override
            protected String doInBackground(String... params) {
                String location = "";
                final HttpTransportSE httpSe = new HttpTransportSE(SERVER_URL);
                httpSe.debug = true;

                SoapObject soapObject = new SoapObject(NAMESPACE, METHOD_NAME);
                soapObject.addProperty("mobileCode", params[0]);
                soapObject.addProperty("userID", "");

                final SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER10);
                envelope.setOutputSoapObject(soapObject);
                envelope.dotNet = true;

                // 获取返回信息
                try {
                    httpSe.call(NAMESPACE + METHOD_NAME, envelope);
                    if (envelope.getResponse() != null) {
                        SoapObject result = (SoapObject) envelope.bodyIn;
                        location = result.getProperty("getMobileCodeInfoResult").toString();
                    }
                } catch (XmlPullParserException | SoapFault | IOException e) {
                    e.printStackTrace();
                }
                return location;
            }

            @Override
            protected void onPostExecute(String result) {
                tvInfo.setText(result);
            }
        }.execute(phoneNumber);
    }
}
5. AndroidManifest.xml 配置
  1. AndroidManifest.xml 中添加 INTERNET 权限。
<uses-permission android:name="android.permission.INTERNET"/>
  1. 配置应用程序的入口 Activity。
<activity android:name="com.example.webservice.WebClient">
    <intent-filter>
        <action android:name

="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>
6. 运行效果
  • 在模拟器或真机上运行应用程序,输入手机号码,点击搜索按钮,查看查询结果。

image-20231117151014751


【拓展】编写 Android 程序,实现使用系统内置游览器打开指定网页。

步骤 1: 创建新项目
  1. 打开 Android Studio,选择 “Start a new Android Studio project”。
  2. 选择 “Empty Activity” 模板,点击 “Next”。
  3. 命名项目为 “WebBrowserDemo”,选择语言为 “Java”,点击 “Finish”。
步骤 2: 修改布局文件
  1. 打开 activity_main.xml 文件,用以下代码替换其中的内容:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:gravity="center_horizontal"
    android:orientation="vertical">

    <EditText
        android:id="@+id/ed"
        android:layout_width="match_parent"
        android:layout_height="200px">

    </EditText>

    <Button
        android:id="@+id/bu1"
        android:layout_width="286dp"
        android:layout_height="wrap_content"
        android:text="Go" />

    <WebView
        android:id="@+id/webView1"
        android:layout_width="match_parent"
        android:layout_height="0dip"
        android:layout_weight="1"
        android:focusable="false" />
</LinearLayout>
步骤 3: 编写 Java 代码
  1. 打开 MainActivity.java 文件,用以下代码替换其中的内容:
package com.example.webbrowserdemo;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class MainActivity extends Activity{
    private WebView webView; //声明 WebView 组件的对象
    String url="";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        webView=(WebView)findViewById(R.id.webView1); //获取WebView 组件
        webView.getSettings().setJavaScriptEnabled(true); //设置 JavaScript可用
        webView.setWebChromeClient(new WebChromeClient()); //处理JavaScript 对话框
        webView.setWebViewClient(new WebViewClient()); //处理各种通知和请求事件,如果不使用该句代码,将使用内置浏览器访问网页
        webView.setInitialScale(57*4); //放网页内容放大 4 倍

        Button bu1=(Button)findViewById(R.id.bu1);
        EditText editText=findViewById(R.id.ed);
        bu1.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                url=editText.getText().toString();
                openUrl(url);
            }
        });
    }
    //打开网页的方法
    private void openUrl(String id){
        if (!url.equals("")){
            webView.loadUrl("http://"+id+"/"); //
        }else {
            Toast.makeText(this,"网址不能为空",Toast.LENGTH_LONG).show();

        }

    }
}
步骤 4: 运行应用
  1. 运行应用程序,点击 “打开网页” 按钮。

  2. 系统将使用内置浏览器打开指定网页。

    image-20231117171143765

【拓展】编写 Android 程序,实现从指定网站下载文件。

步骤 1: 创建新的 Android 项目
  1. 打开 Android Studio。
  2. 选择 “Start a new Android Studio project”。
  3. 选择 “Empty Activity” 模板,然后点击 “Finish”。
步骤 2: 修改布局文件

打开 res/layout/activity_main.xml 文件,并使用以下 XML 代码替换默认的布局:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
    tools:context=".MainActivity">

    <Button
        android:id="@+id/downloadButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:text="下载文件" />
</RelativeLayout>
步骤 3: 在 MainActivity.java 中添加代码

打开 MainActivity.java 文件,修改 onCreate 方法和添加新的方法:

package com.example.filedownloader;

import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

import java.io.BufferedInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;

public class MainActivity extends AppCompatActivity {

    private static final String DOWNLOAD_URL = "https://image.baidu.com/search/detail?ct=503316480&z=undefined&tn=baiduimagedetail&ipn=d&word=%E7%99%BE%E5%BA%A6%E5%9B%BE%E7%89%87&step_word=&lid=7733045057659531704&ie=utf-8&in=&cl=2&lm=-1&st=undefined&hd=undefined&latest=undefined&copyright=undefined&cs=505978886,3280506511&os=2821336839,1523677687&simid=3395585618,291075366&pn=0&rn=1&di=7264239678495129601&ln=1594&fr=&fmq=1700213057065_R&fm=&ic=undefined&s=undefined&se=&sme=&tab=0&width=undefined&height=undefined&face=undefined&is=0,0&istype=0&ist=&jit=&bdtype=0&spn=0&pi=0&gsm=1e&objurl=https%3A%2F%2Fp3.itc.cn%2Fq_70%2Fimages03%2F20211117%2F1270baf1c2f84fa19a99ef82c52d454c.png&rpstart=0&rpnum=0&adpicid=0&nojc=undefined&dyTabStr=MCwxLDIsMyw2LDQsNSw4LDcsOQ%3D%3D";

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

        Button downloadButton = findViewById(R.id.downloadButton);
        downloadButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                new DownloadFileTask().execute(DOWNLOAD_URL);
            }
        });
    }

    private class DownloadFileTask extends AsyncTask<String, Void, Boolean> {
        @Override
        protected Boolean doInBackground(String... urls) {
            String fileUrl = urls[0];
            try {
                URL url = new URL(fileUrl);
                HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
                urlConnection.connect();

                InputStream inputStream = urlConnection.getInputStream();
                int totalSize = urlConnection.getContentLength();
                int downloadedSize = 0;

                byte[] buffer = new byte[1024];
                int bufferLength;

                String fileName = "示例图片.png"; // 文件保存的名称
                FileOutputStream fileOutputStream = new FileOutputStream(
                        Environment.getExternalStorageDirectory().getPath() + "/" + fileName);

                while ((bufferLength = inputStream.read(buffer)) > 0) {
                    fileOutputStream.write(buffer, 0, bufferLength);
                    downloadedSize += bufferLength;
                }

                fileOutputStream.close();
                return true;

            } catch (IOException e) {
                e.printStackTrace();
                return false;
            }
        }

        @Override
        protected void onPostExecute(Boolean result) {
            if (result) {
                Toast.makeText(MainActivity.this, "文件下载成功", Toast.LENGTH_SHORT).show();
            } else {
                Toast.makeText(MainActivity.this, "文件下载失败", Toast.LENGTH_SHORT).show();
            }
        }
    }
}
步骤 4: 添加 Internet 和存储权限

确保在 AndroidManifest.xml 文件中添加了 Internet 和存储权限:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
步骤 5: 运行应用

image-20231117172551780

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

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

相关文章

cs与msf联动

实验环境 cs4.4(4.5版本不知道为啥实现不了) cs服务器与msf在同一台vps上 本地win7虚拟机 cs派生会话给msf 首先cs正常上线win7&#xff0c;这就不多说了&#xff0c;然后说如何将会话派生给msf cs准备 选择Foreign&#xff0c;这里可以选HTTP&#xff0c;也可以选HTTPS…

LLM大模型权重量化实战

大型语言模型 (LLM) 以其广泛的计算要求而闻名。 通常&#xff0c;模型的大小是通过将参数数量&#xff08;大小&#xff09;乘以这些值的精度&#xff08;数据类型&#xff09;来计算的。 然而&#xff0c;为了节省内存&#xff0c;可以通过称为量化的过程使用较低精度的数据类…

庖丁解牛:NIO核心概念与机制详解

文章目录 Pre输入/输出Why NIO流与块的比较通道和缓冲区概述什么是缓冲区&#xff1f;缓冲区类型什么是通道&#xff1f;通道类型 NIO 中的读和写概述Demo : 从文件中读取1. 从FileInputStream中获取Channel2. 创建ByteBuffer缓冲区3. 将数据从Channle读取到Buffer中 Demo : 写…

基于静电放电算法优化概率神经网络PNN的分类预测 - 附代码

基于静电放电算法优化概率神经网络PNN的分类预测 - 附代码 文章目录 基于静电放电算法优化概率神经网络PNN的分类预测 - 附代码1.PNN网络概述2.变压器故障诊街系统相关背景2.1 模型建立 3.基于静电放电优化的PNN网络5.测试结果6.参考文献7.Matlab代码 摘要&#xff1a;针对PNN神…

JVM:字节码文件,类的生命周期,类加载器

JVM&#xff1a;字节码文件&#xff0c;类的生命周期&#xff0c;类加载器 为什么要学这门课程 1. 初识JVM1.1. 什么是JVM1.2. JVM的功能1.3. 常见的JVM 2. 字节码文件详解2.1. Java虚拟机的组成2.2. 字节码文件的组成2.2.1. 以正确的姿势打开文…

电脑软件:推荐一款非常实用的固态硬盘优化工具

目录 一、软件简介 二、工作原理 三、功能介绍 3.1、优化SSD设置 3.2、查看驱动器信息 3.3、查看SMART数据 3.4、停用Windows事件日志记录 3.5、禁用Windows碎片整理 3.6、时间戳停用 3.7、禁用引导文件的碎片整理 3.8、关闭短名称 四、使用教程 4.1 安装说明 4.…

OpenCV图像处理、计算机视觉实战应用

OpenCV图像处理、计算机视觉实战应用 专栏简介一、基于差异模型模板匹配缺陷检测二、基于NCC多角度多目标匹配三、基于zxing多二维码识别四、基于tesseract OCR字符识别 专栏简介 基于OpenCV C分享一些图像处理、计算机视觉实战项目。不定期持续更新&#xff0c;干货满满&…

[C/C++]数据结构 链表(单向链表,双向链表)

前言: 上一文中我们介绍了顺序表的特点及实现,但是顺序表由于每次扩容都是呈二倍增长(扩容大小是自己定义的),可能会造成空间的大量浪费,但是链表却可以解决这个问题. 概念及结构: 链表是一种物理存储结构上非连续、非顺序的存储结构,数据元素的逻辑顺序是通过链表中的指针链接…

【自用总结】正项级数审敛法的总结

注&#xff1a;收敛半径的求法就是lim n->∞ |an1/an| ρ&#xff0c;而ρ1/R&#xff0c;最基本的不能忘。 比较判别法&#xff1a;从某项起&#xff0c;该级数后面的项均小于等于另一级数&#xff0c;则敛散性可进行一定的比较 可以看到&#xff0c;比较判别法实际上比较…

跟我一起来做一个音视频产品功能!

前言&#xff1a; 大家好&#xff0c;上来和大家汇报一下h264翻译进度&#xff0c;目前翻译完了第六章&#xff0c;第七章快翻译完了&#xff0c;马上可以翻译第八章。 在第七章翻译完了之后&#xff0c;我会做一个知识点总结出来&#xff0c;一起学习&#xff0c;一起进步&…

Android 13.0 Launcher3仿ios长按app图标实现抖动动画开始拖拽停止动画

1.概述 在13.0的系统rom定制化开发中,在对系统原生Launcher3的定制需求中,也有好多功能定制的,在ios等电子产品中 的一些好用的功能,也是可以被拿来借用的,所以在最近的产品开发需求中,需求要求模仿ios的 功能实现长按app图标实现抖动动画,接下来看如何分析该功能的实现…

【开源】基于JAVA的校园失物招领管理系统

项目编号&#xff1a; S 006 &#xff0c;文末获取源码。 \color{red}{项目编号&#xff1a;S006&#xff0c;文末获取源码。} 项目编号&#xff1a;S006&#xff0c;文末获取源码。 目录 一、摘要1.1 项目介绍1.2 项目录屏 二、研究内容2.1 招领管理模块2.2 寻物管理模块2.3 系…

主键问题以及分布式 id

分布式 id 需要处理的问题主要是同一时间在多台机器中保证生成的 id 唯一&#xff0c;为了这么做我们可以这么做&#xff1a; 分布式 id 生成策略 先说几个已经被淘汰的策略引出分布式 id 的问题 1&#xff0c;UUID&#xff1a;UUID 随机并且唯一&#xff0c;在单一的数据库…

调整COSWriter解决X-easypdf / PDFBOX生成大量数据时OOM问题

背景 业务需要生成一个15W数据左右的PDF交易报表。希望我们写在一个文件里&#xff0c;不拆分成多个PDF文件。 使用的技术组件 <dependency><groupId>wiki.xsx</groupId><artifactId>x-easypdf-pdfbox</artifactId><version>2.11.10<…

基于和声算法优化概率神经网络PNN的分类预测 - 附代码

基于和声算法优化概率神经网络PNN的分类预测 - 附代码 文章目录 基于和声算法优化概率神经网络PNN的分类预测 - 附代码1.PNN网络概述2.变压器故障诊街系统相关背景2.1 模型建立 3.基于和声优化的PNN网络5.测试结果6.参考文献7.Matlab代码 摘要&#xff1a;针对PNN神经网络的光滑…

IPSecGRE

IPSec&GRE 手工方式建立IPSec隧道组网实验拓扑配置步骤第一步配置IP地址第二步配置静态路由第三步配置IPSec 抓包测试 GRE Over IPSec功能的配置组网实验拓扑配置命令 配置GRE使用静态路由组网图实验拓扑配置步骤1.配置RouterA2.配置RouterB3.配置RouterC4.验证配置结果 手…

【限时免费】20天拿下华为OD笔试之 【前缀和】2023B-最大子矩阵和【欧弟算法】全网注释最详细分类最全的华为OD真题题解

文章目录 题目描述与示例题目描述输入描述输出描述示例输入输出说明 解题思路如何表示一个子矩阵暴力解法二维前缀和优化二维前缀和矩阵的构建 代码解法一&#xff1a;二维前缀和PythonJavaC时空复杂度 解法二&#xff1a;暴力解法&#xff08;不推荐&#xff09;PythonJavaC时…

Pattern Recognition投稿经验

文章目录 ManuscriptTitle PageHighlightsAuthor BiographyDeclarationSubmit 合作推广&#xff0c;分享一个人工智能学习网站。计划系统性学习的同学可以了解下&#xff0c;点击助力博主脱贫( •̀ ω •́ )✧ 停更了大半年&#xff0c;近期终于完成了论文投稿&#xff0c;趁…

聚观早报 |联想集团Q2财季业绩;小鹏汽车Q3营收

【聚观365】11月17日消息 联想集团Q2财季业绩 小鹏汽车Q3营收 微软发布两款自研AI芯片 FAA批准SpaceX再次发射星际飞船 2023 OPPO开发者大会 联想集团Q2财季业绩 全球数字经济领导企业联想集团公布截至2023年9月30日的2023/24财年第二财季业绩&#xff1a;整体营收达到10…

闲聊从零开发一个2D数字人流程实战

.2D数字人技术 百度&#xff0c;腾讯&#xff0c;等大厂都有自己的数字平台制作&#xff08;套壳&#xff1a;api后台转发vue前端&#xff09;&#xff0c;国外也有出名的heygen&#xff08;非常厉害一个&#xff09;通过开源项目组合实现&#xff0c;再打通每个项目已api的形…