下载

0下载券

加入VIP
  • 专属下载特权
  • 现金文档折扣购买
  • VIP免费专区
  • 千万文档免费下载

上传资料

关闭

关闭

关闭

封号提示

内容

首页 移动应用软件开发技术-实验报告模板_图文

移动应用软件开发技术-实验报告模板_图文.doc

移动应用软件开发技术-实验报告模板_图文

董雪敏
2018-05-01 0人阅读 举报 0 0 0 暂无简介

简介:本文档为《移动应用软件开发技术-实验报告模板_图文doc》,可适用于综合领域

移动应用软件开发技术实验报告模板图文实验报告课程名称:移动应用软件开发技术实验项目:《移动应用软件开发技术》课程实验A实验地点:行勉楼专业班级:软件班学号:学生姓名:张卫东指导教师:马垚年月日太原理工大学学生实验一报告学院名称软件学院专业班级软件班学号学生姓名张卫东实验日期成绩课程名称移动应用软件开发技术实验题目Android开发环境搭建一、实验目的搭建Android开发环境学习使用Eclipse开发工具进行Android应用开发的整个流程为后续实验做好基本准备工作。二、实验要求、掌握AndroidSDK的安装、配置、使用。、掌握Eclipse集成开发环境的使用。、实现第一个Android应用程序。三、实验原理及步骤、下载安装JDK从Oracle公司官方网站下载JDK(当前下载页面地址为)选择下载自己电脑系统的对应版本即可。JDK默认安装成功后会在系统目录下出现两个文件夹一个代表jdk一个代表jre。、下载安装EclipseEclipse为Java应用程序及Android开发的IDE(集成开发环境)。Eclipse不需要安装下载后把解压包解压到你想安装的地方打开时设置你的工作目录即可使用。Eclipse官方网站提供下载()的Eclipse版本有多个这里选择下载EclipseIDEforJavaEEDevelopers这个版本。、下载安装AndroidSDKAndroidSDK提供了开发Android应用程序所需的API库和构建、测试和调试Android应用程序所需的开发工具。从官方网站()或()下载AndroidSDKTools。安装或解压AndroidSDK到任意目录下。在AndroidSDK的安装目录下运行“SDKManagerexe”(如不能直接运行可以管理员身份运行)SDKManager负责下载或更新不同版本的SDK包我们看到默认安装的SDKManager只安装了一个版本的SDKtools。打开AndroidSDKManager它会自动获取可安装的sdk版本但是国内有墙可能会出现获取失败的情况。可以使用()提供的AndroidSDK在线更新镜像服务器来安装。再打开AndroidSDKManagerexe正常情况下就可以下载Android的各个版本的sdk了。你只需要选择想要安装或更新的安装包安装即可(最后选择以上版本)。这里是比较耗时的过程(通常在个小时以ayimages)所有标题资源名(baidu,sina,tencent,netease)的数组Stringtitles=getResources()getStringArray(Rarraytitles)所有网址资源名(baiduurl,sinaurl,tencenturl,neteaseurl)的数组Stringinfos=getResources()getStringArray(Rarrayinfos)OverridepublicintgetCount(){TODOAutogeneratedmethodstubreturnimageslength}返回数组的大小即数组元素个数OverridepublicObjectgetItem(intarg){TODOAutogeneratedmethodstubreturn}OverridepubliclonggetItemId(intarg){TODOAutogeneratedmethodstubreturn}动态生成每个下拉项对应的View每个下拉项View由LinearLayout中包含一个ImageView,两个内嵌的LinearLayout构成其中一个包含两个TestView另一个中包含一个按钮OverridepublicViewgetView(intarg,Viewarg,ViewGrouparg){TODOAutogeneratedmethodstubLinearLayoutll=newLinearLayout(ListViewBaseAdtActivitythis)初始化LinearLayoutllsetOrientation(LinearLayoutHORIZONTAL)设置朝向ImageViewimg=newImageView(ListViewBaseAdtActivitythis)初始化ImageViewimgsetImageDrawable(getResources()getDrawable(getResources()getIdentifier(imagesarg,"drawable",getPackageName())))imgsetLayoutParams(newGalleryLayoutParams(,))imgsetPadding(,,,)lladdView(img)添加LinearLayout中LinearLayoutlll=newLinearLayout(ListViewBaseAdtActivitythis)初始化LinearLayoutlllsetOrientation(LinearLayoutVERTICAL)设置朝向lllsetLayoutParams(newLinearLayoutLayoutParams(LayoutParamsWRAPCONTENT,LayoutParamsWRAPCONTENT))TextViewtit=newTextView(ListViewBaseAdtActivitythis)初始化TextViewtitsetText(getResources()getText(getResources()getIdentifier(titlesarg,"string",getPackageName())))设置内容titsetLayoutParams(newLayoutParams(LinearLayoutLayoutParamsWRAPCONTENT,LinearLayoutLayoutParamsWRAPCONTENT))titsetTextSize()设置字体大小titsetTextColor(getResources()getColor(Rcolorblack))设置字体颜色llladdView(tit)添加到LinearLayout中TextViewinf=newTextView(ListViewBaseAdtActivitythis)初始化TextViewinfsetText(getResources()getText(getResources()getIdentifier(infosarg,"string",getPackageName())))设置内容infsetLayoutParams(newLayoutParams(LinearLayoutLayoutParamsWRAPCONTENT,LinearLayoutLayoutParamsWRAPCONTENT))infsetTextSize()设置字体的大小infsetTextColor(getResources()getColor(Rcolorblack))设置字体颜色llladdView(inf)添加到LinearLayout中lladdView(lll)添加到LinearLayout中LinearLayoutll=newLinearLayout(ListViewBaseAdtActivitythis)初始化LinearLayoutllsetOrientation(LinearLayoutHORIZONTAL)设置朝向llsetLayoutParams(newLinearLayoutLayoutParams(LayoutParamsFILLPARENT,LayoutParamsWRAPCONTENT))llsetPadding(,,,)setPadding参数(left,top,right,bottom)llsetGravity(GravityRIGHT)Buttonbtn=newButton(ListViewBaseAdtActivitythis)初始化ButtonbtnsetLayoutParams(newLinearLayoutLayoutParams(LayoutParamsWRAPCONTENT,LayoutParamsWRAPCONTENT))btnsetText("下载")btnsetId(arg)设置Button的IdbtnsetFocusable(false)*****不让按钮抢占焦点当按钮点击的时候给它焦点设置按钮的监听器btnsetOnClickListener(newViewOnClickListener(){OverridepublicvoidonClick(Viewv){TODOAutogeneratedmethodstubstartActivity(newIntent(ListViewBaseAdtActivitythis,XiaZaiActivityclass))}})lladdView(btn)将btn添加到ll中lladdView(ll)将ll添加到ll中returnll}}lvsetAdapter(ba)为LietView设置内容适配器lvsetOnItemClickListener(newOnItemClickListener(){OverridepublicvoidonItemClick(AdapterView<>arg,Viewarg,intarg,longarg){重写选项被选中事件的处理方法if(arg==){Intentintent=newIntent(ListViewBaseAdtActivitythis,ItemActivityclass)startActivity(intent)finish()}if(arg==){Intentintent=newIntent(ListViewBaseAdtActivitythis,ItemActivityclass)ListViewBaseAdtActivitythisstartActivity(intent)finish()}if(arg==){Intentintent=newIntent(ListViewBaseAdtActivitythis,ItemActivityclass)startActivity(intent)finish()}if(arg==){Intentintent=newIntent(ListViewBaseAdtActivitythis,ItemActivityclass)startActivity(intent)finish()}if(arg==){Intentintent=newIntent(ListViewBaseAdtActivitythis,ItemActivityclass)startActivity(intent)finish()}if(arg==){Intentintent=newIntent(ListViewBaseAdtActivitythis,ItemActivityclass)startActivity(intent)finish()}packagecomexamplebaseimportandroidRstringimportandroidappActivityimportandroidcontentIntentimportandroidgraphicsColorimportandroidosBundleimportandroidviewGravityimportandroidviewMenuimportandroidviewMenuItemimportandroidviewViewimportandroidviewViewOnClickListenerimportandroidviewViewGroupimportandroidwidgetAdapterViewimportandroidwidgetAdapterViewOnItemClickListenerimportandroidwidgetAdapterViewOnItemSelectedListenerimportandroidwidgetBaseAdapterimportandroidwidgetButtonimportandroidwidgetGalleryimportandroidwidgetGalleryLayoutParamsimportandroidwidgetImageViewimportandroidwidgetLinearLayoutimportandroidwidgetListViewimportandroidwidgetTextViewpublicclassYingyonActivityextendsActivity{OverrideprotectedvoidonCreate(BundlesavedInstanceState){superonCreate(savedInstanceState)setContentView(Rlayoutactivityyingyon)ListViewlv=(ListView)findViewById(RidListView)初始化ListViewBaseAdapterba=newBaseAdapter(){为ListView准备内容适配器所有图片资源名(tbbaidu,tbsina,tbtencent,tbnetease)的数组Stringyimages=getResources()getStringArray(Rarrayyimages)所有标题资源名(baidu,sina,tencent,netease)的数组Stringytitles=getResources()getStringArray(Rarrayytitles)所有网址资源名(baiduurl,sinaurl,tencenturl,neteaseurl)的数组Stringyinfos=getResources()getStringArray(Rarrayyinfos)OverridepublicintgetCount(){TODOAutogeneratedmethodstubreturnyimageslength}返回数组的大小即数组元素个数OverridepublicObjectgetItem(intarg){TODOAutogeneratedmethodstubreturn}OverridepubliclonggetItemId(intarg){TODOAutogeneratedmethodstubreturn}动态生成每个下拉项对应的View每个下拉项View由LinearLayout中包含一个ImageView,两个内嵌的LinearLayout构成其中一个包含两个TestView另一个中包含一个按钮OverridepublicViewgetView(intarg,Viewarg,ViewGrouparg){TODOAutogeneratedmethodstubLinearLayoutll=newLinearLayout(YingyonActivitythis)初始化LinearLayoutllsetOrientation(LinearLayoutHORIZONTAL)设置朝向ImageViewimg=newImageView(YingyonActivitythis)初始化ImageViewimgsetImageDrawable(getResources()getDrawable(getResources()getIdentifier(yimagesarg,"drawable",getPackageName())))imgsetLayoutParams(newGalleryLayoutParams(,))imgsetPadding(,,,)lladdView(img)添加LinearLayout中LinearLayoutlll=newLinearLayout(YingyonActivitythis)初始化LinearLayoutlllsetOrientation(LinearLayoutVERTICAL)设置朝向lllsetLayoutParams(newLinearLayoutLayoutParams(LayoutParamsWRAPCONTENT,LayoutParamsWRAPCONTENT))TextViewtit=newTextView(YingyonActivitythis)初始化TextViewtitsetText(getResources()getText(getResources()getIdentifier(ytitlesarg,"string",getPackageName())))设置内容titsetLayoutParams(newLayoutParams(LinearLayoutLayoutParamsWRAPCONTENT,LinearLayoutLayoutParamsWRAPCONTENT))titsetTextSize()设置字体大小titsetTextColor(getResources()getColor(Rcolorblack))设置字体颜色llladdView(tit)添加到LinearLayout中TextViewinf=newTextView(YingyonActivitythis)初始化TextViewinfsetText(getResources()getText(getResources()getIdentifier(yinfosarg,"string",getPackageName())))设置内容infsetLayoutParams(newLayoutParams(LinearLayoutLayoutParamsWRAPCONTENT,LinearLayoutLayoutParamsWRAPCONTENT))infsetTextSize()设置字体的大小infsetTextColor(getResources()getColor(Rcolorblack))设置字体颜色llladdView(inf)添加到LinearLayout中lladdView(lll)添加到LinearLayout中LinearLayoutll=newLinearLayout(YingyonActivitythis)初始化LinearLayoutllsetOrientation(LinearLayoutHORIZONTAL)设置朝向llsetLayoutParams(newLinearLayoutLayoutParams(LayoutParamsFILLPARENT,LayoutParamsWRAPCONTENT))llsetPadding(,,,)setPadding参数(left,top,right,bottom)llsetGravity(GravityRIGHT)Buttonbtn=newButton(YingyonActivitythis)初始化ButtonbtnsetLayoutParams(newLinearLayoutLayoutParams(LayoutParamsWRAPCONTENT,LayoutParamsWRAPCONTENT))btnsetText("下载")btnsetId(arg)设置Button的IdbtnsetFocusable(false)*****不让按钮抢占焦点当按钮点击的时候给它焦点设置按钮的监听器btnsetOnClickListener(newViewOnClickListener(){OverridepublicvoidonClick(Viewv){TODOAutogeneratedmethodstubstartActivity(newIntent(YingyonActivitythis,XiaZaiActivityclass))}})lladdView(btn)将btn添加到ll中lladdView(ll)将ll添加到ll中returnll}}lvsetAdapter(ba)为LietView设置内容适配器lvsetOnItemClickListener(newOnItemClickListener(){OverridepublicvoidonItemClick(AdapterView<>arg,Viewarg,intarg,longarg){重写选项被选中事件的处理方法if(arg==){Intentintent=newIntent(YingyonActivitythis,YitemActivityclass)startActivity(intent)finish()}if(arg==){Intentintent=newIntent(YingyonActivitythis,YitemActivityclass)YingyonActivitythisstartActivity(intent)finish()}if(arg==){Intentintent=newIntent(YingyonActivitythis,YitemActivityclass)startActivity(intent)finish()}if(arg==){Intentintent=newIntent(YingyonActivitythis,YitemActivityclass)startActivity(intent)finish()}if(arg==){Intentintent=newIntent(YingyonActivitythis,YitemActivityclass)startActivity(intent)finish()}if(arg==){Intentintent=newIntent(YingyonActivitythis,YitemActivityclass)startActivity(intent)finish()}五、实验结果及分析运行Eclipse结果如下图所示:点击游戏的Item项跳转到应用的介绍页面其中图片用Gallery实现以及下载按钮下载按钮设置为根据时间的判断自行移动。点击应用的Item项跳转到应用的介绍页面其中图片用Gallery实现以及下载按钮下载按钮设置为根据时间的判断自行移动。六、心得体会:通过本次的实验熟练的掌握了TabHost以及按钮的监听和Activity的跳转掌握了ProgressBarSeekBarRatingBar等进度条的使用额外又自己学会了Handler的使用根据给定的时间去处理线程在本次实验的作用是根据时间判断进度条的自行移动。实验地点行勉A指导教师马垚太原理工大学学生实验五报告学院名称软件学院专业班级软件学号学生姓名张卫东实验日期成绩课程名称移动应用软件开发技术实验题目Android菜单与对话框一、实验目的掌握Android中不同类型菜单和对话框控件的使用。二、实验要求、掌握选择菜单(OptionMenu)、上下文菜单(ContextMenu)和子菜单(SubMenu)三种菜单的使用。、掌握提示对话框(AlertDialog)、进度对话框(ProgressDialog)、日期选择对话框(DatePickerDialog)和时间选择对话框(TimePickerDialog)四种对话框的使用。三、实验原理及步骤、认真学习课本P页示例。、根据以上示例完成课本P页的练习即完成“掌上微博”中的相册管理模块要求至少使用个Activity第一个Activity以列表的方式列出已有的相册标题并使用选项菜单设置“新增”和“删除”菜单项点击菜单项时显示相应的提示对话框当点击相册列表中的某一项时跳转到第二个Activity在第二个Activity中联合使用ImageSwitcher和Gallery控件显示指定相册中的照片并添加一个返回按钮可以返回到第一个Activity。四、实验核心代码packageorgyanzitesthorizontallistviewimportjavalangreflectFieldimportjavautilArrayListimportjavautilHashMapimportandroidRarrayimportandroidappActivityimportandroidappAlertDialogimportandroidcontentDialogInterfaceimportandroidcontentDialogInterfaceOnClickListenerimportandroidcontentIntentimportandroidgraphicsdrawableDrawableimportandroidosBundleimportandroidtextTextUtilsimportandroidviewGravityimportandroidviewMenuimportandroidviewMenuItemimportandroidviewViewimportandroidviewViewGroupimportandroidviewanimationAnimationimportandroidviewanimationAnimationUtilsimportandroidwidgetAdapterViewimportandroidwidgetAdapterViewOnItemClickListenerimportandroidwidgetBaseAdapterimportandroidwidgetEditTextimportandroidwidgetGalleryimportandroidwidgetGalleryLayoutParamsimportandroidwidgetImageViewimportandroidwidgetLinearLayoutimportandroidwidgetListViewimportandroidwidgetTextViewimportandroidwidgetToastpublicclassListViewBaseAdtActivityextendsActivity{finalintMENUADD=MenuFIRSTfinalintMENUDELETE=MenuFIRSTprivateArrayList<HashMap<String,Object>>arrayList所有图片资源名(tbbaidu,tbsina,tbtencent,tbnetease)的数组Stringimages所有标题资源名(baidu,sina,tencent,netease)的数组Stringtitles所有网址资源名(baiduurl,sinaurl,tencenturl,neteaseurl)的数组StringinfosprivateBaseAdapterbaOverrideprotectedvoidonCreate(BundlesavedInstanceState){superonCreate(savedInstanceState)setContentView(Rlayoutlistvba)images=getResources()getStringArray(Rarrayimages)titles=getResources()getStringArray(Rarraytitles)infos=getResources()getStringArray(Rarrayinfos)arrayList=getImage()ListViewlv=(ListView)findViewById(RidListView)初始化ListViewba=newBaseAdapter(){为ListView准备内容适配器OverridepublicintgetCount(){TODOAutogeneratedmethodstubreturnarrayListsize()}返回数组的大小即数组元素个数OverridepublicObjectgetItem(intarg){TODOAutogeneratedmethodstubreturn}OverridepubliclonggetItemId(intarg){TODOAutogeneratedmethodstubreturn}动态生成每个下拉项对应的View每个下拉项View由LinearLayout中包含一个ImageView,两个内嵌的LinearLayout构成其中一个包含两个TestView另一个中包含一个按钮OverridepublicViewgetView(intposition,ViewconvertView,ViewGroupparent){TODOAutogeneratedmethodstubHolderViewholderViewif(convertView==){holderView=newHolderView()convertView=Viewinflate(ListViewBaseAdtActivitythis,Rlayoutlistitem,)holderViewimageView=(ImageView)convertViewfindViewById(Ridimage)holderViewtvTitle=(TextView)convertViewfindViewById(Ridtvname)holderViewtvInfo=(TextView)convertViewfindViewById(Ridtvsum)convertViewsetTag(holderView)}else{holderView=(HolderView)convertViewgetTag()}holderViewimageViewsetImageDrawable(getResources()getDrawable(getResources()getIdentifier((String)arrayListget(position)get("images"),"drawable",getPackageName())))holderViewtvTitlesetText(arrayListget(position)get("titles")toString())holderViewtvInfosetText(arrayListget(position)get("infos")toString())returnconvertView}}lvsetAdapter(ba)为LietView设置内容适配器lvsetOnItemClickListener(newOnItemClickListener(){OverridepublicvoidonItemClick(AdapterView<>arg,Viewarg,intarg,longarg){if(arg==){Intentintent=newIntent(ListViewBaseAdtActivitythis,MainActivityclass)startActivity(intent)}if(arg==){Intentintent=newIntent(ListViewBaseAdtActivitythis,MainActivityclass)ListViewBaseAdtActivitythisstartActivity(intent)}if(arg==){Intentintent=newIntent(ListViewBaseAdtActivitythis,MainActivityclass)startActivity(intent)}if(arg==){Intentintent=newIntent(ListViewBaseAdtActivitythis,MainActivityclass)startActivity(intent)}if(arg==){Intentintent=newIntent(ListViewBaseAdtActivitythis,MainActivityclass)startActivity(intent)}if(arg==){Intentintent=newIntent(ListViewBaseAdtActivitythis,MainActivityclass)startActivity(intent)}if(arg==){Intentintent=newIntent(ListViewBaseAdtActivitythis,MainActivityclass)startActivity(intent)}if(arg==){Intentintent=newIntent(ListViewBaseAdtActivitythis,MainActivityclass)startActivity(intent)}if(arg==){Intentintent=newIntent(ListViewBaseAdtActivitythis,MainActivityclass)startActivity(intent)}if(arg==){Intentintent=newIntent(ListViewBaseAdtActivitythis,MainActivityclass)startActivity(intent)}OverridepublicbooleanonCreateOptionsMenu(Menumenu){menuadd(,MENUADD,,"添加")menuadd(,MENUDELETE,,"删除")returntrue}OverridepublicbooleanonOptionsItemSelected(MenuItemitem){TODOAutogeneratedmethodstubswitch(itemgetItemId()){caseMENUADD:showPhotoDialog()breakcaseMENUDELETE:showDeleteDialog()default:break}returnsuperonOptionsItemSelected(item)}privatevoidshowPhotoDialog(){TODOAutogeneratedmethodstub自定义对话框布局finalViewview=Viewinflate(ListViewBaseAdtActivitythis,Rlayoutdialogadd,)AlertDialogBuilderbuilder=newAlertDialogBuilder(ListViewBaseAdtActivitythis)buildersetView(view)buildersetTitle("新增相册")buildersetNegativeButton("取消",newOnClickListener(){OverridepublicvoidonClick(DialogInterfacedialog,intwhich){TODOAutogeneratedmethodstubtry{Fieldfield=dialoggetClass()getSuperclass()getDeclaredField("mShowing")fieldsetAccessible(true)fieldset(dialog,true)dialogdismiss()}catch(Exceptione){TODOAutogeneratedcatchblockeprintStackTrace()}}})buildersetPositiveButton("确定",newOnClickListener(){OverridepublicvoidonClick(DialogInterfacedialog,intwhich){TODOAutogeneratedmethodstubEditTextetName=(EditText)viewfindViewById(Ridetname)Stringname=etNamegetText()toString()if(TextUtilsisEmpty(name)){Animationshake=AnimationUtilsloadAnimation(ListViewBaseAdtActivitythis,Ranimshake)etNamestartAnimation(shake)ToastmakeText(ListViewBaseAdtActivitythis,"请输入相册名",)show()try{Fieldfield=dialoggetClass()getSuperclass()getDeclaredField("mShowing")fieldsetAccessible(true)fieldset(dialog,false)dialogdismiss()}catch(Exceptione){TODOAutogeneratedcatchblockeprintStackTrace()}}else{try{Fieldfield=dialoggetClass()getSuperclass()getDeclaredField("mShowing")fieldsetAccessible(true)fieldset(dialog,true)}catch(Exceptione){TODOAutogeneratedcatchblockeprintStackTrace()}HashMap<String,Object>map=newHashMap<String,Object>()mapput("images",images)mapput("titles",name)mapput("infos","()")arrayListadd(map)banotifyDataSetChanged()ToastmakeText(ListViewBaseAdtActivitythis,"添加成功",)show()}}})buildershow()}privatevoidshowDeleteDialog(){TODOAutogeneratedmethodstub自定义对话框布局finalViewview=Viewinflate(ListViewBaseAdtActivitythis,Rlayoutdialogdelete,)AlertDialogBuilderbuilder=newAlertDialogBuilder(ListViewBaseAdtActivitythis)buildersetView(view)buildersetTitle("删除相册")buildersetNegativeButton("取消",newOnClickListener(){OverridepublicvoidonClick(DialogInterfacedialog,intwhich){TODOAutogeneratedmethodstubtry{Fieldfield=dialoggetClass()getSuperclass()getDeclaredField("mShowing")fieldsetAccessible(true)fieldset(dialog,true)dialogdismiss()}catch(Exceptione){TODOAutogeneratedcatchblockeprintStackTrace()}}})buildersetPositiveButton("确定",newOnClickListener(){OverridepublicvoidonClick(DialogInterfacedialog,intwhich){TODOAutogeneratedmethodstubEditTextetName=(EditText)viewfindViewById(Ridetitem)Stringname=etNamegetText()toString()if(TextUtilsisEmpty(name)){Animationshake=AnimationUtilsloadAnimation(ListViewBaseAdtActivitythis,Ranimshake)etNamestartAnimation(shake)ToastmakeText(ListViewBaseAdtActivitythis,"请输入要删除的相册",)show()try{Fieldfield=dialoggetClass()getSuperclass()getDeclaredField("mShowing")fieldsetAccessible(true)fieldset(dialog,false)dialogdismiss()}catch(Exceptione){TODOAutogeneratedcatchblockeprintStackTrace()}}else{try{Fieldfield=dialoggetClass()getSuperclass()getDeclaredField("mShowing")fieldsetAccessible(true)fieldset(dialog,true)if(IntegerparseInt(name)>=IntegerparseInt(name)<arrayListsize()){arrayListremove(IntegerparseInt(name))banotifyDataSetChanged()ToastmakeText(ListViewBaseAdtActivitythis,"删除成功",)show()}else{ToastmakeText(ListViewBaseAdtActivitythis,"没有这个相册",)show()Fieldfield=dialoggetClass()getSuperclass()getDeclaredField("mShowing")fieldsetAccessible(true)fieldset(dialog,false)}}catch(Exceptione){TODOAutogeneratedcatchblockeprintStackTrace()}}}})buildershow()}publicArrayList<HashMap<String,Object>>getImage(){ArrayList<HashMap<String,Object>>arrayList=newArrayList<HashMap<String,Object>>()for(inti=i<imageslengthi){HashMap<String,Object>map=newHashMap<String,Object>()mapput("images",imagesi)mapput("titles",titlesi)mapput("infos",infosi)arrayListadd(map)}returnarrayList}publicclassHolderView{publicImageViewimageViewpublicTextViewtvTitlepublicTextViewtvInfo}}packageorgyanzitesthorizontallistviewimportorgyanziuiHorizontalListViewimportorgyanziuiHorizontalListViewAdapterimportandroidappActivityimportandroidcontentIntentimportandroidosBundleimportandroidviewMenuimportandroidviewViewimportandroidviewWindowimportandroidwidgetAdapterViewimportandroidwidgetAdapterViewOnItemClickListenerimportandroidwidgetImageViewpublicclassMainActivityextendsActivity{HorizontalListViewhListViewHorizontalListViewAdapterhListViewAdapterImageViewpreviewImgViewolderSelectView=OverrideprotectedvoidonCreate(BundlesavedInstanceState){requestWindowFeature(WindowFEATURENOTITLE)superonCreate(savedInstanceState)setContentView(Rlayoutactivitymain)initUI()}OverridepublicbooleanonCreateOptionsMenu(Menumenu){InflatethemenuthisaddsitemstotheactionbarifitispresentgetMenuInflater()inflate(Rmenumain,menu)returntrue}publicvoidinitUI(){hListView=(HorizontalListView)findViewById(Ridhorizonlistview)previewImg=(ImageView)findViewById(Ridimagepreview)Stringtitles={"怀师","南怀瑾军校","闭关","南怀瑾","南公庄严照","怀师法相"}finalintids={Rdrawablenanhuaijinmiss,Rdrawablenanhuaijinschool,Rdrawablenanhuaijinbiguan,Rdrawablenanhuaijin,Rdrawablenanhuaijinzhuangyan,Rdrawablenanhuaijinfaxiang}hListViewAdapter=newHorizontalListViewAdapter(getApplicationContext(),titles,ids)hListViewsetAdapter(hListViewAdapter)hListViewsetOnItemClickListener(newOnItemClickListener(){OverridepublicvoidonItemClick(AdapterView<>parent,Viewview,intposition,longid){previewImgsetImageResource(idsposition)hListViewAdaptersetSelectIndex(position)hListViewAdapternotifyDataSetChanged()}})}publicvoidback(Viewv){finish()}}五、实验结果及分析运行Eclipse后以及点击虚拟机上的menu键结果如下图所示:点击添加按钮同时添加相册以及出现添加成功的提示(Tost接口的调用)结果如下图所示:点击删除按钮以及删除相册事件会提示用户删除成功结果如下图所示:点击其中一个相册名如:点击“自拍相册”条目结果如下图所示:六、心得体会:本次的实验是仿照SmartisanT相册的风格通过本次的实验对ImageSwitcher以及Gallery已经熟练掌握对两个Activity的跳转融会贯通对Tost接口已经熟练掌握ListView和BaseAdapter也掌握的很熟练。实验地点行勉A指导教师马

用户评价(0)

关闭

新课改视野下建构高中语文教学实验成果报告(32KB)

抱歉,积分不足下载失败,请稍后再试!

提示

试读已结束,如需要继续阅读或者下载,敬请购买!

评分:

/82

VIP

在线
客服

免费
邮箱

爱问共享资料服务号

扫描关注领取更多福利