标准Action.docx

上传人:b****5 文档编号:3270238 上传时间:2022-11-21 格式:DOCX 页数:14 大小:20.66KB
下载 相关 举报
标准Action.docx_第1页
第1页 / 共14页
标准Action.docx_第2页
第2页 / 共14页
标准Action.docx_第3页
第3页 / 共14页
标准Action.docx_第4页
第4页 / 共14页
标准Action.docx_第5页
第5页 / 共14页
点击查看更多>>
下载资源
资源描述

标准Action.docx

《标准Action.docx》由会员分享,可在线阅读,更多相关《标准Action.docx(14页珍藏版)》请在冰豆网上搜索。

标准Action.docx

标准Action

Android2.3发布,新特性一览

Postedon2010/12/07by繁星

Android的新版本在经历了版本号变更(从3.0到2.3),新特性猜测,发布时间延期(从11.11到12.6)之后,终于真的来到了我们这些开发者面前了。

让我们迫不及待的看看Android2.3有哪些新特性吧。

首先,为游戏开发的增强:

∙新的并发垃圾回收机制

∙更多的读取系统信息的原生接口

∙原生接口可以获取输入和访问传感器了

∙EGL/OpenGLES、OpenSLES

∙新的管理窗口和生命周期的框架。

其次,多媒体和更多的通讯方式:

∙毫无疑问的支持了Google自家的VP8andWebM

∙支持AACandAMR-wideband编码

∙新的音频效果器,比如混响、均衡、虚拟耳机和低频提升

∙支持前置摄像头(为视频电话准备的)

∙SIP、VOIP支持(为Googlevoice准备的)

∙NFC支持

其他改进:

∙优化用户界面:

简化、提速(期待在真机上体验)

∙输入界面改进:

更快、更直观

∙改进电源管理(需要跟进一步了解它是如何做的)

∙新的应用管理方式

∙新的下载管理器,似乎是个有趣的东西,号称会管理浏览器、email等所有应用中下载的文件。

截取自:

