Search

'문자'에 해당되는 글 1건

  1. 2013.03.08 Intent 활용하기

Intent 활용하기

Programming/Android 2013. 3. 8. 19:25 Posted by TanSanC
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

//show webapp:

 

Uri uri = Uri.parse("http://www.google.com");

Intent it  = new Intent(Intent.ACTION_VIEW,uri);

startActivity(it);

 

//show maps:

Uri uri = Uri.parse("geo:38.899533,-77.036476");

Intent it = new Intent(Intent.Action_VIEW,uri);

startActivity(it);

 

//show ways

Uri uri = Uri.parse("http://maps.google.com/maps?f=d&saddr=startLat%20startLng&daddr=endLat%20endLng&hl=en");

Intent it = new Intent(Intent.ACTION_VIEW,URI);

startActivity(it);

 

//call dial program

Uri uri = Uri.parse("tel:xxxxxx");

Intent it = new Intent(Intent.ACTION_DIAL, uri); 

startActivity(it); 

 

Uri uri = Uri.parse("tel.xxxxxx");

Intent it =new Intent(Intent.ACTION_CALL,uri);

//don't forget add this config:

<uses-permission id="android.permission.CALL_PHONE" />

 

//send sms/mms

//call sender program

Intent it = new Intent(Intent.ACTION_VIEW);  

it.putExtra("sms_body", "The SMS text");  

it.setType("vnd.android-dir/mms-sms");  

startActivity(it); 

 

//send sms

Uri uri = Uri.parse("smsto:0800000123");  

Intent it = new Intent(Intent.ACTION_SENDTO, uri);  

it.putExtra("sms_body", "The SMS text");  

startActivity(it); 

 

//send mms

Uri uri = Uri.parse("content://media/external/images/media/23");  

Intent it = new Intent(Intent.ACTION_SEND);  

it.putExtra("sms_body", "some text");  

it.putExtra(Intent.EXTRA_STREAM, uri);  

it.setType("image/png");  

startActivity(it);

 

//send email

 

Uri uri = Uri.parse("mailto:xxx@abc.com");

Intent it = new Intent(Intent.ACTION_SENDTO, uri);

startActivity(it);

 

Intent it = new Intent(Intent.ACTION_SEND);  

it.putExtra(Intent.EXTRA_EMAIL, "me@abc.com");  

it.putExtra(Intent.EXTRA_TEXT, "The email body text");  

it.setType("text/plain");  

startActivity(Intent.createChooser(it, "Choose Email Client")); 

 

Intent it=new Intent(Intent.ACTION_SEND);    

String[] tos={"me@abc.com"};    

String[] ccs={"you@abc.com"};    

it.putExtra(Intent.EXTRA_EMAIL, tos);    

it.putExtra(Intent.EXTRA_CC, ccs);    

it.putExtra(Intent.EXTRA_TEXT, "The email body text");    

it.putExtra(Intent.EXTRA_SUBJECT, "The email subject text");    

it.setType("message/rfc822");    

startActivity(Intent.createChooser(it, "Choose Email Client"));  

 

 

//add extra

Intent it = new Intent(Intent.ACTION_SEND);  

it.putExtra(Intent.EXTRA_SUBJECT, "The email subject text");  

it.putExtra(Intent.EXTRA_STREAM, "file:///sdcard/mysong.mp3");  

sendIntent.setType("audio/mp3");  

startActivity(Intent.createChooser(it, "Choose Email Client"));

 

//play media

Intent it = new Intent(Intent.ACTION_VIEW);

Uri uri = Uri.parse("file:///sdcard/song.mp3");

it.setDataAndType(uri, "audio/mp3");

startActivity(it);

 

Uri uri = Uri.withAppendedPath(MediaStore.Audio.Media.INTERNAL_CONTENT_URI, "1");  

Intent it = new Intent(Intent.ACTION_VIEW, uri);  

startActivity(it); 

 

//Uninstall

Uri uri = Uri.fromParts("package", strPackageName, null);  

Intent it = new Intent(Intent.ACTION_DELETE, uri);  

startActivity(it);

 

//uninstall apk

Uri uninstallUri = Uri.fromParts("package", "xxx", null);

returnIt = new Intent(Intent.ACTION_DELETE, uninstallUri);

 

//install apk

Uri installUri = Uri.fromParts("package", "xxx", null);

returnIt = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri);

 

//play audio

Uri playUri = Uri.parse("file:///sdcard/download/everything.mp3");

returnIt = new Intent(Intent.ACTION_VIEW, playUri);

 

//send extra

Intent it = new Intent(Intent.ACTION_SEND); 

it.putExtra(Intent.EXTRA_SUBJECT, "The email subject text"); 

it.putExtra(Intent.EXTRA_STREAM, "file:///sdcard/eoe.mp3"); 

sendIntent.setType("audio/mp3"); 

startActivity(Intent.createChooser(it, "Choose Email Client"));

 

//search

Uri uri = Uri.parse("market://search?q=pname:pkg_name"); 

Intent it = new Intent(Intent.ACTION_VIEW, uri); 

startActivity(it); 

//where pkg_name is the full package path for an application 

 

//show program detail page

Uri uri = Uri.parse("market://details?id=app_id"); 

Intent it = new Intent(Intent.ACTION_VIEW, uri); 

startActivity(it); 

//where app_id is the application ID, find the ID 

//by clicking on your application on Market home 

//page, and notice the ID from the address bar

 

 

//search google

Intent intent = new Intent();

intent.setAction(Intent.ACTION_WEB_SEARCH);

intent.putExtra(SearchManager.QUERY,"searchString")

startActivity(intent);

 


출처 : https://snipt.net/Martin/tag/android/

 

//카카오톡 메세지 Intent

    

    try {

       KakaoLink kakaoLink = KakaoLink

              .getLink(getApplicationContext());

   

       // check, intent is available.

       if (!kakaoLink.isAvailableIntent()) {

           return;

       }

       /**

        * @param activity

        * @param url

        * @param message

        * @param appId

        * @param appVer

        * @param appName

        * @param encoding

        */

       kakaoLink.openKakaoLink(

              MainActivity.this,

              "http://link.kakao.com/?test-android-app",

              "First KakaoLink Message for send url.",

              getPackageName(),

              getPackageManager().getPackageInfo(

                     getPackageName(), 0).versionName,

              "KakaoLink Test App", "UTF-8");

    } catch (Exception e) {

       // TODO Auto-generated catch block

       e.printStackTrace();

    }



KakaoLink.java


'Programming > Android' 카테고리의 다른 글

다중 액티비티 예제  (0) 2013.03.23
안드로이드 레이아웃 예제  (0) 2013.03.16
안드로이드 실습  (0) 2013.03.09
ubuntu 에 jdk 간편하게 설치하기  (0) 2013.02.27
R.java import 에러  (0) 2012.11.27