Android
勿忘心安_0713
这个作者很懒,什么都没留下…
展开
-
Android4.0版本以上不能在主线程中访问socket的解决办法
在oncreate方法中加入if (Build.VERSION.SDK_INT >= 11) { StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectDiskReads ().detectDiskWrites().detectNetwork().penaltyLog().build());原创 2014-04-21 16:01:18 · 1031 阅读 · 0 评论 -
Context获取文件的输入输出流
直接获取一个文件的输入流FileInputStream fis = context.openFileInput("info.txt");等价于File file = new File(context.getFilesDir(),"info.txt"); FileInputStream fis = new FileInputStream(file);直接获取一个文件的输出流c原创 2014-03-25 22:24:02 · 1980 阅读 · 0 评论 -
采用上下文获取应用程序文件目录
public class SaveData { public static void saveUserFile(Context context,String user,String pass)throws Exception{ File userData=new File(context.getFilesDir(),"info.txt"); FileOutputStream fos=ne原创 2014-03-25 21:58:58 · 627 阅读 · 0 评论 -
Android相对布局(RelativeLayout)imageButton属性详解
android:layout_centerHrizontal 水平居中 android:layout_centerVertical 垂直居中 android:layout_centerInparent 相对于父元素完全居中 android:layout_alignParentBottom 贴紧父元素的下边缘 android:layout原创 2014-04-25 14:05:19 · 1669 阅读 · 0 评论