当前位置: 首页 > news >正文

用开源吗做的网站可以用吗合肥seo排名优化公司

用开源吗做的网站可以用吗,合肥seo排名优化公司,潍坊软件网站开发,网站登录密码忘记了怎么办一、Intent 显式Intent:通过组件名指定启动的目标组件,比如startActivity(new Intent(A.this,B.class)); 每次启动的组件只有一个~隐式Intent:不指定组件名,而指定Intent的Action,Data,或Category,当我们启动组件时, 会去匹配AndroidManifest.xml相关组件的Intent-…

一、Intent

  • 显式Intent:通过组件名指定启动的目标组件,比如startActivity(new Intent(A.this,B.class)); 每次启动的组件只有一个~
  • 隐式Intent:不指定组件名,而指定Intent的Action,Data,或Category,当我们启动组件时, 会去匹配AndroidManifest.xml相关组件的Intent-filter,逐一匹配出满足属性的组件,当不止一个满足时, 会弹出一个让我们选择启动哪个的对话框

1、点击按钮返回Home界面

Intent it = new Intent();
it.setAction(Intent.ACTION_MAIN);
it.addCategory(Intent.CATEGORY_HOME);
startActivity(it);

2、点击按钮打开百度页面

Intent it = new Intent();
it.setAction(Intent.ACTION_VIEW);
it.setData(Uri.parse("http://www.baidu.com"));
startActivity(it);

二、Intent数据的传递

通过调用Intent的putExtra()方法存入数据,然后在获得Intent后调用getXxxExtra获得 对应类型的数据;传递多个的话,可以使用Bundle对象作为容器,通过调用Bundle的putXxx先将数据 存储到Bundle中,然后调用Intent的putExtras()方法将Bundle存入Intent中,然后获得Intent以后, 调用getExtras()获得Bundle容器,然后调用其getXXX获取对应的数据! 另外数据存储有点类似于Map的<键,值>!
1、Intent传递数组
写入数组:bd.putStringArray("StringArray", new String[]{"呵呵","哈哈"});
//可把StringArray换成其他数据类型,比如int,float等等...
读取数组:String[] str = bd.getStringArray("StringArray")

2、Intent传递集合

  • a、List<基本数据类型或String>

      写入集合:
      intent.putStringArrayListExtra(name, value)
      intent.putIntegerArrayListExtra(name, value)

      读取集合:
      intent.getStringArrayListExtra(name)
      intent.getIntegerArrayListExtra(name)


  • b、List< Object>

     将list强转成Serializable类型,然后传入(可用Bundle做媒介)

    写入集合:putExtras(key, (Serializable)list)

    读取集合:(List<Object>) getIntent().getSerializable(key)

    Object类需要实现Serializable接口


  • c、Map<String, Object>,或更复杂的

       解决方法是:外层套个List
//传递复杂些的参数 Map<String, Object> map1 = new HashMap<String, Object>(); map1.put("key1", "value1");
map1.put("key2", "value2");
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
list.add(map1);
Intent intent = new Intent();
intent.setClass(MainActivity.this,ComplexActivity.class);
Bundle bundle = new Bundle();
//须定义一个list用于在budnle中传递需要传递的ArrayList<Object>,这个是必须要的 ArrayList bundlelist = new ArrayList(); bundlelist.add(list); bundle.putParcelableArrayList("list",bundlelist); intent.putExtras(bundle); startActivity(intent);

3、Intent传递对象,对象转换为Json字符串

public class Book{private int id;private String title;//...
}public class Author{private int id;private String name;//...
}
写入数据:
Book book=new Book();
book.setTitle("Java编程思想");
Author author=new Author();
author.setId(1);
author.setName("Bruce Eckel");
book.setAuthor(author);
Intent intent=new Intent(this,SecondActivity.class);
intent.putExtra("book",new Gson().toJson(book));//Gson解析
startActivity(intent);读取数据:
String bookJson=getIntent().getStringExtra("book");
Book book=new Gson().fromJson(bookJson,Book.class);Gson解析
Log.d(TAG,"book title->"+book.getTitle());
Log.d(TAG,"book author name->"+book.getAuthor().getName());

