Android activity jump value passing problem research, androidactivity

Source: Internet
Author: User

Android activity jump value passing problem research, androidactivity
Java code 

  1. Intent = new Intent ();
  2. Intent. setClass (LoginActivity. this, RegActivity. class );
Java code  
  1. StartActivity (intent );

Because I just learned android, I don't know where to start in many cases!

However, I once remembered that my teacher said this sentence!

Regardless of the programming language, you can make a simple login! It's a basic entry!

So I did an android login test!

 

But it is running! I want to get a button for "register!

Then, it is similar to the previous page! Jump to another page!

Android jumps through activity!

 

Here.

I just want to share some of my personal understandings and problems encountered in this case with you!

Intent must be used for redirection. Remember! StartActivity (intent );

I have already posted the code!

But pay attention to the class you want to jump to in setclass! The former is generally in this class! The latter is where you want to jump to the class!

 

Is it that simple?

No!

Java code  
  1. <? Xml version = "1.0" encoding = "UTF-8"?>
  2. <Manifest xmlns: android = "http://schemas.android.com/apk/res/android"
  3. Package = "com. vt. demo. login" android: versionCode = "1"
  4. Android: versionName = "1.0" type = "codeph" text = "/codeph">
  5. <Application android: icon = "@ drawable/icon" android: label = "@ string/app_name">
  6. <Activity android: name = ". LoginActivity" android: label = "@ string/app_name">
  7. <Intent-filter>
  8. <Action android: name = "android. intent. action. MAIN"/>
  9. <Category android: name = "android. intent. category. LAUNCHER"/>
  10. </Intent-filter>
  11. </Activity>
  12. <Activity android: name = ". RegActivity" android: label = "@ string/app_name">
  13. <Intent-filter>
  14. <Action android: name = "android. intent. action. MAIN"/>
  15. <Category android: name = "android. intent. category. LAUNCHER"/>
  16. </Intent-filter>
  17. </Activity>
  18. </Application>
  19. <Uses-sdk android: minSdkVersion = "8"/>
  20. </Manifest>

 

Add an activity to the AndroidManifest. xml file. Note android: name = ". RegActivity"

The name of this name is the name of your class. It is actually your path! Remember that there is a dot before!

 

Remember to refresh it! The system has automatically created an index page in the R. java file! Don't refresh! Errors may occur.


Question about redirect value transfer for android development activity

Use Intent to implement interaction between the four major components.

Android: After Activity A jumps to B, B passes the value to A, and then A jumps to C. C returns the value to A, which is the value of B and C to be saved by.

Use startActivityForResult in a to start B. After exiting B, A can be connected to B. Before redirecting to C, use intent to pass the value transmitted by B together, or disable, it also uses startActivityForResult to start C. After C is disabled, the value is returned to.

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.