title: Global object declaration in kotlin
body: <p>How to declare objects globally in <em>kotlin</em> like in java  <code>TextView tv;</code>.</p>
  
  <p>Or any method to call the same variable in different methods/functions.</p>
  
  <pre><code>override fun onCreate(savedInstanceState: Bundle?) {
      super.onCreate(savedInstanceState)
      setContentView(R.layout.activity_main)
  
      val textView: TextView = findViewById(R.id.texfirst) as TextView 
  
      textView.setOnClickListener {
          Toast.makeText(applicationContext,"Welcome to Kotlin ! $abc "+textView.text, Toast.LENGTH_LONG).show()
      }
  
      myFunction(textView)
  }
  
  fun myFunction(mtextv : TextView) {
      Toast.makeText(applicationContext,"This is  new  $abc "+mtextv.text, Toast.LENGTH_LONG).show()
  }
  </code></pre>
  
  <p>See the above code I've separate function with parameter of <code>TextView</code>. I want the <code>TextView</code> object at second function. My question is: Is it possible to call function without parameter and am I able to get <code>TextView</code> object at <code>myFunction()</code>.</p>
  
  <p>Learning kotlin in android studio. Hope question is clear .</p>