【发布时间】:2016-07-16 06:53:11
【问题描述】:
我想做一些工作,比如在显示初始屏幕时填充哈希映射。但我不知道我是怎么做到的
我认为一种方法是创建新线程?
我的启动画面代码
public class SplashActivity extends AppCompatActivity {
long Delay = 2000;
public void onAttachedToWindow() {
super.onAttachedToWindow();
Window window = getWindow();
window.setFormat(PixelFormat.RGBA_8888);
}
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splashactivity);
StartAnimations();
Timer RunSplash = new Timer();
TimerTask ShowSplash = new TimerTask() {
@Override
public void run() {
finish();
Intent myIntent = new Intent(SplashActivity.this,LoginEnquiryTab.class);
overridePendingTransition(R.anim.pull_in_left, R.anim.push_out_left);
startActivity(myIntent);
}
};
RunSplash.schedule(ShowSplash,Delay);
}
【问题讨论】:
-
你想让 2 用 hashmap 做什么?
-
在 splashactivity 中用键和值填充 hasmap,在某些操作中我需要该信息..所以我访问了它