This is a strange
it happend from android OS version 1 from now on.
i'don't know why google dosen't fix it
anyway
it has a solution below
when called onCreate() in FirstActivity
check
if(!isTaskRoot()){
finish();
return;
}
I tested many time it working well.
and i hope it has no side effect.
Tuesday, April 29, 2014
if you want to use localstorage in Android
this is sigificant to add some line when you make webview
getSettings().setDomStorageEnabled(true);
getSettings().setDatabaseEnabled(true);
if(Build.VERSION.SDK_INT < 19){ // Build.VERSION_CODES.KITKAT = 19
getSettings().setDatabasePath("/data/data/" + getContext().getPackageName() + "/databases/");
}
getSettings().setDomStorageEnabled(true);
getSettings().setDatabaseEnabled(true);
if(Build.VERSION.SDK_INT < 19){ // Build.VERSION_CODES.KITKAT = 19
getSettings().setDatabasePath("/data/data/" + getContext().getPackageName() + "/databases/");
}
Thursday, April 24, 2014
There are way to sync cookie in webview
in Webview Activity
when : onCreate
-> CookieSyncManager.createInstance(this);
when : onResum
-> CookieSyncManager.getInstance().startSync();
when : onPasue
-> CookieSyncManager.getInstance().stopSync();
when : onCreate
-> CookieSyncManager.createInstance(this);
when : onResum
-> CookieSyncManager.getInstance().startSync();
when : onPasue
-> CookieSyncManager.getInstance().stopSync();
When : onDestory
-> CookieManager.getInstance().removeSessionCookie();
in WebClient
when : onPageFinished
-> CookieSyncManager.getInstance().sync();
that is all when you make a webapp application with session
Wednesday, April 23, 2014
Monday, April 14, 2014
Android Register Broadcast and using it
this is usually set onStart and onStop in activity
onStart you register Receiver
this.registerReceiver(lockBroadcastReceiver, new IntentFilter(BroadCastConstant.LOCK_BROAD_CAST));
onStop you unregister Receiver
this.unregisterReceiver(lockBroadcastReceiver);
and Receiver sample Class
this is just example
private BroadcastReceiver lockBroadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String initial = intent.getStringExtra("initial");
String url = intent.getStringExtra("url");
if(initial == null)return;
if(url == null)return;
callAdStatistic(url, initial);
}
};
when you call it you can add parameters
Intent intent = new Intent();
intent.setAction(BroadCastConstant.LOCK_BROAD_CAST);
intent.putExtra("initial", initial);
intent.putExtra("url", url);
sendBroadcast(intent);
onStart you register Receiver
this.registerReceiver(lockBroadcastReceiver, new IntentFilter(BroadCastConstant.LOCK_BROAD_CAST));
onStop you unregister Receiver
this.unregisterReceiver(lockBroadcastReceiver);
and Receiver sample Class
this is just example
private BroadcastReceiver lockBroadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String initial = intent.getStringExtra("initial");
String url = intent.getStringExtra("url");
if(initial == null)return;
if(url == null)return;
callAdStatistic(url, initial);
}
};
when you call it you can add parameters
Intent intent = new Intent();
intent.setAction(BroadCastConstant.LOCK_BROAD_CAST);
intent.putExtra("initial", initial);
intent.putExtra("url", url);
sendBroadcast(intent);
Sunday, April 6, 2014
if you find out missing mssql in pom.xml
http://stackoverflow.com/questions/19537396/missing-artifact-com-microsoft-sqlserversqljdbc4jar4-0
Subscribe to:
Posts (Atom)