Skip to content

Instantly share code, notes, and snippets.

@johanneslagos
Last active March 26, 2018 12:11
Show Gist options
  • Save johanneslagos/081099327c4a30930ceda4594d0868b6 to your computer and use it in GitHub Desktop.
Save johanneslagos/081099327c4a30930ceda4594d0868b6 to your computer and use it in GitHub Desktop.
Launch
package no.vinmonopolet.searc
import android.app.Activity
import android.content.Intent
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_search.*
const val SEARCH_QUERY_STRING= "SEARCH_QUERY_STRING"
class SearchActivity : AppCompatActivity() {
companion object {
fun launch(fromActivity: Activity, query: String?){
val intent = Intent(fromActivity, SearchActivity::class.java)
query.let { intent.putExtra(SEARCH_QUERY_STRING, query) }
fromActivity.startActivity(intent)
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_search)
setSupportActionBar(toolbar)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
supportActionBar?.setHomeButtonEnabled(true)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment