shared Prefernces

android ini文件 sharePrefernces 保存数据 立即下载

Shared Prefernces 是一种相对简单的数据存储方式,实质上它把需要记录的数据以“键——值”的方式写入到一张xml文件中,然后这张XML文件并不是用户手动生成的。在本实例中想xml文件存放在以下的目录中:data/data/com.creative.SharedPreferencesTest/shared_prefs


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
	<EditText
		android:id            = "@+id/editext01"
		android:layout_width  = "fill_parent"
		android:layout_height = "200px"
	/>
	<Button
		android:id            = "@+id/readbtn"
		android:layout_width  = "wrap_content"
		android:layout_height = "wrap_content"
		android:text          = "读取文件"
	/>
	<Button
		android:id            = "@+id/writebtn"
		android:layout_width  = "wrap_content"
		android:layout_height = "wrap_content"
		android:text          = "写入文件"
	/>
</LinearLayout>

package com.creative.SharedPreferencesTest;

import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class SharedPreferencesTestActivity extends Activity 
{
	private EditText _editText = null;
	
    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        _editText = (EditText)findViewById(R.id.editext01);
        
        Button readBtn  = (Button)findViewById(R.id.readbtn);
        Button writeBtn = (Button)findViewById(R.id.writebtn);
        
        // 读取文本
        readBtn.setOnClickListener(new OnClickListener()
        {
			@Override
			public void onClick(View v)
			{
				readMessage();
			}});
        
        // 写入文本
        writeBtn.setOnClickListener(new OnClickListener()
        {
			@Override
			public void onClick(View v)
			{
				writeMessage();
			}});
    }
    
    // 读取文件
    public void readMessage()
    {
    	// 获取当前的 SharedPreferences对象
    	SharedPreferences message = getPreferences(Activity.MODE_PRIVATE);
    	
    	// 获取消息
    	String text = message.getString("message", "");
    	
    	_editText.setText(text);
    }
   
    // 写入文件
    public void writeMessage()
    {
    	// 创建一个SharedPreferences对象
    	SharedPreferences message = getPreferences(0);
    	
    	// 编辑SharedPreferences对象
    	SharedPreferences.Editor editor = message.edit();
    	
    	// 插入一个数据
    	editor.putString("message", _editText.getText().toString());
    	
    	// 提交数据
    	editor.commit();
    }
}


VLOOKUP_fixed.py 立即下载

相关推荐

YOLO26算法心电图十二导联目标检测+训练好的模型+368张数据集+pyqt可视化界面.zip

附训练好的 YOLO 权重与 PyQt 可视化检测界面,页面底部含可视化效果预览,毕设/课设开箱即用。 【数据集概况】 · 检测类别(中文):[导联I(I), 导联II(II), 导联III(III), 胸导联V1(V1), 胸导联V2(V2), 胸导联V3(V3), 胸导联V4(V4), 胸导联V5(V5), 胸导联V6(V6), 加压肢体导联aVF(aVF), 加压肢体导联aVL(aVL), 加压肢体导联aVR(aVR)] · 训练集:313 张 · 验证集:37 张 · 测试集:18 张 · 总计:368 张 该数据集聚焦于临床心电图信号的精准识别与定位,其核心检测目标为标准12导联心电图中的各个独立导联波形区域,涵盖肢体导联(I、II、III)与加压肢体导联(aVR、aVL、aVF),以及胸前导联(V1至V6),适用于心电图自动分析系统中对各导联位置的快速准确标注与分类。数据采集场景真实还原了医院心电图室或急诊监护环境下的标准心电图记录纸,波形清晰、基线稳定,具有高度临床参考价值。... 【训练曲线与评估图】 【模型训练配置】 参数 | 值 模型 | yolo26n 训练轮数 | 100 epochs 输入尺寸 | 640x640 批次大小 | 24 优化器 | auto 初始学习率 | 0.01 训练设备 【关键指标汇总】 训练了 57 个 epoch,最终轮指标: 指标 | 数值 mAP50 | **0.9708** mAP50-95 | 0.6344 Precision | 0.8990 Recall | 0.9191 train/box_loss | 1.2231 train/cls_loss | 0.9703 val/box_loss | 1.2779 val/cls_loss | 0.... 使用场景:毕业设计、课程设计、深度学习入门、工业场景落地验证。

Files and prefernces

<br />Using the SharedPreferences class you can create named maps of key/value pairs within your<br />application that can be shared among application components running in the same application<br />context.<br /> <br /> call getSharedPreferences on the ap

devil8389的专栏 754

企业级AI助手平台 开箱即用的全栈AI平台,支持多智能体协同、Supervisor模式编排、多种决策模式、RAG技术和流程编排能力 支持多厂商大模型统一接入与管理,安全可控的企业知识库与高精度检索优化

企业级AI应用开发框架,支持多厂商大模型统一接入与管理,安全可控的企业知识库与高精度检索优化能力,提供可视化流程编排、自主决策智能体与多智能体协同调度,兼容主流 Agent Skill 协议,帮助企业与开发者零门槛快速构建安全、高效、可落地的AI智能体应用与行业解决方案。

界面化查看 shared preferences 和Database

界面化查看 shared preferences 和Database

huolailaipianai的博客 480

基于NE555的触摸延时开关电路设计与实现

本文详细介绍了基于NE555芯片的触摸延时开关电路设计与实现方法。通过分析NE555的单稳态工作模式,结合定时电阻、电解电容等关键元件选型,提供了一套完整的电路搭建方案。文章还包含抗干扰设计、调试技巧及常见故障处理,帮助电子爱好者快速掌握触摸延时灯的制作要点。

