I'm asking you this question because I couldn't concentrate in the process of creating and combining projects separately. The intent may not be the problem, but I checked with Log.d and found no other results, so the information does not seem to be transferred to the int. The error only states that the emulator does not run when running, so I'm asking you this question.
package com.example.user.intentproject01
import android.content.Intent import android.support.v7.app.AppCompatActivity import android.os.Bundle import kotlinx.android.synthetic.main.activity_main.*
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
```Part sent to intent
main_login_button.setOnClickListener {
var intent: Intent = Intent(this, RecyclerViewActivity::class.java);
startActivity(intent)
}
}
}
class RecyclerViewActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_recycler_view)
```Your Programming Language
// The part received as an int
var intent = intent
var intentData: Uri = intent.data
The main_recycler_view.setHasFixedSize(true) //recycled view has a fixed size.
var data:ArrayList<Item> = ArrayList()
varzino: Item = Item (R. drawable.benzino, "Beenzino 24:26")
varbridge: Item = Item (R.drawable.dok, "leg picture")
varcat: Item = Item (R.drawable.hwagi, "cat")
varsky: Item = Item (R. drawable.jaypark, "sky")
data.add(zino)
data.add(bridge)
data.add(cat)
data.add(sky)
//When using Linear Layout
var myLayoutmanager: RecyclerView.LayoutManager = LinearLayoutManager(this)
// When using staggeredGrid
/*var myLayoutmanager: RecyclerView.LayoutManager = StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL)
main_recycler_view.layoutManager = myLayoutmanager*/
main_recycler_view.adapter = MyAdapter(this, data)
Log.d ("", "Connect to adapter: " + this + data")
}
I didn't upload the definition of the adapter and item separately. If you know anything, please give me some advice.
kotlin intent
var intent: Intent = Intent(this, RecyclerViewActivity::class.java)
Intents generated in the above phrase do not contain uri data. Maybe that's why there's an error.
© 2024 OneMinuteCode. All rights reserved.