'프로그래밍!!/Android'에 해당되는 글 5건
- 2011/09/02 WebView에서 url이 로딩될 때 내부처리/외부처리 바꾸기
- 2011/08/08 안드로이드에서 웹으로 데이터 넘기기.
- 2011/07/26 안드로이드에서 버전업 했을때 버전 확인하고 다운 받기
- 2011/07/26 안드로이드에서 SharedPreferences(임시 저장 공간) 활용하기
- 2011/07/26 Android에서 자기 번호 가져오기
web.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
// TODO Auto-generated method stub
// return super.shouldOverrideUrlLoading(view, url);
view.loadUrl(url);
return true; // TRUE이면 내부처리, FALSE이면 내장 브라우저에서
}
});
web.loadUrl("주소");
보통 웹뷰를 쓸때 어플 내부에 웹을 띄우기 위해서인데, 내부 처리하는 경우가 더 많다고 생각한다.
그러므로..
'프로그래밍!! > Android' 카테고리의 다른 글
| WebView에서 url이 로딩될 때 내부처리/외부처리 바꾸기 (0) | 2011/09/02 |
|---|---|
| 안드로이드에서 웹으로 데이터 넘기기. (0) | 2011/08/08 |
| 안드로이드에서 버전업 했을때 버전 확인하고 다운 받기 (0) | 2011/07/26 |
| 안드로이드에서 SharedPreferences(임시 저장 공간) 활용하기 (0) | 2011/07/26 |
| Android에서 자기 번호 가져오기 (0) | 2011/07/26 |
URL url = new URL(주소);
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setDefaultUseCaches(false);
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setRequestMethod("POST");// 방식,.. POST,GET,PUT 등..
String s = "키="+밸류+"&키2="+밸류+"&키3="+밸류";
PrintWriter pw = new PrintWriter(new OutputStreamWriter(conn.getOutputStream(), "UTF-8"));
pw.write(s);
pw.flush();
BufferedReader bf = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
StringBuilder buff = new StringBuilder();
String line;
while((line = bf.readLine()) != null)
{
buff.append(line);
}
return buff.toString(); // 결과값 도출'프로그래밍!! > Android' 카테고리의 다른 글
| WebView에서 url이 로딩될 때 내부처리/외부처리 바꾸기 (0) | 2011/09/02 |
|---|---|
| 안드로이드에서 웹으로 데이터 넘기기. (0) | 2011/08/08 |
| 안드로이드에서 버전업 했을때 버전 확인하고 다운 받기 (0) | 2011/07/26 |
| 안드로이드에서 SharedPreferences(임시 저장 공간) 활용하기 (0) | 2011/07/26 |
| Android에서 자기 번호 가져오기 (0) | 2011/07/26 |
public boolean CertificateVersion()
{
String s_url = "버전이 있는 주소";
URL ver_url;
try {
ver_url = new URL(s_url);
HttpURLConnection http;
try {
http = (HttpURLConnection)ver_url.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(http.getInputStream()));
StringBuffer buffer = new StringBuffer();
int c;
while((c=in.read()) != -1){
buffer.append((char)c);
}
String content = buffer.toString();//content 있는 값을 비교한다.
if(content.equals(version) == false)
{
{
Update();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (MalformedURLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
return false;
}
public void Update()
{
File updater = new File("/sdcard/프로그램업데이터넣을곳/");
if(!updater.exists()) {
updater.mkdirs();
}
try {
URLConnection uc = new URL(업데이트 주소).openConnection();
InputStream in = uc.getInputStream();
int len=0;
byte[] buf = new byte[1024];
File updateFile=new File(updater + filename);
// 다운로드
FileOutputStream fos = new FileOutputStream(updateFile);
while((len=in.read(buf, 0, 1024)) != -1) {
total += len;
fos.write(buf, 0, len);
}
in.close();
fos.flush();
fos.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.i("fdin", e.getMessage());
}
Toast.makeText(Activity.this, "업데이트 파일을 실행해주세요, 위치 : " + updater + filename, Toast.LENGTH_LONG).show();
System.exit(0);
}
'프로그래밍!! > Android' 카테고리의 다른 글
| WebView에서 url이 로딩될 때 내부처리/외부처리 바꾸기 (0) | 2011/09/02 |
|---|---|
| 안드로이드에서 웹으로 데이터 넘기기. (0) | 2011/08/08 |
| 안드로이드에서 버전업 했을때 버전 확인하고 다운 받기 (0) | 2011/07/26 |
| 안드로이드에서 SharedPreferences(임시 저장 공간) 활용하기 (0) | 2011/07/26 |
| Android에서 자기 번호 가져오기 (0) | 2011/07/26 |
안드로이드에서 조그마한 저장소가 하나 존재한다.
이 저장소를 활용하여 프로그래밍 종료되도 설정에 저장된 내용을 유지시키거나 혹은 프로그램 처음 킬때 인증 과정을 하는 과정등의 여러가지 활용이 가능하다.
SharedPreferences setting;
// SharedPreferences 에 있는 값을 가져오기 위한 과정
setting = getSharedPreferences("PATH", MODE_PRIVATE);
path = setting.getString("PATH", "/sdcard/"); // PATH 라는 곳에 있는 값을 가져오고 default값은 /sdcard/
// SharedPreferences 에 값을 저장하기
이 저장소를 활용하여 프로그래밍 종료되도 설정에 저장된 내용을 유지시키거나 혹은 프로그램 처음 킬때 인증 과정을 하는 과정등의 여러가지 활용이 가능하다.
SharedPreferences setting;
// SharedPreferences 에 있는 값을 가져오기 위한 과정
setting = getSharedPreferences("PATH", MODE_PRIVATE);
path = setting.getString("PATH", "/sdcard/"); // PATH 라는 곳에 있는 값을 가져오고 default값은 /sdcard/
// SharedPreferences 에 값을 저장하기
Editor editor = setting.edit();
editor.putString("PATH", edit.getText().toString);
editor.commit();
putString 이외에도 putBoolean 등 다양한 형태를 저장할 수 있다.
putString 이외에도 putBoolean 등 다양한 형태를 저장할 수 있다.
'프로그래밍!! > Android' 카테고리의 다른 글
| WebView에서 url이 로딩될 때 내부처리/외부처리 바꾸기 (0) | 2011/09/02 |
|---|---|
| 안드로이드에서 웹으로 데이터 넘기기. (0) | 2011/08/08 |
| 안드로이드에서 버전업 했을때 버전 확인하고 다운 받기 (0) | 2011/07/26 |
| 안드로이드에서 SharedPreferences(임시 저장 공간) 활용하기 (0) | 2011/07/26 |
| Android에서 자기 번호 가져오기 (0) | 2011/07/26 |
private String GetMyPhoneNumber()
{
{
TelephonyManager manager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
String phoneNum = manager.getLine1Number();
return phoneNum;
} return phoneNum;
ㅋㅋㅋㅋ안드로이드 개발 재미나네.ㅋ
'프로그래밍!! > Android' 카테고리의 다른 글
| WebView에서 url이 로딩될 때 내부처리/외부처리 바꾸기 (0) | 2011/09/02 |
|---|---|
| 안드로이드에서 웹으로 데이터 넘기기. (0) | 2011/08/08 |
| 안드로이드에서 버전업 했을때 버전 확인하고 다운 받기 (0) | 2011/07/26 |
| 안드로이드에서 SharedPreferences(임시 저장 공간) 활용하기 (0) | 2011/07/26 |
| Android에서 자기 번호 가져오기 (0) | 2011/07/26 |






Recent Comment