기본 콘텐츠로 건너뛰기

글

Android, Nifty Push

**** Google Develop Console  Make Project  API > Cloud Messaging for Android -> 有効 認証情報 > API Key > ServerKey(*1) 作成 ホーム : Project No (*2) **** Nifty  アプリ設定 > Push 通知 > API Key : *1を入力 基本 > API Key : Application Key(*3), Client Key (*4) **** 端末 initializeの時、*3, *4を使う。 registerの時、*2を使う

Android, thread once last one

String lastKey = null ; ... public void method1(){ lastKey = Calendar. getInstance ().getTimeInMillis()+ "" ; final String key = lastKey ; final Handler handler = new Handler(); handler.postDelayed( new Runnable() { @Override public void run() { if ( key .equals( shutdownKey )){ // doSomething } } }, 1000 ); }

Anroid, get Server Data, Connection, HttpClient depracated

HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setReadTimeout( 15000 ); conn.setConnectTimeout( 15000 ); conn.setRequestMethod( "POST" ); conn.setDoInput( true ); conn.setDoOutput( true ); OutputStream os = conn.getOutputStream(); BufferedWriter writer = new BufferedWriter( new OutputStreamWriter(os, "UTF-8" )); String paramStr = null ; {// need BasicNameValuePair -> ContentsValue for (BasicNameValuePair record : params ){ if (paramStr == null ){ paramStr = "" ; } else { paramStr = paramStr + "&" ; } paramStr = paramStr + record.getName()+ "=" +record.getValue(); } } writer.write(paramStr); writer.flush(); writer.close(); os.close(); int responseCode=conn.getResponseCode(); if (responseCode == HttpsURLConnection. HTTP_OK ) { String line; BufferedReader br= ...

Android, doen't work FLAG_ACTIVITY_NO_ANIMATION with FLAG_ACTIVITY_REORDER_TO_FRONT

intent.setFlags(Intent. FLAG_ACTIVITY_REORDER_TO_FRONT ); intent.addFlags(Intent. FLAG_ACTIVITY_NO_ANIMATION ); -> does not work  FLAG_ACTIVITY_NO_ANIMATION @Override protected void onNewIntent(Intent intent) { super .onNewIntent(intent); if (intent.getFlags() == (Intent. FLAG_ACTIVITY_NO_ANIMATION | Intent. FLAG_ACTIVITY_REORDER_TO_FRONT )){ overridePendingTransition( 0 , 0 ); } }