您的位置:首页 > 移动开发 > Android开发

Android手机卫士的第二天

2012-07-27 20:31 260 查看
1、设置Activity跳转时候的样式:overridePendingTransition(R.anim.alpha_in, R.anim.alpha_out);这里也可以设置动画的其他效果。
2、自定义空间的获取控件id的情况if (isSetup()) {// 设置完成的向导界面setContentView(R.layout.lost_protect);tv_lost_protect_number = (TextView) findViewById(R.id.tv_lost_protect_number);String num = sp.getString("number", "");tv_lost_protect_number.setText(num);cb_lost_protect_status = (CheckBox) findViewById(R.id.cb_lost_protect_status);boolean ischecked = sp.getBoolean("protecting", true);if (ischecked) {cb_lost_protect_status.setText("防盗保护开启");cb_lost_protect_status.setChecked(true);} else {cb_lost_protect_status.setText("防盗保护没有开启");cb_lost_protect_status.setChecked(false);}// 重新进入设置向导tv_lost_protect_reentry_setup = (TextView) findViewById(R.id.tv_lost_protect_reentry_setup);tv_lost_protect_reentry_setup.setOnClickListener(this);} else {Intent intent = new Intent(LostProtectedActivity.this,SetupActivity1.class);startActivity(intent);}
3、Android SDK中,在data\res\Drawable下有资源文件,这些资源文件打包到Android.jar中,可以直接使用这些jar包。好处:这些素材的id的引用一经默认的生成好了。可以减少当前的apk的体积。要使用Androidjar包中的东西 @Android4、重点:在广播接受者中如何启动一个activity:
public class LostProtectReciver extends BroadcastReceiver {@Overridepublic void onReceive(Context context, Intent intent) {String number =getResultData();if("1008612".equals(number)){Intent newIntent = new Intent(context,LostProtectedActivity.class);//如果在广播接受者中启动一个新的act,则需要告诉系统启动一个新的任务栈newIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);context.startActivity(newIntent);setResultData(null);}}}

                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: