Android手机卫士的第二天



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包中的东西 @Android


4、重点:在广播接受者中如何启动一个activity:

public class LostProtectReciver extends BroadcastReceiver {

	@Override
	public 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);
		}
	}

}








  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值