Chinaunix首页 | 论坛 | 博客
  • 博客访问: 137695
  • 博文数量: 38
  • 博客积分: 1605
  • 博客等级: 上尉
  • 技术积分: 370
  • 用 户 组: 普通用户
  • 注册时间: 2006-04-12 14:59
文章分类

全部博文(38)

文章存档

2013年(3)

2012年(8)

2011年(28)

分类: 嵌入式

2011-06-20 11:44:02

  1. package com.test;

  2. //import java.net.URISyntaxException;

  3. import android.app.Activity;
  4. import android.os.Bundle;
  5. import android.os.Environment;
  6. //import android.util.Log;
  7. import android.view.View;
  8. import android.widget.Button;
  9. import android.widget.Toast;

  10. public class TestActivity1 extends Activity {
  11.     /** Called when the activity is first created. */
  12.     @Override
  13.     public void onCreate(Bundle savedInstanceState) {
  14.         super.onCreate(savedInstanceState);
  15.         setContentView(R.layout.main);

  16.         Button btn = (Button) this.findViewById(R.id.button1);
  17.         btn.setOnClickListener(new View.OnClickListener() {
  18.             public void onClick(View v) {                
  19.                 
  20.                 // SD Card Ready
  21.                 if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
  22.                     
  23.                     Toast.makeText(getApplicationContext(), "SD Card Ready! Enjoy it!",
  24.                          Toast.LENGTH_LONG).show();
  25.                 }
  26.                 else{
  27.                     Toast.makeText(getApplicationContext(), "SD Card NOT Ready! Please insert it, try it agian!",
  28.                          Toast.LENGTH_LONG).show();
  29.                 }
  30.                     
  31.             }
  32.         });
  33.     }
  34. }
阅读(1237) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~