¡@

Home 

2014/10/16 ¤W¤È 08:11:20

android Programming Glossary: componentname

How to change an application icon programmatically in Android?

http://stackoverflow.com/questions/1103027/how-to-change-an-application-icon-programmatically-in-android

getPackageManager .setComponentEnabledSetting new ComponentName ru.quickmessage.pa ru.quickmessage.pa.MainActivity Red PackageManager.COMPONENT_ENABLED_STATE_ENABLED..

Determining the current foreground application from a background task or service

http://stackoverflow.com/questions/2166961/determining-the-current-foreground-application-from-a-background-task-or-service

info.processName result info break return result private ComponentName getActivityForApp RunningAppProcessInfo target ComponentName.. getActivityForApp RunningAppProcessInfo target ComponentName result null ActivityManager.RunningTaskInfo info if target null.. boolean isStillActive RunningAppProcessInfo process ComponentName activity activity can be null in cases where one app starts..

Open another application from your own (intent)

http://stackoverflow.com/questions/2780102/open-another-application-from-your-own-intent

with with category LAUNCHER action MAIN componentName new ComponentName packageName name and setFlags Intent.FLAG_ACTIVITY_NEW_TASK..

Restful API service

http://stackoverflow.com/questions/3197335/restful-api-service

ServiceConnection public void onServiceConnected ComponentName className IBinder boundService restfulService IRestfulService.Stub.asInterface.. catch RemoteException e public void onServiceDisconnected ComponentName className restfulService null private IRemoteServiceCallback..

Android: java.lang.SecurityException: Permission Denial: start Intent

http://stackoverflow.com/questions/4162447/android-java-lang-securityexception-permission-denial-start-intent

the below code Intent i new Intent i.setComponent new ComponentName com.fsck.k9 com.fsck.k9.activity.MessageList i.putExtra account..

Example: Communication between Activity and Service using Messaging

http://stackoverflow.com/questions/4300291/example-communication-between-activity-and-service-using-messaging

import android.app.Activity import android.content.ComponentName import android.content.Context import android.content.Intent.. new ServiceConnection public void onServiceConnected ComponentName className IBinder service mService new Messenger service textStatus.setText.. do anything with it public void onServiceDisconnected ComponentName className This is called when the connection with the service..

Allow user to select camera or gallery for image

http://stackoverflow.com/questions/4455558/allow-user-to-select-camera-or-gallery-for-image

new Intent camIntent finalIntent.setComponent new ComponentName res.activityInfo.packageName res.activityInfo.name yourIntentsList.add.. new Intent gallIntent finalIntent.setComponent new ComponentName res.activityInfo.packageName res.activityInfo.name yourIntentsList.add..

Lock the android device programatically

http://stackoverflow.com/questions/4545079/lock-the-android-device-programatically

Controller extends Activity DevicePolicyManager mDPM ComponentName mDeviceAdminSample protected void onCreate Bundle savedInstanceState.. Context.DEVICE_POLICY_SERVICE mDeviceAdminSample new ComponentName Controller.this adminActivity.class To lock the device write..

Android “Only the original thread that created a view hierarchy can touch its views.”

http://stackoverflow.com/questions/5161951/android-only-the-original-thread-that-created-a-view-hierarchy-can-touch-its-vi

new ServiceConnection public void onServiceConnected ComponentName className IBinder rawBinder appService MPService.LocalBinder.. Thread Song.this .start public void onServiceDisconnected ComponentName classname appService null public void onCreate Bundle savedInstanceState..

Enable and disable a Broadcast Receiver

http://stackoverflow.com/questions/5624470/enable-and-disable-a-broadcast-receiver

PackageManager pm getApplicationContext .getPackageManager ComponentName componentName new ComponentName com.app .broadcast_receivers.OnNetworkChangedReceiver.. .getPackageManager ComponentName componentName new ComponentName com.app .broadcast_receivers.OnNetworkChangedReceiver pm.setComponentEnabledSetting.. PackageManager.COMPONENT_ENABLED_STATE_DISABLED ComponentName component new ComponentName EditPreferences.this OnBootReceiver.class..

Open another application from your own (intent)

http://stackoverflow.com/questions/2780102/open-another-application-from-your-own-intent

another intent with with category LAUNCHER action MAIN componentName new ComponentName packageName name and setFlags Intent.FLAG_ACTIVITY_NEW_TASK..

Enable and disable a Broadcast Receiver

http://stackoverflow.com/questions/5624470/enable-and-disable-a-broadcast-receiver

