FileDocCategorySizeDatePackage
InstallAppProgress.javaAPI DocAndroid 1.5 API4335Wed May 06 22:42:46 BST 2009com.android.packageinstaller

InstallAppProgress

public class InstallAppProgress extends android.app.Activity
This activity corresponds to a download progress screen that is displayed when the user tries to install an application bundled as an apk file. The result of the application install is indicated in the result code that gets set to the corresponding installation status codes defined in PackageManager. If the package being installed already exists, the existing package is replaced with the new one.

Fields Summary
private final String
TAG
private boolean
localLOGV
private android.content.pm.ApplicationInfo
mAppInfo
private android.net.Uri
mPackageURI
private android.widget.ProgressBar
mProgressBar
private final int
INSTALL_COMPLETE
private android.os.Handler
mHandler
Constructors Summary
Methods Summary
public voidinitView()

        requestWindowFeature(Window.FEATURE_NO_TITLE);
        String unknown =  getString(R.string.unknown);
        setContentView(R.layout.op_progress);
        //initialize views
        PackageUtil.initAppSnippet(this, mAppInfo, R.id.app_snippet);
        TextView installTextView = (TextView)findViewById(R.id.center_text);
        installTextView.setText(R.string.installing);
        mProgressBar = (ProgressBar) findViewById(R.id.progress_bar);
        mProgressBar.setIndeterminate(true);
        // Set flag to replace package if already existing
        int installFlags = 0;
        PackageManager pm = getPackageManager();
        try {
            PackageInfo pi = pm.getPackageInfo(mAppInfo.packageName, 
                    PackageManager.GET_UNINSTALLED_PACKAGES);
            if(pi != null) {
                installFlags |= PackageManager.REPLACE_EXISTING_PACKAGE;
            }
        } catch (NameNotFoundException e) {
        }
        if((installFlags & PackageManager.REPLACE_EXISTING_PACKAGE )!= 0) {
            Log.w(TAG, "Replacing package:"+mAppInfo.packageName);
        }
        PackageInstallObserver observer = new PackageInstallObserver();
        pm.installPackage(mPackageURI, observer, installFlags);
    
public voidonCreate(android.os.Bundle icicle)

    
    
        
        super.onCreate(icicle);
        Intent intent = getIntent();
        mAppInfo = intent.getParcelableExtra(PackageUtil.INTENT_ATTR_APPLICATION_INFO);
        mPackageURI = intent.getData();
        initView();
    
voidsetResultAndFinish(int retCode)

        Intent data = new Intent();
        setResult(retCode);
        finish();