Android: Invoke activity and permission denial:starting Intent error resolution in other programs

Source: Internet
Author: User

To debug multiple task stacks today, invoke the activity of another program in the test program,

The code snippet is as follows:

[Java]View Plaincopy
  1. btnstartx= (Button) Findviewbyid (R.ID.BTNSTARTX);
  2. Btnstartx.setonclicklistener (new View.onclicklistener () {
  3. @Override   
  4. Public void OnClick (View v) {
  5. //TODO auto-generated method stub   
  6. Intent myintent = new Intent ();
  7. Myintent.addflags (Intent.flag_activity_new_task);
  8. Myintent.setclassname ("Com.linc.TestBackStackXYZ",
  9. "Com.linc.TestBackStackXYZ.ActivityX"  );
  10. StartActivity (myintent);
  11. }
  12. );

Result Error:

from:http://blog.csdn.net/lincyang/article/details/6801381 [HTML]View Plaincopy
    1. java.lang.SecurityException:Permission denial:starting Intent { flg=0x10000000 cmp=com. Linc. testbackstackxyz/. Activityx} from Processrecord{406f5a18 370:com.linc.testbackstack/10042} (pid=370 , uid=10042) requires null

Began to think is the reason for permission, looked up again permission no results. Later, because Activityx did not join the action in the Manifast file definition, the following definition would be fine:

[HTML]View Plaincopy
  1. < Activity android:name="activityx" android:label=" Activityx ">
  2. < Intent-filter >    
  3. < Action android:name="Android.intent.action.MAIN" />
  4. </ Intent-filter >   
  5. </ Activity >   

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.