weixin_29268267的博客 788

Claude Code 实战指南:用 AI 玩转终端编程,效率狂飙!

本文介绍了终端 AI 代理工具 Claude Code,涵盖常用命令、使用方法(如 init 初始化、权限配置、工作流程、上下文管理)、MCP 扩展工具及实战案例,展示其通过自然语言辅助开发的高效性与实用性。

个人技术 1万+

录制音频

package com.creative.RecorderDemo; import java.io.File; import java.io.IOException; import android.app.Activity; import android.media.MediaPlayer; import android.media.MediaRecorder; import android.

Hello______world的巢 1117

国内网络环境下Calico v3.26.4安装避坑指南(附华为云镜像加速脚本)

本文为国内开发者提供Calico v3.26.4的高效部署指南,重点介绍如何通过华为云镜像加速服务解决Kubernetes集群网络插件镜像拉取问题。文章包含详细的镜像加速脚本、部署清单修改方法及深度排错技巧,帮助开发者快速完成Calico网络插件的安装与配置。

brown的博客 288

android 自定义主题和风格

#987456 24sp true @drawable/icon ?android:windowFrame <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="h

Hello______world的巢 1080

高通camx架构学习(零)—— 深入理解Camera 硬件抽象层

从上面的定义可以看出,主要是通过hw_module_t 代表了模块,通过其open方法用来打开一个设备,而该设备是用hw_device_t来表示,其中除了用来关闭设备的close方法外,并无其它方法,由此可见谷歌定义的HAL接口,并不能满足绝大部分HAL模块的需要,所以谷歌想出了一个比较好的解决方式,那便是将这两个基本结构嵌入到更大的结构体内部,同时在更大的结构内部定义了各自模块特有的方法,用于实现模块的功能,这样,一来对上保持了HAL的统一规范,二来也扩展了模块的功能。

图像学习之旅 1668

Keil C51里用printf打印数据,为啥总出乱码?手把手教你%bd、%hd、%ld的正确用法

本文深入解析Keil C51中printf打印数据出现乱码的根本原因,并提供格式符%bd、%hd、%ld的正确用法指南。通过详细的调试技巧和实战案例,帮助开发者解决串口输出问题,提升单片机开发效率。

weixin_26854829的博客 281

Gallery

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextV

Hello______world的巢 995

GWAS与eQTL相结合,进一步筛选疾病相关基因

欢迎关注”生信修炼手册”!在GWAS分析结果中,大部分显著的SNP位点都位于非编码区,很难直接挖掘这些位点的调控机制。通常假设与疾病关联的SNP位点通过调控基因表达来发挥作用,而eQTL...

庐州月光的博客 1万+

Basic view

package com.example.ba; import android.os.Bundle; import android.app.Activity; import android.app.ListActivity; import android.view.Menu; import android.view.View; import android.widget.ArrayAdapter;

Hello______world的巢 978

数字电路逻辑与设计实验三 译码器和数据选择器

1. 译码器功能测试 将 74LS139 按图 3.1 接线,按表 3.2 输入电平分别置位,填输出状态表。 2. 译码器转换 将双 2-4 线译码器转换为 3-8 线译码器。 (1)画出转换电路图。 (2)在实验箱上接线并验证设计是否正确。 (3)设计并填表写该 3-8 线译码器功能表,画出输入、输出波形。 3. 数据选择器的测试及应用 (1) 将双 4 选 1 数据选择器 74LS153 参照图 3.2 接线,测试其功能并填写功能表 3.3。 (2)将实验箱脉冲信号源中固定连续脉冲 4 个不

欢迎交流学习心得 3085

【ROS2】从yaml文件中读取参数配置

ROS2:从yaml中读取参数,到节点;使用C++演示参数的增、删、改、查、遍历、监听变化

郭老二 1284

响应触摸事件

protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button ex = (Button)findViewById(R.id.ex_button); ex.setOnClickListen

Hello______world的巢 959

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

ScrollView

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <LinearLayout android:layout_widt

Hello______world的巢 884

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

摄像头

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation ="vertical" android:layout_width="fill_parent" android:layout_height ="fill_parent"> <SurfaceView an

Hello______world的巢 863

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

通过事件启动另外一个Activity

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" >

Hello______world的巢 863

生命周期

package com.example.lifecycle; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.widget.*; public class MainActivity extends Activity { @Override pro

Hello______world的巢 854

spinners

package com.example.spinners; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.view.View; import android.widget.AdapterView; import android.widget.Ad

Hello______world的巢 851

SQLite

package mars.sqlite3; import mars.sqlite3.db.DatabaseHelper; import android.app.Activity; import android.content.ContentValues; import android.database.Cursor; import android.database.sqlite.SQLiteDa

Hello______world的巢 740

basic view

package net.learn2develop.BasicViews5; import android.app.ListActivity; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.ListView; import

Hello______world的巢 669

LinearLayout和RelativeLayout 属性

LinearLayout和RelativeLayout 属性对比 共有属性: java代码中通过btn1关联次控件 android:id=”@+id/btn1″ 控件宽度 android:layout_width=”80px” //”80dip”或”80dp” android:layout_width =“wrap_content” android:layout_width =“match_par

Hello______world的巢 587
上一篇: 文本的读写
下一篇: SQLite
Hello______world
博客等级 码龄14年 16粉丝 106原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值