Adroid2.3官方说明(http:

//android-

PostedinUncategorized,技术动态|Tagged技术动态|Leaveacomment

Android2.3在SDK和开发环境的改进

Postedon2010/12/07by繁星

Android2.3在SDKtools和开发环境的改进主要有:

∙简化debug和build

∙集成了ProGuard,以方便开发者保护自己的源代码

∙改进了HierarchyViewer

∙新的UIBuilder的预览

Android开发者们赶紧去体验吧。

Postedin技术动态|Leaveacomment

HelloAndroid!

Postedon2010/11/25byxinbo

1. 

2.classHelloAndroid

3.{

4. publicstaticvoidmain(String[]args)

5. {

6.  System.out.println("HelloAndroid!

");

7. }

8.}

9. 

PostedinUncategorized|Leaveacomment

Intent用法实例(转自javaeye)

Postedon2010/11/22byWeber

显示网页

1.Uriuri=Uri.parse(“”);

2.Intentit=newIntent(Intent.ACTION_VIEW,uri);

3.startActivity(it);

显示地图

1.Uriuri=Uri.parse(“geo:

38.899533,-77.036476″);

2.Intentit=newIntent(Intent.ACTION_VIEW,uri);

3.startActivity(it);

4.//其他geoURI範例

5.//geo:

latitude,longitude

6.//geo:

latitude,longitude?

z=zoom

7.//geo:

0,0?

q=my+street+address

8.//geo:

0,0?

q=business+near+city

9.//google.streetview:

cbll=lat,lng&cbp=1,yaw,,pitch,zoom&mz=mapZoom

路径规划

1.Uriuri=Uri.parse(“

2.Intentit=newIntent(Intent.ACTION_VIEW,uri);

3.startActivity(it);

4.//wherestartLat,startLng,endLat,endLngarealongwith6decimalslike:

50.123456

打电话

1.//叫出拨号程序

2.Uriuri=Uri.parse(“tel:

0800000123″);

3.Intentit=newIntent(Intent.ACTION_DIAL,uri);

4.startActivity(it);

1.//直接打电话出去

2.Uriuri=Uri.parse(“tel:

0800000123″);

3.Intentit=newIntent(Intent.ACTION_CALL,uri);

4.startActivity(it);

5.//用這個,要在AndroidManifest.xml中,加上

6.//

传送SMS/MMS

1.//调用短信程序

2.Intentit=newIntent(Intent.ACTION_VIEW,uri);

3.it.putExtra(“sms_body”,“TheSMStext”);

4.it.setType(“vnd.android-dir/mms-sms”);

5.startActivity(it);

1.//传送消息

2.Uriuri=Uri.parse(“smsto:

//0800000123″);

3.Intentit=newIntent(Intent.ACTION_SENDTO,uri);

4.it.putExtra(“sms_body”,“TheSMStext”);

5.startActivity(it);

1.//传送MMS

2.Uriuri=Uri.parse(“content:

//media/external/images/media/23″);

3.Intentit=newIntent(Intent.ACTION_SEND);

4.it.putExtra(“sms_body”,“sometext”);

5.it.putExtra(Intent.EXTRA_STREAM,uri);

6.it.setType(“image/png”);

7.startActivity(it);

传送Email

1.Uriuri=Uri.parse(“mailto:

xxx@”);

2.Intentit=newIntent(Intent.ACTION_SENDTO,uri);

3.startActivity(it);

1.Intentit=newIntent(Intent.ACTION_SEND);

2.it.putExtra(Intent.EXTRA_EMAIL,“me@”);

3.it.putExtra(Intent.EXTRA_TEXT,“Theemailbodytext”);

4.it.setType(“text/plain”);

5.startActivity(Intent.createChooser(it,“ChooseEmailClient”));

1.Intentit=newIntent(Intent.ACTION_SEND);

2.String[]tos={“me@”};

3.String[]ccs={“you@”};

4.it.putExtra(Intent.EXTRA_EMAIL,tos);

5.it.putExtra(Intent.EXTRA_CC,ccs);

6.it.putExtra(Intent.EXTRA_TEXT,“Theemailbodytext”);

7.it.putExtra(Intent.EXTRA_SUBJECT,“Theemailsubjecttext”);

8.it.setType(“message/rfc822″);

9.startActivity(Intent.createChooser(it,“ChooseEmailClient”));

1.//传送附件

2.Intentit=newIntent(Intent.ACTION_SEND);

3.it.putExtra(Intent.EXTRA_SUBJECT,“Theemailsubjecttext”);

4.it.putExtra(Intent.EXTRA_STREAM,“file:

///sdcard/mysong.mp3″);

5.sendIntent.setType(“audio/mp3″);

6.startActivity(Intent.createChooser(it,“ChooseEmailClient”));

播放多媒体

Uriuri=Uri.parse(“file:

///sdcard/song.mp3″);

Intentit=newIntent(Intent.ACTION_VIEW,uri);

it.setType(“audio/mp3″);

startActivity(it);

Uriuri=Uri.withAppendedPath(MediaStore.Audio.Media.INTERNAL_CONTENT_URI,“1″);

Intentit=newIntent(Intent.ACTION_VIEW,uri);

startActivity(it);

Market相关

1.//寻找某个应用

2.Uriuri=Uri.parse(“market:

//search?

q=pname:

pkg_name”);

3.Intentit=newIntent(Intent.ACTION_VIEW,uri);

4.startActivity(it);

5.//wherepkg_nameisthefullpackagepathforanapplication

1.//显示某个应用的相关信息

2.Uriuri=Uri.parse(“market:

//details?

id=app_id”);

3.Intentit=newIntent(Intent.ACTION_VIEW,uri);

4.startActivity(it);

5.//whereapp_idistheapplicationID,findtheID

6.//byclickingonyourapplicationonMarkethome

7.//page,andnoticetheIDfromtheaddressbar

Uninstall应用程序

1.Uriuri=Uri.fromParts(“package”,strPackageName,null);

2.Intentit=newIntent(Intent.ACTION_DELETE,uri);

3.startActivity(it);

PostedinAndroiddevelopment|Leaveacomment

AlertDialog的使用

Postedon2010/11/22byWeber

AlertDialog可以构造简单的提示窗体,类似html里的alert,confirm

这是个alert

newAlertDialog.Builder(this)

.setTitle("alert")

.setMessage("messagehere")

.setPositiveButton("OK",newDialogInterface.OnClickListener(){

@Override

publicvoidonClick(DialogInterfacedi,intwhich)

{

//dosomething

}

})

.show();

confirm

newAlertDialog.Builder(this)

.setTitle("confirm")

.setMessage("quitnow?

")

.setPositiveButton("Yes",newDialogInterface.OnClickListener(){

@Override

publicvoidonClick(DialogInterfacedi,intwhich)

{

finish();

}

})

.setPositiveButton("No",newDialogInterface.OnClickListener(){

@Override

publicvoidonClick(DialogInterfacedi,intwhich)

{

}

})

.show();

还可以用setIcon()添加一个提示用的图标,比如alert的叹号,confirm的问号之类

单选框

.setItems(newString[]{"1","2","3"},newDialogInterface.OnClickListener(){

@Override

publicvoidonClick(DialogInterfacedialogInterface,inti)

{

Log.d("demo",i);

}

多选框

.setMultiChoiceItems(newString[]{"1","2","3"},newboolean[]{true,true,true},newOnMultiChoiceClickListener(){

@Override

publicvoidonClick(DialogInterfacedi,intwhich,booleanvalue)

{

Log.d("demo",which+","+value);

}

})

PostedinAndroiddevelopment|Leaveacomment

使窗体全屏和隐藏标题栏的方法

Postedon2010/11/22byWeber

全屏

publicvoidsetFullScreen()

{

setNoTitle();

  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,

    WindowManager.LayoutParams.FLAG_FULLSCREEN);

}

隐藏标题栏

publicvoidsetNoTitle()

{

requestWindowFeature(Window.FEATURE_NO_TITLE);

}

PostedinAndroiddevelopment|Leaveacomment

Splash窗体的实现

Postedon2010/11/22byWeber

首先是Splash窗体:

publicclassSplashextendsActivity

{

@Override

 publicvoidonCreate(BundlesavedInstanceState)

 {

 super.onCreate(savedInstanceState);

setContentView(R.layout.splash);

newHandler().postDelayed(newRunnable(){

publicvoidrun()

{

Intenti=newIntent(Splash.this,Main.class);

startActivity(i);

finish();

}

},2000);

}

}

然后将Splash窗体设定为起始窗,位于AndroidManifest.xml

name=".Splash"

android:

label="@string/app_name"

>

name="android.intent.action.MAIN"/>

name="android.intent.category.LAUNCHER"/>

 

IntentFilter

简述:

结构化描述intent匹配的信息。

包含:

action,categoriesanddata(viatype,scheme,path),还有priority,toordermultiplematchingfilters.

      IntentFilter中如果action为空,则视为通配符,如果type为空,则intent必须不设type,否则匹配不上。

      data被分为3个属性:

type,scheme,authority/path任何设置的属性intent必须匹配上。

                          设置了scheme而没设type,则intent也必须类似,不能设置type,也不能是content:

URI.

                          设置了type而没设scheme:

将匹配上没有URI的intent,或者content:

file:

的uri。

                          设置了authority:

必须指定一个或多个相关联的schemes

                          设置了path:

唏嘘指定一个或多个相关联的schemes

      匹配规则:

          IntentFilter匹配Intent的上的条件:

          Action:

值相同,或则IntentFilter未指定action.

          DataType:

.系统通过调用Intent.resolve(ContentResolver)获取type,通配符*

                    在Intent/IntentFilter的MIMEtype中使用,区分大小写

          DataScheme:

系统通过调用Intent.getData()andUri.getScheme())获取scheme,区分大小写

          DataAuthority:

必须有一个dataScheme匹配上且authority值匹配上,或者IntentFilter没有定义。

Intent.getData()andUri.getAuthority()获取authority.

          DataPath:

schemeandauthority必须先匹配上ntent.getData()andUri.getPath(),获取.或者IntentFilter没有定义

          Categories:

allofthecategoriesintheIntentmatchcategoriesgiveninthefilter多余的Categorie,不影响intent匹配,如果IntentFilter

                 没有指定Categorie,则只能匹配上没有Categorie的intent。

常用intent列表:

AndroidIntent用法汇总

显示网页

-

name="BrowserActivity"android:

label="Browser"android:

launchMode="singleTask"android:

alwaysRetainTaskState="true"android:

configChanges="orientation|keyboardHidden"android:

theme="@style/BrowserTheme">

-

--

FortheseschemeswerenotparticularMIMEtypehasbeen

                supplied,weareagoodcandidate.

 -->

-

 

name="android.intent.action.VIEW"/>

 

name="android.intent.category.DEFAULT"/>

 

name="android.intent.category.BROWSABLE"/>

 

scheme="http"/>

 

scheme="https"/>

 

scheme="about"/>

 

-

--

 FortheseschemeswhereanyoftheseparticularMIMEtypes

                 havebeensupplied,weareagoodcandidate.

 -->

-

 

name="android.intent.action.VIEW"/>

 

name="android.intent.category.BROWSABLE"/>

 

name="android.intent.category.DEFAULT"/>

 

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高等教育 > 经济学

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1