SoFunction
Updated on 2025-03-03

Detailed explanation of the example of Android simple jump page tool

Origin of the matter

activity or fragment Every time you jump to pass values, are you tired of that kind of parameter passing?
Then if there is extremely high data, your code will be miserable, and even under good design, it will be very uncomfortable. So today I recommend a tool to you
Compare with our native jump

Compare:

1. Comparison of jump methods

 Intenti=new Intent(this,); 
 startActivity(i);

vs

().start(this);
//send  Intenti=new Intent(this,);
  Bundle bundle = new Bundle();
  ("message", "123");
  ("Bundle", bundle);
  startActivity(i);
  //take over	String s=("message","");   

vs

	//send	().setMessage("123").start(this);
	//take over	(this);

AutoPage

github address /smartbackme/AutoPage
If you think it's good, give me a star
Easy jump tool for Android

Note: There must be two requirements as follows androidxkotlin & java

#########use#########
project: gradle configuration of the project

buildscript {
  repositories {
    maven { url '/297165331/AutoPage'}
  }

Add the following configuration in each module you need to do easy jump
Your project must support kapt
kotlin kapt

apply plugin: 'kotlin-kapt'

  implementation ':autopage:1.0.2'
  kapt ':autopage-processor:1.0.2'

Focus

@AutoPage can only mark Ap as prefix on fields or classes to quickly jump for you

kotlin:

The fields must be marked in @JvmField and @AutoPageonCreate Join in the page you need to jump (this)

java:

The field must be marked in @AutoPageonCreate Add to your page you need to jump (this)

################### Use ###########################################################################################################

Example 1

Simple jump

@AutoPage
class SimpleJump1Activity : AppCompatActivity() {
  override fun onCreate(savedInstanceState: Bundle?) {
    (savedInstanceState)
    setContentView(.activity_simple_jump1)
  }
}

Called later

().start(this)

Example 2

Simple jump and parameters

class MainActivity2 : AppCompatActivity() {

  @AutoPage
  @JvmField
  var message:String? = null

  override fun onCreate(savedInstanceState: Bundle?) {
    (savedInstanceState)
    setContentView(.activity_main2)
    (this)
    findViewById<TextView>().text = message
  }
}

Called later

().setMessage("123").start(this)

Example 3:

Jump with result

@AutoPage
class SimpleJumpResultActivity : AppCompatActivity() {
  override fun onCreate(savedInstanceState: Bundle?) {
    (savedInstanceState)
    setContentView(.activity_simple_jump_result)
  }

  override fun onBackPressed() {
    var intent = Intent()
    ("message","123")
    setResult(RESULT_OK,intent)
    ()
  }
}

Called later

().requestCode(1).start(this)

########## Use ################

class FragmentSimpleFragment : Fragment() {


  @AutoPage
  @JvmField
  var message:String? = null

  companion object {
    fun newInstance() = FragmentSimpleFragment()
  }

  private lateinit var viewModel: SimpleViewModel

  override fun onCreateView(
    inflater: LayoutInflater, container: ViewGroup?,
    savedInstanceState: Bundle?
  ): View {
    return (.simple_fragment, container, false)
  }

  override fun onActivityCreated(savedInstanceState: Bundle?) {
    (savedInstanceState)
    (this)
    viewModel = ViewModelProvider(this).get(SimpleViewModel::)
    view?.findViewById<TextView>()?.text = message

  }
}

Called later

().setMessage("134").build()

This is the end of this article about the Android Simple Jump Page Tool. For more information about Android Jump Page Tool, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!