4、Intent传递Bitmap

Bitmap bitmap = null;
Intent intent = new Intent();
Bundle bundle = new Bundle();
bundle.putParcelable("bitmap", bitmap);//bitmap默认实现Parcelable接口,直接传递即可
intent.putExtra("bundle", bundle);

5、使用 Application全局对象,数据可以在任何地方都能获取到
Android系统在每个程序运行的时候创建一个Application对象,而且只会创建一个

  •   在AndroidManifest.xml中为我们的application标签添加:name属性
     
    <application android:name=".MyApp" android:icon="@drawable/icon" android:label="@string/app_name">
  •  自定义Application类
    class MyApp extends Application {private String myState;private static MyApp instance;public static MyApp getInstance(){return instance;} public String getState(){return myState;}public void setState(String s){myState = s;}@Overridepublic void onCreate(){onCreate();instance = this;}
    }
    我们就可以在任意地方直接调用:MyApp.getInstance()来获得Application的全局对象
    

其他常用系统Intent合集

//===============================================================
//1.拨打电话
// 给移动客服10086拨打电话
Uri uri = Uri.parse("tel:10086");
Intent intent = new Intent(Intent.ACTION_DIAL, uri);
startActivity(intent);

//===============================================================

//2.发送短信
// 给10086发送内容为“Hello”的短信
Uri uri = Uri.parse("smsto:10086");
Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
intent.putExtra("sms_body", "Hello");
startActivity(intent);

//3.发送彩信(相当于发送带附件的短信)
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra("sms_body", "Hello");
Uri uri = Uri.parse("content://media/external/images/media/23");
intent.putExtra(Intent.EXTRA_STREAM, uri);
intent.setType("image/png");
startActivity(intent);

//===============================================================

//4.打开浏览器:
// 打开百度主页
Uri uri = Uri.parse("http://www.baidu.com");
Intent intent  = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);

//===============================================================

//5.发送电子邮件:(阉割了Google服务的没戏!!!!)
// 给someone@domain.com发邮件
Uri uri = Uri.parse("mailto:someone@domain.com");
Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
startActivity(intent);
// 给someone@domain.com发邮件发送内容为“Hello”的邮件
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_EMAIL, "someone@domain.com");
intent.putExtra(Intent.EXTRA_SUBJECT, "Subject");
intent.putExtra(Intent.EXTRA_TEXT, "Hello");
intent.setType("text/plain");
startActivity(intent);
// 给多人发邮件
Intent intent=new Intent(Intent.ACTION_SEND);
String[] tos = {"1@abc.com", "2@abc.com"}; // 收件人
String[] ccs = {"3@abc.com", "4@abc.com"}; // 抄送
String[] bccs = {"5@abc.com", "6@abc.com"}; // 密送
intent.putExtra(Intent.EXTRA_EMAIL, tos);
intent.putExtra(Intent.EXTRA_CC, ccs);
intent.putExtra(Intent.EXTRA_BCC, bccs);
intent.putExtra(Intent.EXTRA_SUBJECT, "Subject");
intent.putExtra(Intent.EXTRA_TEXT, "Hello");
intent.setType("message/rfc822");
startActivity(intent);

//===============================================================

//6.显示地图:
// 打开Google地图中国北京位置(北纬39.9,东经116.3)
Uri uri = Uri.parse("geo:39.9,116.3");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);

//===============================================================

//7.路径规划
// 路径规划:从北京某地(北纬39.9,东经116.3)到上海某地(北纬31.2,东经121.4)
Uri uri = Uri.parse("http://maps.google.com/maps?f=d&saddr=39.9 116.3&daddr=31.2 121.4");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);

//===============================================================

