Android APP首次应用时导航栏制作源码
2014-12-02 10:10
351 查看
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.KeyEvent;
import android.widget.LinearLayout;
/**
* 软件启动界面
* */
public class StartActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_my01);
LinearLayout mLinear = (LinearLayout) findViewById(R.id.Fragment01Linear);
mLinear.setBackgroundResource(R.drawable.ic_splash_screen);
new Thread() {
public void run() {
try {
Thread.sleep(1500);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Message msg = hand.obtainMessage();
hand.sendMessage(msg);
}
}.start();
};
Handler hand = new Handler() {
public void handleMessage(android.os.Message msg) {
super.handleMessage(msg);
if (isFristRun()) {
Intent intent = new Intent(StartActivity.this,
MainActivity.class);
startActivity(intent);
} else {
Intent intent = new Intent(StartActivity.this,
FrameActivity.class);
startActivity(intent);
}
finish();
};
};
private boolean isFristRun() {
SharedPreferences sharedPreferences = this.getSharedPreferences(
"share", MODE_PRIVATE);
boolean isFirstRun = sharedPreferences.getBoolean("isFirstRun", true);
Editor editor = sharedPreferences.edit();
if (!isFirstRun) {
return false;
} else {
editor.putBoolean("isFirstRun", false);
editor.commit();
return true;
}
}
public boolean onKeyDown(int keyCode, KeyEvent event) {
// TODO Auto-generated method stub
if (keyCode == KeyEvent.KEYCODE_BACK) {
}
return true;
}
}
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.KeyEvent;
import android.widget.LinearLayout;
/**
* 软件启动界面
* */
public class StartActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_my01);
LinearLayout mLinear = (LinearLayout) findViewById(R.id.Fragment01Linear);
mLinear.setBackgroundResource(R.drawable.ic_splash_screen);
new Thread() {
public void run() {
try {
Thread.sleep(1500);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Message msg = hand.obtainMessage();
hand.sendMessage(msg);
}
}.start();
};
Handler hand = new Handler() {
public void handleMessage(android.os.Message msg) {
super.handleMessage(msg);
if (isFristRun()) {
Intent intent = new Intent(StartActivity.this,
MainActivity.class);
startActivity(intent);
} else {
Intent intent = new Intent(StartActivity.this,
FrameActivity.class);
startActivity(intent);
}
finish();
};
};
private boolean isFristRun() {
SharedPreferences sharedPreferences = this.getSharedPreferences(
"share", MODE_PRIVATE);
boolean isFirstRun = sharedPreferences.getBoolean("isFirstRun", true);
Editor editor = sharedPreferences.edit();
if (!isFirstRun) {
return false;
} else {
editor.putBoolean("isFirstRun", false);
editor.commit();
return true;
}
}
public boolean onKeyDown(int keyCode, KeyEvent event) {
// TODO Auto-generated method stub
if (keyCode == KeyEvent.KEYCODE_BACK) {
}
return true;
}
}
相关文章推荐
- Android内核开发:从源码树中删除出厂的app应用
- 关于Android app首次安装完成后在安装界面直接“打开”应用再按home键返回桌面,重新进入app重复实例化launcher activity的问题的解决
- Android开发——Fragment简单示例(二)制作一个应用菜单导航栏
- android新闻应用、应用锁、小说阅读、短视频APP等源码
- Android内核开发:从源码树中删除出厂的app应用
- Android内核开发:在源码树中添加新的app应用
- Android内核开发:从源码树中删除出厂的app应用
- Android内核开发:在源码树中添加新的app应用
- 关于Android app首次安装完成后在安装界面打开应用再按home键返回桌面,重新进入app重复实例化launcher activity(转)
- android新闻应用、应用锁、小说阅读、短视频APP等源码
- android客户端APP首次制作
- 如何在Android 内核源码树中添加app应用?
- 关于Android app首次安装完成后在安装界面直接“打开”应用再按home键返回桌面,重新进入app重复实例化launcher activity的问题的解决
- 最新iOS应用Beta测试分发app分发平台源码 Android应用内测分发平台源码免费仿蒲公英平台
- 关于Android app首次安装完成后在安装界面直接“打开”应用再按home键返回桌面,重新进入app重复实例化launcher activity的问题的解决
- 关于Android app首次安装完成后在安装界面直接“打开”应用再按home键返回桌面,重新进入app重复实例化launcher activity的问题的解决
- Android内核开发:从源码树中删除出厂的app应用
- Android 小应用:“自动拨打电话app”制作心得
- 关于Android app首次安装完成后在安装界面直接“打开”应用再按home键返回桌面,重新进入app重复实例化launcher activity的问题的解决
- Android内核开发:在源码树中添加新的app应用