Last active
March 26, 2018 12:11
-
-
Save johanneslagos/081099327c4a30930ceda4594d0868b6 to your computer and use it in GitHub Desktop.
Launch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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