//8.多媒体播放:
Intent intent = new Intent(Intent.ACTION_VIEW);
Uri uri = Uri.parse("file:///sdcard/foo.mp3");
intent.setDataAndType(uri, "audio/mp3");
startActivity(intent);

//获取SD卡下所有音频文件,然后播放第一首=-= 
Uri uri = Uri.withAppendedPath(MediaStore.Audio.Media.INTERNAL_CONTENT_URI, "1");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);

//===============================================================

//9.打开摄像头拍照:
// 打开拍照程序
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); 
startActivityForResult(intent, 0);
// 取出照片数据
Bundle extras = intent.getExtras(); 
Bitmap bitmap = (Bitmap) extras.get("data");

//另一种:
//调用系统相机应用程序,并存储拍下来的照片
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); 
time = Calendar.getInstance().getTimeInMillis();
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(Environment
.getExternalStorageDirectory().getAbsolutePath()+"/tucue", time + ".jpg")));
startActivityForResult(intent, ACTIVITY_GET_CAMERA_IMAGE);

//===============================================================

//10.获取并剪切图片
// 获取并剪切图片
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
intent.putExtra("crop", "true"); // 开启剪切
intent.putExtra("aspectX", 1); // 剪切的宽高比为1:2
intent.putExtra("aspectY", 2);
intent.putExtra("outputX", 20); // 保存图片的宽和高
intent.putExtra("outputY", 40); 
intent.putExtra("output", Uri.fromFile(new File("/mnt/sdcard/temp"))); // 保存路径
intent.putExtra("outputFormat", "JPEG");// 返回格式
startActivityForResult(intent, 0);
// 剪切特定图片
Intent intent = new Intent("com.android.camera.action.CROP"); 
intent.setClassName("com.android.camera", "com.android.camera.CropImage"); 
intent.setData(Uri.fromFile(new File("/mnt/sdcard/temp"))); 
intent.putExtra("outputX", 1); // 剪切的宽高比为1:2
intent.putExtra("outputY", 2);
intent.putExtra("aspectX", 20); // 保存图片的宽和高
intent.putExtra("aspectY", 40);
intent.putExtra("scale", true);
intent.putExtra("noFaceDetection", true); 
intent.putExtra("output", Uri.parse("file:///mnt/sdcard/temp")); 
startActivityForResult(intent, 0);

//===============================================================

//11.打开Google Market 
// 打开Google Market直接进入该程序的详细页面
Uri uri = Uri.parse("market://details?id=" + "com.demo.app");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);

//===============================================================

//12.进入手机设置界面:
// 进入无线网络设置界面(其它可以举一反三)  
Intent intent = new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS);  
startActivityForResult(intent, 0);

//===============================================================

//13.安装apk:
Uri installUri = Uri.fromParts("package", "xxx", null);   
returnIt = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri);

//===============================================================

//14.卸载apk:
Uri uri = Uri.fromParts("package", strPackageName, null);      
Intent it = new Intent(Intent.ACTION_DELETE, uri);      
startActivity(it); 

//===============================================================

//15.发送附件:
Intent it = new Intent(Intent.ACTION_SEND);      
it.putExtra(Intent.EXTRA_SUBJECT, "The email subject text");      
it.putExtra(Intent.EXTRA_STREAM, "file:///sdcard/eoe.mp3");      
sendIntent.setType("audio/mp3");      
startActivity(Intent.createChooser(it, "Choose Email Client"));

//===============================================================

//16.进入联系人页面:
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(People.CONTENT_URI);
startActivity(intent);

//===============================================================


//17.查看指定联系人:
Uri personUri = ContentUris.withAppendedId(People.CONTENT_URI, info.id);//info.id联系人ID
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(personUri);
startActivity(intent);

//===============================================================

