摘要: 点击Button,EditText里的字会清空MainActivity: 1 5 6 10 11 1 public class MainActivity extends Activity {2 public static final String TAG = "MainActivity";3 4 @Override5 protected void onCreate(Bundle savedInstanceState) {6 super.onCreate(savedInstanceState);7 setContentView(... 阅读全文
posted @ 2014-03-19 10:35 songsiyao 阅读(134) 评论(0) 推荐(0) 编辑
摘要: 1 public class MainActivity extends Activity { 2 private ActionBar actionBar; 3 4 @Override 5 protected void onCreate(Bundle savedInstanceState) { 6 super.onCreate(savedInstanceState); 7 setContentView(R.layout.activity_main); 8 9 actionBar = getActionBar(); //... 阅读全文
posted @ 2014-01-15 13:42 songsiyao 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 1、使用支持库如果您的应用需要运行在3.0及以上的版本,可以忽略这部分内容。如果您的应用使用在3.0以下、1.6及以上的版本,需要使用支持库来构建。使用支持库的步骤:使用SDK下的SDK Manager工具下载Android Support Package2. 在您的Android工程的顶级目录下创建一个libs目录3. 找到您的SDK下的/extras/android/support/v4/android-support-v4.jar,并且拷贝到您的项目的libs下,选中这个jar包 → 右键 →Build Path → Add to Build Path4.在您的项目的Manifest.x 阅读全文
posted @ 2014-01-14 11:25 songsiyao 阅读(179) 评论(0) 推荐(0) 编辑
摘要: java中的IO整理写在前面:本文章基本覆盖了java IO的全部内容,java新IO没有涉及,因为我想和这个分开,以突出那个的重要性,新IO哪一篇文章还没有开始写,估计很快就能和大家见面。照旧,文章依旧以例子为主,因为讲解内容的java书很多了,我觉的学以致用才是真。代码是写出来的,不是看出来的。最后欢迎大家提出意见和建议。【案例1】创建一个新文件?1234567891011import java.io.*;class hello{public static void main(String[] args) {File f=new File("D:\\hello.txt" 阅读全文
posted @ 2013-12-20 14:29 songsiyao 阅读(251) 评论(0) 推荐(0) 编辑
摘要: public class BinaryConverter { // 将字符串转换成二进制字符串,以空格相隔 public static String stringToBinaryString(String str) { char[] strChar = str.toCharArray(); String result = ""; for (int i = 0; i 0; j--) output.append('0'); output.append(tempStr[i] + " "); } return output.toString(); 阅读全文
posted @ 2013-12-19 16:54 songsiyao 阅读(958) 评论(0) 推荐(0) 编辑
摘要: AndroidManifest.xml Activity@Overridepublic void onClick(View v) { switch (v.getId()) { case R.id.btn_start: bindService(new Intent("com.bob.servicetest"), sc, Context.BIND_AUTO_CREATE); isBinded = true; break; case R.id.btn_stop: if (isBinded) { unb... 阅读全文
posted @ 2013-11-28 15:47 songsiyao 阅读(280) 评论(0) 推荐(0) 编辑
摘要: AndroidManifest.xml ActivitystartService(new Intent("com.bob.servicetest"));stopService(new Intent("com.bob.servicetest")); MyService.classpublic class MyService extends Service { public static final String TAG = "MyService"; @Override public void onCreate() {... 阅读全文
posted @ 2013-11-28 15:39 songsiyao 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 1:今天调试android的时候发现一个诡异的问题[html]view plaincopyC:\Users\xxxx>adbstart-serveradbserverisoutofdate.killing...ADBserverdidn'tACK*failedtostartdaemon*adb 不管执行 shell devices 还是logcat 都会报错[html]view plaincopyadbserverisoutofdate.killing...究其源就是adb server没启动到stackoverflow上查了一下 经过分析整理如下:[html]view plai 阅读全文
posted @ 2013-11-27 17:26 songsiyao 阅读(197) 评论(0) 推荐(0) 编辑
摘要: Intent intent = new Intent(this, Two.class);PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);Notification notification = ne... 阅读全文
posted @ 2013-11-26 16:08 songsiyao 阅读(358) 评论(0) 推荐(0) 编辑
摘要: *#*#717717#*#* 阅读全文
posted @ 2013-11-25 17:37 songsiyao 阅读(118) 评论(0) 推荐(0) 编辑