Android開發(fā)一些小功能的實現
作者:佚名
Android開發(fā)中一些常用的小功能實現,不算是技術,算是一個小總結。
今天分享一下在Android開發(fā)一些小功能的實現,遇到的一些問題與解決方法,希望能夠對大家有所幫助。
Toast(消息提示框):
- Toast.makeText(MainActivity.this, "位置改變了::::::::::::", 3000).show();
intent跳轉:(AndroidManifest.xml 中記得注冊 Activity)
- Intent intent=new Intent(Success.this,luru.class);
- startActivity(intent);
intent隱式啟動:
- Intent intent=new Intent(Intent.ACTION_VIEW,Uri.parse(urlString));
- startActivity(intent);
- urlString可以是"www.baidu.com";
系統(tǒng)獲取時間:
- Date now=new Date();
- //自定義格式
- SimpleDateFormat d1=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- String time=d1.format(now);
相機的調用:
- String filepath = "/mnt/sdcard/DCIM/Camera/"+ phototime + ".png";
- final File file = new File(filepath);
- final Uri imageuri = Uri.fromFile(file);
- Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
- intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, imageuri);
- startActivityForResult(intent, 110);
怎么樣,這篇Android開發(fā)一些小功能的實現里有你想要的么?
責任編輯:閆佳明
來源:
my.eoe.cn