this PackageManager method setComponentEnabledSetting componentName PackageManager.COMPONENT_ENABLED_STATE_DISABLED PackageManager.DONT_KILL_APP.. pm getApplicationContext .getPackageManager ComponentName componentName new ComponentName com.app .broadcast_receivers.OnNetworkChangedReceiver.. pm.setComponentEnabledSetting componentName PackageManager.COMPONENT_ENABLED_STATE_DISABLED PackageManager.DONT_KILL_APP..

Launching an Android Application from the Browser

http://stackoverflow.com/questions/6139508/launching-an-android-application-from-the-browser

Intent intent new Intent Intent.ACTION_MAIN ComponentName componentName new ComponentName org.example org.example.HelloAndroidActivity.. org.example.HelloAndroidActivity intent.setComponent componentName intent.setFlags Intent.FLAG_ACTIVITY_NEW_TASK intent.setData..

Adding widgets to a launcher page without bindAppWidgetId()

http://stackoverflow.com/questions/9746173/adding-widgets-to-a-launcher-page-without-bindappwidgetid

launcher uses appWidgetManager.bindAppWidgetId appWidgetId componentName to add widgets which apparently only system apps have permission..

How to change an application icon programmatically in Android?

http://stackoverflow.com/questions/1103027/how-to-change-an-application-icon-programmatically-in-android

alias 3 . Set programmatically ENABLE attribute for necessary getPackageManager .setComponentEnabledSetting new ComponentName ru.quickmessage.pa ru.quickmessage.pa.MainActivity Red PackageManager.COMPONENT_ENABLED_STATE_ENABLED PackageManager.DONT_KILL_APP..

Determining the current foreground application from a background task or service

http://stackoverflow.com/questions/2166961/determining-the-current-foreground-application-from-a-background-task-or-service

isRunningService info.processName result info break return result private ComponentName getActivityForApp RunningAppProcessInfo target ComponentName result null ActivityManager.RunningTaskInfo info if target.. result info break return result private ComponentName getActivityForApp RunningAppProcessInfo target ComponentName result null ActivityManager.RunningTaskInfo info if target null return null if mActivityManager null mActivityManager ActivityManager.. result info.topActivity break return result private boolean isStillActive RunningAppProcessInfo process ComponentName activity activity can be null in cases where one app starts another. for example astro starting rock player when a move..

Open another application from your own (intent)

http://stackoverflow.com/questions/2780102/open-another-application-from-your-own-intent

get the packageName and name Finally create another intent with with category LAUNCHER action MAIN componentName new ComponentName packageName name and setFlags Intent.FLAG_ACTIVITY_NEW_TASK Finally context.startActivity newIntent share improve this..

Restful API service

http://stackoverflow.com/questions/3197335/restful-api-service

Toast.LENGTH_SHORT .show class RestfulServiceConnection implements ServiceConnection public void onServiceConnected ComponentName className IBinder boundService restfulService IRestfulService.Stub.asInterface IBinder boundService try restfulService.registerCallback.. boundService try restfulService.registerCallback mCallback catch RemoteException e public void onServiceDisconnected ComponentName className restfulService null private IRemoteServiceCallback mCallback new IRemoteServiceCallback.Stub public void userLogIn..

Android: java.lang.SecurityException: Permission Denial: start Intent

http://stackoverflow.com/questions/4162447/android-java-lang-securityexception-permission-denial-start-intent

have to start 'MessageList' activity of K9mail.To do so i wrote the below code Intent i new Intent i.setComponent new ComponentName com.fsck.k9 com.fsck.k9.activity.MessageList i.putExtra account accUuid i.putExtra folder accFolder startActivity i which..

Example: Communication between Activity and Service using Messaging

http://stackoverflow.com/questions/4300291/example-communication-between-activity-and-service-using-messaging

src com.exampleservice MainActivity.java package com.exampleservice import android.app.Activity import android.content.ComponentName import android.content.Context import android.content.Intent import android.content.ServiceConnection import android.os.Bundle.. super.handleMessage msg private ServiceConnection mConnection new ServiceConnection public void onServiceConnected ComponentName className IBinder service mService new Messenger service textStatus.setText Attached. try Message msg Message.obtain.. e In this case the service has crashed before we could even do anything with it public void onServiceDisconnected ComponentName className This is called when the connection with the service has been unexpectedly disconnected process crashed. mService..

Allow user to select camera or gallery for image

http://stackoverflow.com/questions/4455558/allow-user-to-select-camera-or-gallery-for-image

camIntent 0 for ResolveInfo res listCam final Intent finalIntent new Intent camIntent finalIntent.setComponent new ComponentName res.activityInfo.packageName res.activityInfo.name yourIntentsList.add finalIntent List ResolveInfo listGall packageManager.queryIntentActivities.. gallIntent 0 for ResolveInfo res listGall final Intent finalIntent new Intent gallIntent finalIntent.setComponent new ComponentName res.activityInfo.packageName res.activityInfo.name yourIntentsList.add finalIntent I wrote this directly here so this may..

