客户端——文档

客户端——文档

ID:37466742

大小:673.87 KB

页数:58页

时间:2019-05-24

客户端——文档_第1页
客户端——文档_第2页
客户端——文档_第3页
客户端——文档_第4页
客户端——文档_第5页
资源描述:

《客户端——文档》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、客户端的界面/***欢迎界面publicclassWelcomeActivityextendsActivity{privateSharePreferenceUtilutil;privateHandlermHandler;publicvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULL

2、SCREEN);//去掉状态栏setContentView(R.layout.main);util=newSharePreferenceUtil(this,Constants.SAVE_USER);if(util.getisFirst()){createShut();//创建快捷方式moveSound();}initView();}publicvoidinitView(){if(util.getIsStart()){//如果正在后台运行goFriendListActivity();}else{//如果是首次运行mHandler=newHandler();mHandler.p

3、ostDelayed(newRunnable(){publicvoidrun(){//TODOAuto-generatedmethodstubgoLoginActivity();}},1000);}}*进入登陆界面publicvoidgoLoginActivity(){Intentintent=newIntent();intent.setClass(this,LoginActivity.class);startActivity(intent);finish();}*进入好友列表界面publicvoidgoFriendListActivity(){Intenti=newInt

4、ent(this,FriendListActivity.class);58客户端的界面startActivity(i);util.setIsStart(false);finish();}*创建桌面快捷方式publicvoidcreateShut(){//创建添加快捷方式的IntentIntentaddIntent=newIntent("com.android.launcher.action.INSTALL_SHORTCUT");Stringtitle=getResources().getString(R.string.app_name);//加载快捷方式的图标Parcela

5、bleicon=Intent.ShortcutIconResource.fromContext(WelcomeActivity.this,R.drawable.icon);//创建点击快捷方式后操作Intent,该处当点击创建的快捷方式后,再次启动该程序IntentmyIntent=newIntent(WelcomeActivity.this,WelcomeActivity.class);//设置快捷方式的标题addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME,title);//设置快捷方式的图标addIntent.putExtra(

6、Intent.EXTRA_SHORTCUT_ICON_RESOURCE,icon);//设置快捷方式对应的IntentaddIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT,myIntent);//发送广播添加快捷方式sendBroadcast(addIntent);util.setIsFirst(false);}*复制原生资源文件“来消息声音”到应用目录下,publicvoidmoveSound(){InputStreamis=getResources().openRawResource(R.raw.msg);Filefile=ne

7、wFile(getFilesDir(),"msg.mp3");try{OutputStreamos=newFileOutputStream(file);intlen=-1;byte[]buffer=newbyte[1024];while((len=is.read(buffer))!=-1){os.write(buffer,0,len);}//System.out.println("声音复制完毕");}catch(FileNotFoundExceptione){e.printStackTrace();}catch(I

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。