posted by 네코냥이 2015. 4. 1. 15:41


Launch an application from another application on Android



Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.package.address");
startActivity(launchIntent);



Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(new ComponentName("com.package.address","com.package.address.MainActivity"));
startActivity(intent);


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

어플에서 SMS(문자) 전송 하기  (0) 2015.05.11
[스크랩] Activity Flag  (0) 2015.04.13
어플 종료  (0) 2015.04.01
안드로이드 Process Name 및 Id  (666) 2015.03.31
안드로이드 뷰 동적으로 마진주기  (0) 2015.03.15
posted by 네코냥이 2015. 4. 1. 15:37


How to exit an android app using code?




You can call System.exit(); to get out of all the acivities.

    submit=(Button)findViewById(R.id.submit);

            submit.setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View arg0) {
android.os.Process.killProcess(android.os.Process.myPid());
                    System.exit(1);

                }
            });
shareimprove this answer








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

[스크랩] Activity Flag  (0) 2015.04.13
다른 어플 실행  (0) 2015.04.01
안드로이드 Process Name 및 Id  (666) 2015.03.31
안드로이드 뷰 동적으로 마진주기  (0) 2015.03.15
브로드 캐스트 리시버 기본 사용예제.  (0) 2015.01.13
posted by 네코냥이 2015. 3. 31. 15:10



-----


No need to use grep. ps in Android can filter by COMM value (last 15 characters of the package name in case of java app)

Let's say we want to check if com.android.phone is running:

adb shell ps m.android.phone
USER     PID   PPID  VSIZE  RSS     WCHAN    PC         NAME
radio     1389  277   515960 33964 ffffffff 4024c270 S com.android.phone


-----


for (RunningAppProcessInfo runningProInfo : runningProcInfo) {

    int pid = runningProInfo.pid;

    Log.e(TAG+"-pid", ""+pid);

}


-----


http://developer.android.com/reference/android/app/ActivityManager.RunningAppProcessInfo.html


RunningAppProcessInfo 
public intimportanceThe relative importance level that the system places on this process.
public intimportanceReasonCodeThe reason for importance, if any.
public ComponentNameimportanceReasonComponentFor the specified values of importanceReasonCode, this is the name of the component that is being used in this process.
public intimportanceReasonPidFor the specified values of importanceReasonCode, this is the process ID of the other process that is a client of this process.
public intlastTrimLevelLast memory trim level reported to the process: corresponds to the values supplied toComponentCallbacks2.onTrimMemory(int).
public intlruAn additional ordering within a particular importance category, providing finer-grained information about the relative utility of processes within a category.
public intpidThe pid of this process; 0 if none
public String[]pkgListAll packages that have been loaded into the process.
public StringprocessNameThe name of the process that this object is associated with
public intuidThe user id of this process.



---------



Is process name same as package name in android?




By default android takes the package name as the process name. But if you define process property in application tag in manifest file android:process="com.example.newprocessname" then the application will run with this name "com.example.newprocessname".

As for your questions,

Hope this answers your question!

shareimprove this answer



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

다른 어플 실행  (0) 2015.04.01
어플 종료  (0) 2015.04.01
안드로이드 뷰 동적으로 마진주기  (0) 2015.03.15
브로드 캐스트 리시버 기본 사용예제.  (0) 2015.01.13
안드로이드 AIDL  (0) 2015.01.13
posted by 네코냥이 2015. 3. 15. 09:34




How to set margin dynamically in Android_ - Stack Overflow.pdf













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

어플 종료  (0) 2015.04.01
안드로이드 Process Name 및 Id  (666) 2015.03.31
브로드 캐스트 리시버 기본 사용예제.  (0) 2015.01.13
안드로이드 AIDL  (0) 2015.01.13
[Android] 전화걸기  (0) 2014.11.28
posted by 네코냥이 2015. 1. 13. 17:36


#24 Broadcast Receiver로 문자(SMS) 수신해보자 __ 미르의 IT 정복기.pdf


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

안드로이드 Process Name 및 Id  (666) 2015.03.31
안드로이드 뷰 동적으로 마진주기  (0) 2015.03.15
안드로이드 AIDL  (0) 2015.01.13
[Android] 전화걸기  (0) 2014.11.28
[안드로이드] 키보드 숨기기.  (0) 2014.11.27
posted by 네코냥이 2015. 1. 13. 13:47



Thinker __ Android AIDL(Android Interface description language).pdf



[android_안드로이드] aidl 을 이용하여 service 에 bind 하기.pdf



Holic Spirit __ Tistory Edition __ 안드로이드 리모트 서비스 만들기 #1.pdf


posted by 네코냥이 2014. 11. 28. 11:34


/****************************************************************/


public class TelCall extends Activity {

    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.telcall);

    }

 

    public void mOnClick(View v) {

        Uri number;

        Intent intent;

        number = Uri.parse("tel:000-000-0000"); // 번호 수정해주시면 됩니다.

        intent = new Intent(Intent.ACTION_DIAL, number); // ACTION_CALL : 바로걸기

        startActivity(intent);

        break;

    }

}


/****************************************************************/


posted by 네코냥이 2014. 11. 27. 15:57

private void particle_HideKeyboard() {

if(getCurrentFocus()!=null) {

        InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);

        inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);

    }

}

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

안드로이드 AIDL  (0) 2015.01.13
[Android] 전화걸기  (0) 2014.11.28
Adding View to RemoteViews in Android  (0) 2014.11.18
Adding the AppWidgetProviderInfo Metadata  (0) 2014.11.18
하나에 App에 다수의 App Widget  (0) 2014.11.18
posted by 네코냥이 2014. 11. 22. 11:24


iterator - Iterating hashtable in java - Stack Overflow.pdf


'JAVA > JAVA' 카테고리의 다른 글

SimpleDateFormat 예제  (299) 2014.10.23
[JAVA] XPATH를 이용한 XML 파싱  (0) 2014.09.16
자바 정규식 표현  (0) 2014.08.27
[자바] 형변환 캐스팅  (0) 2014.08.26
[JAVA] Random 클래스 (자바 램덤 클래스)  (0) 2013.06.13
posted by 네코냥이 2014. 11. 18. 17:51
RemoteViews update = new RemoteViews(context.getPackageName(), R.layout.widget_layout);
    for (int i = 0; i < 3; i++) {
        RemoteViews textView = new RemoteViews(context.getPackageName(), R.layout.test);
        textView.setTextViewText(R.id.textView1, "TextView number " + String.valueOf(i));
        update.addView(R.id.ll_widget, textView);
    }

    appWidgetManager.updateAppWidget(appWidgetIds, update);