Lock the android device programatically

http://stackoverflow.com/questions/4545079/lock-the-android-device-programatically

adminActivity extends DeviceAdminReceiver public static class Controller extends Activity DevicePolicyManager mDPM ComponentName mDeviceAdminSample protected void onCreate Bundle savedInstanceState super.onCreate savedInstanceState mDPM DevicePolicyManager.. savedInstanceState mDPM DevicePolicyManager getSystemService Context.DEVICE_POLICY_SERVICE mDeviceAdminSample new ComponentName Controller.this adminActivity.class To lock the device write the code in the event where you use to lock if active mDPM.lockNow..

Android “Only the original thread that created a view hierarchy can touch its views.”

http://stackoverflow.com/questions/5161951/android-only-the-original-thread-that-created-a-view-hierarchy-can-touch-its-vi

private MediaPlayer mp ... private ServiceConnection onService new ServiceConnection public void onServiceConnected ComponentName className IBinder rawBinder appService MPService.LocalBinder rawBinder .getService service that handles the MediaPlayer.. title progress.setMax mp.getDuration new Thread Song.this .start public void onServiceDisconnected ComponentName classname appService null public void onCreate Bundle savedInstanceState super.onCreate savedInstanceState setContentView..

Enable and disable a Broadcast Receiver

http://stackoverflow.com/questions/5624470/enable-and-disable-a-broadcast-receiver

can not enable it. I call the method from inside a service. PackageManager pm getApplicationContext .getPackageManager ComponentName componentName new ComponentName com.app .broadcast_receivers.OnNetworkChangedReceiver pm.setComponentEnabledSetting componentName.. from inside a service. PackageManager pm getApplicationContext .getPackageManager ComponentName componentName new ComponentName com.app .broadcast_receivers.OnNetworkChangedReceiver pm.setComponentEnabledSetting componentName PackageManager.COMPONENT_ENABLED_STATE_DISABLED.. false int flag enabled PackageManager.COMPONENT_ENABLED_STATE_ENABLED PackageManager.COMPONENT_ENABLED_STATE_DISABLED ComponentName component new ComponentName EditPreferences.this OnBootReceiver.class getPackageManager .setComponentEnabledSetting component..

Open another application from your own (intent)

http://stackoverflow.com/questions/2780102/open-another-application-from-your-own-intent

the ActivityInfo get the packageName and name Finally create another intent with with category LAUNCHER action MAIN componentName new ComponentName packageName name and setFlags Intent.FLAG_ACTIVITY_NEW_TASK Finally context.startActivity newIntent share..

Enable and disable a Broadcast Receiver

http://stackoverflow.com/questions/5624470/enable-and-disable-a-broadcast-receiver

I try to enable and disable a broadcast receiver by using this PackageManager method setComponentEnabledSetting componentName PackageManager.COMPONENT_ENABLED_STATE_DISABLED PackageManager.DONT_KILL_APP The broadcast receiver is registered in the.. it. I call the method from inside a service. PackageManager pm getApplicationContext .getPackageManager ComponentName componentName new ComponentName com.app .broadcast_receivers.OnNetworkChangedReceiver pm.setComponentEnabledSetting componentName PackageManager.COMPONENT_ENABLED_STATE_DISABLED.. componentName new ComponentName com.app .broadcast_receivers.OnNetworkChangedReceiver pm.setComponentEnabledSetting componentName PackageManager.COMPONENT_ENABLED_STATE_DISABLED PackageManager.DONT_KILL_APP Android manifest receiver android name .broadcast_receivers.OnNetworkChangedReceiver..

Launching an Android Application from the Browser

http://stackoverflow.com/questions/6139508/launching-an-android-application-from-the-browser

I try to start the intent directly with something similar to Intent intent new Intent Intent.ACTION_MAIN ComponentName componentName new ComponentName org.example org.example.HelloAndroidActivity intent.setComponent componentName intent.setFlags Intent.FLAG_ACTIVITY_NEW_TASK.. ComponentName componentName new ComponentName org.example org.example.HelloAndroidActivity intent.setComponent componentName intent.setFlags Intent.FLAG_ACTIVITY_NEW_TASK intent.setData Uri.parse ex1 helloworld intent.addCategory Intent.CATEGORY_BROWSABLE..

Adding widgets to a launcher page without bindAppWidgetId()

http://stackoverflow.com/questions/9746173/adding-widgets-to-a-launcher-page-without-bindappwidgetid

screen which causes a crash. The crash is because the stock launcher uses appWidgetManager.bindAppWidgetId appWidgetId componentName to add widgets which apparently only system apps have permission to do . So my question is what is the correct way for a..