- 博客(22)
- 资源 (3)
- 收藏
- 关注
原创 RandomAccessFile的文件读写与seek()的用法
package test;import java.io.File;import java.io.RandomAccessFile;/** * 一句话总结:seek用于设置文件指针位置,设置后ras会从当前指针的下一位读取到或写入到 * @author Administrator * */public class My { public static void main(Stri
2015-03-20 23:03:10 20650 1
原创 用File和RandomAccessFile新建一个文件
当我们执行File file = new File("test.txt");完毕后,只是创建了一个文件对象,在文件目录下还看不到test.txt文件,要想真正创建出test.txt文件有两种方式,方式一,执行file.createNewFile();方法,会生成test.txt文件方式二,执行RandomAccessFile ras=new RandomAccessFile(file,
2015-03-20 11:27:07 4101
原创 final关键字的用法
一、final修饰类:被final修饰的类,是不可以被继承的,这样做的目的可以保证该类不被修改,Java的一些核心的API都是final类,例如String、Integer、Math等代码举例:二、final修饰方法:子类不可以重写父类中被final修饰的方法代码举例:三、final修饰实例变量(类的属性,定义在类内,但是在类内的方法之外)final修饰
2015-03-18 16:05:40 6670 1
原创 ListView和SimpleAdapter的入门用法
ListView所在布局文件:<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_
2015-03-18 11:41:51 478
原创 ListView加ArrayAdapter的入门用法
ListView页面布局:<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_
2015-03-18 11:29:21 1504
原创 ListView和BaseAdapter和LayoutInflater的使用
ListView 所在xml布局文件:<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:lay
2015-03-18 11:06:18 650
原创 ListView和BaseAdapter显示数据实现滑动
xml布局文件:<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=
2015-03-18 10:43:08 819
原创 ScrollView实现滑动效果
布局文件代码:<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <LinearLayout android:id
2015-03-18 10:27:24 920
原创 Android中xml解析和序列化
import java.io.File;import java.io.FileInputStream;import java.io.FileNotFoundException;import java.io.FileOutputStream;import java.util.ArrayList;import java.util.List;import org.xmlpull.v1.Xm
2015-03-17 01:57:19 470
原创 用SharedPreferences保存用户信息
import java.util.HashMap;import java.util.Map;import android.content.Context;import android.content.SharedPreferences;import android.content.SharedPreferences.Editor;import android.text.TextUtil
2015-03-17 01:47:41 851
原创 写四种权限类型文件的方法
package com.yin.inputData;import java.io.FileNotFoundException;import java.io.FileOutputStream;import android.support.v7.app.ActionBarActivity;import android.content.Context;import android.os.B
2015-03-17 01:39:05 777
原创 RandomAccessFile的读取与写入
import java.io.IOException;import java.io.RandomAccessFile;public class P_copy { /** * @param args * @throws IOException */ public static void main(String[] args) throws IOException { /
2015-03-17 01:31:00 966
原创 RandomAccessFile简单用法
import java.io.File;import java.io.IOException;import java.io.RandomAccessFile;public class N_randomAccess { /**RandomAccessFile * 用于读写文件的类,可以对文件的内容进行操作;而File不可以对文件的内容进行操作 * @param args */
2015-03-17 01:29:58 503
原创 FileInputStream的读取和FileOutputStream的写入
package day08;import java.io.FileInputStream;import java.io.FileOutputStream;import java.io.IOException;public class I_copydemo { /**使用文件字节输入流FIS与文件字节输出流FOS * 实现文件的复制操作 * @param args * @
2015-03-17 01:27:03 1875
原创 java中的栈、堆以及equals和==的区别
java中的栈、堆在java中,栈中存放的是局部变量(方法中的变量,也就是引用变量),堆中存放的是对象(包括对象的属性),栈中引用变量的直接值实际上是堆中相应对象的首地址的值,也就是说栈中引用变量的值是其所指向对象的首地址,如图:图一:图二:图三:图四:equals和==的区别:总体概括:equals比较两个对象的内容是否相同 == 比较
2015-03-12 14:45:29 1456
原创 Android存取数据的几种方式
package com.yin.qqLogin.Utils;import java.util.HashMap;import java.util.Map;import android.content.Context;import android.content.SharedPreferences;import android.content.SharedPreferences.Edit
2015-03-09 21:58:53 615
原创 Android获取手机和SD卡的存储存储信息
主要是获取Android手机和SD卡的总空间和可用空间import java.io.File;import android.os.Bundle;import android.os.Environment;import android.os.StatFs;import android.support.v7.app.ActionBarActivity;import android.te
2015-03-08 22:33:02 660
原创 split不可以用含有$的字符串来分割字符串
今天写往手机内存存取数据时,发现用含有$的字符串来分割字符串无效,不知道为什么举例代码如下package test;import java.util.Arrays;public class My { public static void main(String[] args) { String str1="abc$#edf"; String[] result1=str1.
2015-03-08 17:30:06 1243
原创 Android常用的五大布局:LinearLayout/RelativeLayout/AbsoluteLayout/ TableLayout/FrameLayout
LinearLayout线性布局:<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="match_parent" android:orientation="
2015-03-07 17:39:19 584
原创 Android简易短信发送器
layout布局的xml文件的代码<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:lay
2015-03-07 17:25:33 379
原创 实现后台偷偷发短息 去掉标题
一个后台偷偷发短信的源代码:用户启动应用,界面一直显示一张图片不动,而后台已经开始发短息,layout布局代码:该布局只是加载一张背景图片,没有其他控件<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
2015-03-07 15:25:54 367
原创 Android拨打电话的四种实现方式
第一种:直接在layout的xml文件中给拨号按钮Button一个单机事件android:onClick="call"xml代码如下:<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:la
2015-03-07 14:51:17 2556 1
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人