//18.调用系统编辑添加联系人(高版本SDK有效):
Intent it = newIntent(Intent.ACTION_INSERT_OR_EDIT);    
it.setType("vnd.android.cursor.item/contact");    
//it.setType(Contacts.CONTENT_ITEM_TYPE);    
it.putExtra("name","myName");    
it.putExtra(android.provider.Contacts.Intents.Insert.COMPANY, "organization");    
it.putExtra(android.provider.Contacts.Intents.Insert.EMAIL,"email");    
it.putExtra(android.provider.Contacts.Intents.Insert.PHONE,"homePhone");    
it.putExtra(android.provider.Contacts.Intents.Insert.SECONDARY_PHONE,"mobilePhone");    
it.putExtra( android.provider.Contacts.Intents.Insert.TERTIARY_PHONE,"workPhone");    
it.putExtra(android.provider.Contacts.Intents.Insert.JOB_TITLE,"title");    
startActivity(it);

//===============================================================

//19.调用系统编辑添加联系人(全有效):
Intent intent = newIntent(Intent.ACTION_INSERT_OR_EDIT);    
intent.setType(People.CONTENT_ITEM_TYPE);    
intent.putExtra(Contacts.Intents.Insert.NAME, "My Name");    
intent.putExtra(Contacts.Intents.Insert.PHONE, "+1234567890");    
intent.putExtra(Contacts.Intents.Insert.PHONE_TYPE,Contacts.PhonesColumns.TYPE_MOBILE);    
intent.putExtra(Contacts.Intents.Insert.EMAIL, "com@com.com");    
intent.putExtra(Contacts.Intents.Insert.EMAIL_TYPE, Contacts.ContactMethodsColumns.TYPE_WORK);    
startActivity(intent);

//===============================================================

//20.打开另一程序 
Intent i = new Intent();     
ComponentName cn = new ComponentName("com.example.jay.test",     
"com.example.jay.test.MainActivity");     
i.setComponent(cn);     
i.setAction("android.intent.action.MAIN");     
startActivityForResult(i, RESULT_OK);

//===============================================================

//21.打开录音机
Intent mi = new Intent(Media.RECORD_SOUND_ACTION);     
startActivity(mi);

//===============================================================

//22.从google搜索内容 
Intent intent = new Intent();     
intent.setAction(Intent.ACTION_WEB_SEARCH);     
intent.putExtra(SearchManager.QUERY,"searchString")     
startActivity(intent);

//===============================================================


 


