protected String getListRequestURL(ArrayList<NameValuePair> params) throws URISyntaxException, IOException { URI u = URIUtils.createURI( "http", "ep.knou.ac.kr", -1, "portal/epo/service/retrieveIntgAnncList.data", URLEncodedUtils.format(params, "UTF-8"), null); HelpF.Log.d(this, "u.toURL():" + u.toURL()); // HttpPost post = new HttpPost(u); HttpGet get = new HttpGet(u); // HttpPost post = new // HttpPost("http://api.twitter.com/1/direct_messages/new.xml"); // 한글처리 // post.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8)); HttpResponse response = mHttpClient.execute(get); int code = response.getStatusLine().getStatusCode(); HttpEntity entity = response.getEntity(); InputStream is = entity.getContent(); StringBuilder sb = new StringBuilder(); java.io.InputStreamReader isr = null; BufferedReader br = null; try { isr = new java.io.InputStreamReader(is, "UTF-8"); br = new BufferedReader(isr); String tmp = null; while ((tmp = br.readLine()) != null) { sb.append(tmp); } } catch (Exception ex) { } finally { try { br.close(); } catch (IOException ex) { } try { isr.close(); } catch (IOException ex) { } } String content = sb.toString(); HelpF.Log.d("HAN", "content1:" + content); return content; }
protected void onPostExecute(Long result) { dismissDialog(DIALOG1_KEY); mTvDepartment.setText( Html.fromHtml("<font color='#008652'>[부서]</font>" + mKnouNoticeInfo.regDpNm)); mTvDate.setText( Html.fromHtml( "<font color='#008652'>[작성일]</font>" + mKnouNoticeInfo.regDttm.substring(0, 10))); mTvHit.setText(Html.fromHtml("<font color='#008652'>[조회]</font>" + mKnouNoticeInfo.inqT)); mTvSubject.setText( Html.fromHtml("<font color='#008" + "652'>[제목]</font>" + mKnouNoticeInfo.tit)); if (mWvContent != null) { FrameLayout mContentView = (FrameLayout) getWindow().getDecorView().findViewById(android.R.id.content); HelpF.Log.d("HAN", "mKnouNoticeInfo.content:" + mKnouNoticeInfo.content); System.out.println("mKnouNoticeInfo.content:" + mKnouNoticeInfo.content); mWvContent.loadDataWithBaseURL( null, mKnouNoticeInfo.content.toString(), mimeType, encoding, null); } mCustomerArrayAdapter = new CustomerArrayAdapter( NoticeRead.this, 0, new ArrayList<KnouNoticeFileInfo>(mKnouNoticeInfo.AttacheFiles)); if (0 < mKnouNoticeInfo.AttacheFiles.size()) { mBtnFileView.setVisibility(View.VISIBLE); } if (mIread == 1) { mTgbtnCollection.setChecked(false); } else if (mIread == 2) { mTgbtnCollection.setChecked(true); } if (mMemo != null) { if (!mMemo.trim().equals("")) { mBtnMemo.setText("메모(O)"); } else { mBtnMemo.setText("메모(X)"); } } else { mBtnMemo.setText("메모(X)"); } findViewById(R.id.notice_read).setVisibility(View.VISIBLE); }
protected String getInfoRequestURL(ArrayList<NameValuePair> params) { // 학과 선택 URI u = null; try { u = URIUtils.createURI( "http", "ep.knou.ac.kr", -1, "/portal/epo/service/retrieveIntgAnncDtl.do", URLEncodedUtils.format(params, "UTF-8"), null); } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { HelpF.Log.d("HAN", "u.toURL():" + u.toURL()); } catch (MalformedURLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } /* HttpPost post = new HttpPost(u); // 한글처리 try { post.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8)); } catch (UnsupportedEncodingException e2) { // TODO Auto-generated catch block e2.printStackTrace(); } */ HttpGet get = new HttpGet(u); HttpResponse response = null; try { response = mHttpClient.execute(get); } catch (ClientProtocolException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } int code = response.getStatusLine().getStatusCode(); HttpEntity entity = response.getEntity(); InputStream is = null; try { is = entity.getContent(); } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } StringBuilder sb = new StringBuilder(); java.io.InputStreamReader isr = null; BufferedReader br = null; try { isr = new java.io.InputStreamReader(is, "UTF-8"); br = new BufferedReader(isr); String tmp = null; while ((tmp = br.readLine()) != null) { sb.append(tmp); } } catch (Exception ex) { } finally { try { br.close(); } catch (IOException ex) { } try { isr.close(); } catch (IOException ex) { } } String content = sb.toString(); // Log.d("HAN","content1:"+content); content = content.substring(content.indexOf("<!-- view -->")); // <!-- 입력 내용 --> content = content.substring(0, content.lastIndexOf("<!-- // view -->")); HelpF.Log.d("HAN", "content1:" + content); return content; }
public void finalize() { HelpF.Log.d("HAN", "DiaryProvider finalize"); }
@Override public Cursor query( Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { SQLiteQueryBuilder qb = new SQLiteQueryBuilder(); String orderBy = null; String logSql = null; String sql = null; // Log.d("HAN", "uri:" + uri.toString()); switch (sUriMatcher.match(uri)) { case KNOU_NOTICES: qb.setTables(KNOU_NOTICE.TABLE_NAME); qb.setProjectionMap(sKnouNoticeProjectionMap); orderBy = KNOU_NOTICE.ORDER_ID_DESC; break; case KNOU_NOTICE_ID: qb.setTables(KNOU_NOTICE.TABLE_NAME); qb.setProjectionMap(sKnouNoticeProjectionMap); qb.appendWhere(KNOU_NOTICE._ID + "=" + uri.getPathSegments().get(1)); orderBy = KNOU_NOTICE.ORDER_ID_DESC; break; case KNOU_NOTICE_FILES: qb.setTables(KNOU_NOTICE_FILE.TABLE_NAME); qb.setProjectionMap(sKnouNoticeFileProjectionMap); orderBy = KNOU_NOTICE_FILE.ORDER_ID_DESC; break; case KNOU_NOTICE_FILE_ID: qb.setTables(KNOU_NOTICE_FILE.TABLE_NAME); qb.setProjectionMap(sKnouNoticeFileProjectionMap); qb.appendWhere(KNOU_NOTICE_FILE._ID + "=" + uri.getPathSegments().get(1)); orderBy = KNOU_NOTICE_FILE.ORDER_ID_DESC; break; default: throw new IllegalArgumentException("Unknown URI " + uri); } SQLiteDatabase db = mOpenHelper.getReadableDatabase(); Cursor c = null; // If no sort order is specified use the default if (!TextUtils.isEmpty(sortOrder)) { orderBy = sortOrder; } // Get the database and run the query sql = qb.buildQuery(projection, selection, selectionArgs, null, null, orderBy, null); if (debug) { logSql = sql; if (selectionArgs != null) { for (int i = 0; i < selectionArgs.length; i++) { logSql = logSql.replace("?", selectionArgs[i]); // Log.d("HAN", "1111selectionArgs["+i+"]:"+selectionArgs[i]); } } HelpF.Log.d("HAN", "sql[" + uri + "]:" + logSql); } c = db.rawQuery(sql, selectionArgs); // Tell the cursor what uri to watch, so it knows when its source data // changes c.setNotificationUri(getContext().getContentResolver(), uri); return c; }