使用andlua+写一个获取VSCode最新版本号的安卓软件

点击加号

选择Defalut模板

名称改为vscv

包名改为com.b.vscv

编辑main.lua

lua 复制代码
require "import"
import "android.app.*"
import "android.os.*"
import "android.widget.*"
import "android.view.*"
import "layout"

import "http"

activity.setTheme(R.Theme_Black)
activity.setTitle("")
activity.setContentView(loadlayout(layout))

url = "https://code.visualstudio.com/updates"
Http.get(url,nil,'utf-8',nil,function(code,html))
  --截取下载地址
  --Downloads到版本号距离72个字符,所以使用100
  urlpos = string.find(html, "Downloads")
  url = string.sub(html, urlpos, urlpos + 100)
  iter = string.gmatch(url, '%d+%.%d+%.%d+')
  for w,v in iter do
    文本.setText(w)
  end
end

编辑layout.aly

json 复制代码
{
  LinearLayout;
  backgroundColor="0xFF000000";
  layout_height="fill";
  orientation="vertical";
  layout_width="fill";
  {
    TextView;
    textsize="50sp";
    layout_gravity="center";
    layout_marginTop="100dp";
    id="文本";
    text="正在获取......";
    textColor="0xFFFFFFFF";
  };
};

右上角点击选项,项目,属性

关闭调试模式

取消勾选存储权限

右上角点击选项,项目,打包

相关推荐
摇滚侠2 分钟前
帮我整理一份 IDEA 开发中常用快捷键
java·ide·intellij-idea
y = xⁿ1 小时前
MySQL:count(1)与count(*)有什么区别,深分页问题
android·数据库·mysql
dyxal2 小时前
VS Code 终端疑难杂症排查:为什么 PowerShell 无法启动?
vscode
【ql君】qlexcel3 小时前
Visual Studio Code开发STM32设置头文件宏定义uint32_t报错
vscode·stm32·vs code·头文件宏定义·uint32_t报错·uint8_t报错·uint16_t报错
琉璃榴3 小时前
Visual Studio Code连接远程服务器
服务器·vscode·github
程序员陆业聪3 小时前
Android启动全景图:一次冷启动背后到底发生了什么
android
HuDie3404 小时前
agent项目实操笔记
ide
jieyucx4 小时前
Golang 完整安装与 VSCode 开发环境搭建教程
开发语言·vscode·golang
安卓程序员_谢伟光5 小时前
m3颜色定义
android·compose
梦魇星虹5 小时前
idea Cannot find declaration to go to
java·ide·intellij-idea