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); } } }