口碑apk反编译后研究中

manifest

<application .. android:name="KoubeiApp">

KoubeiApp.java应该是应用程序获取客户端一些通用信息,跟.net,global类似

static
{
fileName
= "config.properties";
sp
= null;
DEVICE_MODEL
= Build.MODEL;
StringBuilder localStringBuilder1
= new StringBuilder().append("android_");
String str1
= Build.VERSION.SDK;
CLIENT_OS
= str1;
CLIENT_VERSION
= "1.3";
CLIENT_ID
= "00000000000000";
CLIENT_POS_X
= "";
CLIENT_POS_Y
= "";
CLIENT_LOCAL_CITYNAME
= "鍖椾含";
CLIENT_LOCAL_CITYID
= "99";
CLIENT_SOURCE
= "koubei";
CLIENT_CITY_NAME
= null;
CLIENT_CITY_ID
= null;
CLIENT_SCREEN_SIZE
= "320*480";
StringBuilder localStringBuilder2
= new StringBuilder();
String str2
= Build.MODEL;
StringBuilder localStringBuilder3
= localStringBuilder2.append(str2);
String str3
= Build.VERSION.RELEASE;

 getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

放在onCreate后,setControlView之前,全屏(隐藏上方电量等属性)

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);设置屏幕竖排,横排或其他(枚举);

关于闪屏(就是首页停留几秒然后跳转,像html的setTimeout和setInternal)

Message msg = new Message(); msg.what = STOPSPLASH; splashHandler.sendMessageDelayed(msg, SPLASHTIME);

这个网上有好几种方式,目前研究不深,搞不清哪种比较好,http://www.cnblogs.com/royenhome/archive/2010/05/05/1727971.html?login=1他这里像是线程暂停,按下Menu键的话,直接跳过闪屏进入主界面;若按 下Back键的话,则直接退出主程序。还不错!我准备用这种方式

asynctask异步加载数据(有几种方法,关键要能用,找了这个)

public class Main extends Activity {

private LayoutInflater m_flater = null;
private LinearLayout mFlash;

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.flash);
mFlash
= (LinearLayout) findViewById(R.id.mFlash);
mFlash.startAnimation(AnimationUtils
.loadAnimation(
this, R.anim.fadeout));
m_flater
= getLayoutInflater();
LoadMainTask task
= new LoadMainTask(this);
task.execute(
"");

}

public View LoadMainView(LayoutInflater flater) {
View view
= flater.inflate(R.layout.main, null);
Button btnOk
= (Button) view.findViewById(R.id.BtnOk);
btnOk.setOnClickListener(
new OnClickListener() {
public void onClick(View v) {
finish();
}
});
return view;
}

private class LoadMainTask extends AsyncTask<Object, Object, View> {
public LoadMainTask(Context context) {
}

protected View doInBackground(Object... params) {
View view
= null;
view
= LoadMainView(m_flater);
// 为了测试加了延时,大家可以在这一块加载资源,数据等
try {
Thread.sleep(
3000);
}
catch (InterruptedException e) {
e.printStackTrace();
}
return view;
}

// 执行完毕
protected void onPostExecute(View view) {
setContentView(view);
}
}

}

退出时自动弹出框提示是否要退出~

View Code
1 public boolean onKeyDown(int keyCode, KeyEvent event) {
2 // TODO Auto-generated method stub
3  
4 if(keyCode == KeyEvent.KEYCODE_BACK ){
5 AlertDialog.Builder builder=new AlertDialog.Builder(this);
6 builder.setTitle("提示");
7 builder.setMessage("确定要退出程序?");
8 builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
9
10 @Override
11 public void onClick(DialogInterface dialog, int which) {
12 // TODO Auto-generated method stub
13   dialog.dismiss();
14 finish();
15 }
16 });
17 builder.setNeutralButton("取消", new DialogInterface.OnClickListener() {
18
19 @Override
20 public void onClick(DialogInterface dialog, int which) {
21 // TODO Auto-generated method stub
22 dialog.dismiss();
23 }
24 });
25 builder.show();
26 return true;
27 }else{
28
29 return super.onKeyDown(keyCode, event);
30 }
31 }
posted @ 2011-04-07 12:40  子午  阅读(759)  评论(0编辑  收藏  举报