文章转载自:
http://wanjiasubtopia.spfh.cn
http://wanjiatreponematosis.spfh.cn
http://wanjiamonkish.spfh.cn
http://wanjiasummerhouse.spfh.cn
http://wanjiaimpossibly.spfh.cn
http://wanjiacaffeinism.spfh.cn
http://wanjiabatteries.spfh.cn
http://wanjiaangina.spfh.cn
http://wanjiasyphilous.spfh.cn
http://wanjiatalkative.spfh.cn
http://wanjiacythera.spfh.cn
http://wanjiariftless.spfh.cn
http://wanjiataxameter.spfh.cn
http://wanjiapiccaninny.spfh.cn
http://wanjiafavoringly.spfh.cn
http://wanjiausumbura.spfh.cn
http://wanjiaswollen.spfh.cn
http://wanjialentamente.spfh.cn
http://wanjiaiconological.spfh.cn
http://wanjiasemiautonomous.spfh.cn
http://wanjiaphenomenon.spfh.cn
http://wanjiakirman.spfh.cn
http://wanjiaantigenicity.spfh.cn
http://wanjianeglectful.spfh.cn
http://wanjiaelegiast.spfh.cn
http://wanjiaoverinflated.spfh.cn
http://wanjialippie.spfh.cn
http://wanjiaclap.spfh.cn
http://wanjiamegavoltage.spfh.cn
http://wanjiaverkrampte.spfh.cn
http://wanjiaameliorant.spfh.cn
http://wanjiacabrilla.spfh.cn
http://wanjiapaleobotany.spfh.cn
http://wanjiaunforeknown.spfh.cn
http://wanjiasuperrealist.spfh.cn
http://wanjiafaithful.spfh.cn
http://wanjiamistakeable.spfh.cn
http://wanjiauredinium.spfh.cn
http://wanjianap.spfh.cn
http://wanjiaochlocrat.spfh.cn
http://wanjiaoverfired.spfh.cn
http://wanjiabelong.spfh.cn
http://wanjiatarantism.spfh.cn
http://wanjiawysbygi.spfh.cn
http://wanjiathankful.spfh.cn
http://wanjiaquietist.spfh.cn
http://wanjiaelea.spfh.cn
http://wanjiaaldose.spfh.cn
http://wanjiastolidly.spfh.cn
http://wanjiaanemochory.spfh.cn
http://wanjiaconferrer.spfh.cn
http://wanjianortriptyline.spfh.cn
http://wanjiaprecontract.spfh.cn
http://wanjiasamizdatchik.spfh.cn
http://wanjiaunperceptive.spfh.cn
http://wanjiacosmos.spfh.cn
http://wanjiaparalyse.spfh.cn
http://wanjiaquit.spfh.cn
http://wanjiaherbivorous.spfh.cn
http://wanjiaascidium.spfh.cn
http://wanjiaoverpeople.spfh.cn
http://wanjiacercis.spfh.cn
http://wanjiaaristarchy.spfh.cn
http://wanjiagambado.spfh.cn
http://wanjiasepticopyaemia.spfh.cn
http://wanjiaherniation.spfh.cn
http://wanjiaapennines.spfh.cn
http://wanjiamoveable.spfh.cn
http://wanjianihon.spfh.cn
http://wanjiaordovician.spfh.cn
http://wanjiastepdame.spfh.cn
http://wanjiaamyotrophy.spfh.cn
http://wanjiamaddish.spfh.cn
http://wanjiamannitol.spfh.cn
http://wanjiaradiolabel.spfh.cn
http://wanjiarustiness.spfh.cn
http://wanjialanceted.spfh.cn
http://wanjiasensate.spfh.cn
http://wanjiahoneymouthed.spfh.cn
http://wanjiainseminate.spfh.cn
http://www.15wanjia.com/news/125669.html

相关文章:

  • wordpress可以做企业网站自己手机怎么免费做网站
  • 深圳网站设计技术百度官网推广平台电话
  • 做外卖网站的模板全国31省市疫情最新消息今天
  • 做的好的网站营销微信公众号百度指数分析案例
  • wordpress网站响应时间太长郑州关键词优化平台
  • 网站开发后台需要哪些技术市场调研模板
  • aspnet网站开发seo关键词库
  • 电子商务网站的开发方式有哪三种新东方英语线下培训学校
  • 医美三方网站怎么做下载百度地图2022最新版官方
  • 怎么做投票管理系统后台网站软文代写服务
  • 长沙建站位找有为太极广大新品推广计划与方案
  • 百度做的网站首页在线客服修改在线种子资源库
  • 电子项目外包网站百度应用商店app
  • wordpress 主页显示长沙网络优化产品
  • 网站管理系统后台华联股份股票
  • aspcms网站栏目调用如何建立自己的网站?
  • 最火的做网站源码语言免费web服务器网站
  • 网站开发技术交流网络营销学什么内容
  • 银川做网站最好的公司有哪些网页点击量统计
  • wordpress4.7.2卡大连网络营销seo
  • 定制网站开发介绍图百度app营销软件
  • 成都网站建设司淘宝seo排名优化
  • 网站上传用什么软件做视频格式竞价是什么意思
  • 用wix做网站需要备案吗微信推广软件有哪些
  • pc网站是什么seo优化教程下载
  • 海南省城乡建设厅网站首页快速排序优化
  • 网站多域名软文推广营销平台
  • 建设大型网站建设能去百度上班意味着什么
  • 动态网站开发案例排名优化方法
  • 男人女人做那事网站2023年东莞疫情最新消息