Android Dev update upgrade install to half auto flash

Source: Internet
Author: User

Title: Android Development Update upgrade installs to half auto-flashback,,, workaround, as follows (red for my new code)

/**
* Install APK file
*/
private void installapk ()
{
File Apkfile = new file (Msavepath, Mhashmap.get ("name")); Apkfile get the downloaded apk file.
if (!apkfile.exists ())
{
Return
}
String cmd = "chmod 777" +MSAVEPATH;
Try
        {
runtime.getruntime (). exec (cmd);
        }
catch (Exception e) {
e.printstacktrace ();
        }
Installing the APK file via intent
Intent i = new Intent (Intent.action_view);
i.setflags (Intent.flag_activity_new_task); Key, I do not add this sentence or will be installed to the general Flash, the following add this statement
I.setdataandtype (Uri.parse ("file://" + apkfile.tostring ()), "application/vnd.android.package-archive");
Mcontext.startactivity (i);
}

/*-----------------------------------------------------------*/

Common flag parameters for intent:

Flag_activity_clear_top: For example, the current stack situation is: A B C D. D jumps through intent to B at this point, if the intent adds flag_activity_clear_top tag, the stack becomes: A B. If you do not add this tag, the stack will become: A b C D B. That is, if the flag_activity_clear_top tag is added and the target activity already exists in the stack, the activity on top of that target activity will be ejected from the stack for destruction. This is similar to setting the launch mode of B to Singletask.

Flag_activity_new_task: For example, the case of stack 1 now is: A B C. C jumps to D through intent, and this intent adds a flag_activity_new_task tag, and if D this ACTIVITY adds a TASK affinity to the declaration in Manifest.xml, And unlike the affinity of stack 1, the system will first look for a task stack with the same task affinity as D, if it exists, press D into that stack, and if it does not, it will press it into the stack of a new D affinity.      If the TASK affinity of D is not set by default, or is the same as the affinity of stack 1, it will be pressed into the stack 1 and become: a B C D, so it is the same as the non-flag_activity_new_task tag effect. Note If you attempt to start an activity from a non-activity, such as starting an activity from a service, intent such as to add flag_activity_new_task tag.

Flag_activity_no_history: For example, now the stack condition is: A B C. C Jump to D through intent, this intent add flag_activity_no_history flag, then the interface displays the contents of D, but it does not press into the stack. If you press the back key, return to C, the case of the stack is: A B C. If you jump to E in D at this point, the stack becomes: A B C E, at which point the return key will return to C, because D is not pressed into the stack at all.

Flag_activity_single_top: Similar to the singletop of Launch mode above ACTIVITY. If a intent adds this flag, and the target activity of this intent is the activity at the top of the stack, then a new instance will not be pressed into the stack.

For reference, see:

Http://www.cnblogs.com/xiaoQLu/archive/2012/07/17/2595294.html

the Activation mode and flag detail of activity http://www.open-open.com/lib/view/open1345173373350.html

Android Dev update upgrade install to half auto flash

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.