r/KotlinAndroid • u/samdsg1 • Jun 15 '21
r/KotlinAndroid • u/just_another_vente • Aug 02 '22
Anyone currently working in mobile app development and have a few minutes?
Hi all! I'm Lauren, I work for raywenderlich.com, and we have a survey going right now that we hope will help all developers working right now in the mobile app space. The results of this survey will help other developers better know their worth, no matter where in the world they are and we want to share that information for free with the community 😁
We need about 8 minutes of your time to help other mobile app developers by answering the survey here.
After answering questions about yourself, your professional experience, and your work with no personally identifying information, we'll compile all the information and release it for free to the community after September 15th, 2022. Still have questions on how we hope this will benefit users? Check out our article here all about it (or ask questions here).
In case you aren't a match for our survey but still want to help, please feel free to share the link with your network as well!
r/KotlinAndroid • u/Ole_Blue89 • Jan 18 '22
New to Kotlin
Is there anyone willing to teach me how to use kotlin using the xml files i have made?
r/KotlinAndroid • u/Konstantine9 • Dec 09 '20
Object movement when tilting phone.
I am very new with kotlin and Android Studio so can you help a bit.
My goal is to make an app that has a ball and textview on it. When tilting the phone, coordinates appear in textview. That I have managed. I need to have the ball on customview which is called in this case MyView. The ball should move according to the coordinates in textview.
I have no idea even how start this. All I know that I need to make the values match the movement of the ball and that I need to make some calculations that the ball doesn't go off screen or even off myview area. So can you give me some guidance?
All the ball does at the moment is moving where the user clicks.
My code so far:
import android.annotation.SuppressLint
import android.content.Context
import android.hardware.Sensor
import android.hardware.SensorEvent
import android.hardware.SensorEventListener
import android.hardware.SensorManager
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import kotlinx.android.synthetic.main.activity_main.*
class MainActivity : AppCompatActivity(), SensorEventListener {
private lateinit var sensorManager: SensorManager
private var mLight: Sensor? = null
@SuppressLint("ClickableViewAccessibility")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
sensorManager = getSystemService(Context.SENSOR_SERVICE) as SensorManager
mLight = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER)
myView.setOnTouchListener { view, e ->
myView.setXY(e.x, e.y)
true
}
}
override fun onAccuracyChanged(p0: Sensor?, p1: Int) {
// TODO("Not yet implemented")
}
override fun onSensorChanged(p0: SensorEvent) {
textView.text = p0.values[0].toString() + ", " + p0.values[1]+ ", " + p0.values[2] + ", "
}
override fun onPause() {
super.onPause()
sensorManager.unregisterListener(this)
}
override fun onResume() {
super.onResume()
mLight?.also { light ->
sensorManager.registerListener(this, light, SensorManager.SENSOR_DELAY_NORMAL)
}
}
}and MyView
import android.R.attr
import android.content.Context
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.util.AttributeSet
import android.view.View
class MyView(context: Context?, attrs: AttributeSet?) : View(context, attrs) {
var x1=0f
var y1=0f
override fun onDraw(canvas: Canvas?) {
//super.onDraw(canvas)
val paint = Paint()
paint.color = Color.MAGENTA
canvas?.drawOval(x1,y1,x1+100f,y1+100f, paint)
paint.style = Paint.Style.STROKE
paint.color = Color.BLACK
paint.strokeWidth = 5f
canvas?.drawOval(x1,y1,x1+100f,y1+100f, paint)
}
fun setXY(new_x: Float, new_y: Float) {
x1 = new_x
y1= new_y
invalidate()
}
}r/KotlinAndroid • u/MadProgrammer232 • Apr 25 '18
Kotlin’s Nothing: Its Usefulness in Generics
r/KotlinAndroid • u/ItA11FallsDown • Feb 02 '20
I can't get a data class to return correct values. Please Help!
I'm working on my first android application and I'm banging my head against the wall. I'm trying to get information from Google firestore and store it in a way that I can use it. I'm currently trying to store it in a data class. I can get the information with no problem. But when I try to return the Data class to another method, it only contains the default values and not the values that are being returned.
I've linked some of my code ( the things I feel are relevant). I'm using Anko for AsyncTasks as well. I've combed the Kotlin documentation and Stack Overflow and can't seem to find anything that address my problem. I'd really appreciate it if you guys could take a look at it and see if you see anything I don't know or may have missed.
Thank you!
r/KotlinAndroid • u/MadProgrammer232 • Jul 23 '18
Effective Java in Kotlin, obsolete items thanks to Kotlin (items 3, 4, 16, 40, 61 from 3rd edition)
r/KotlinAndroid • u/nl_expat • Feb 07 '19
How would you debug constructor of a data class
How would I put a break point in the constructor of a data class declared as follows:
data class Person(val name: String, val lastname: String)This would be inside android Studio.
Thanks.
r/KotlinAndroid • u/grogrogro1234 • Apr 15 '20
Animations in Jetpack Compose using Transition
r/KotlinAndroid • u/William_John_k • Dec 16 '20
Which programming language to choose from Java and Kotlin for Android Application Development?
r/KotlinAndroid • u/vaclavhodek • Apr 16 '21
Don't waste your time handling strings XML files manually on Android!
r/KotlinAndroid • u/coderchrome123456 • Aug 25 '19
Build a About Screen UI in Android Applications with Kotlin - Coding Shiksha - Coding Shiksha
r/KotlinAndroid • u/MugenIkari00 • Apr 24 '19
Problem with a RecyclerView and ItemTouchHelper
If you could answer this it would be awesome, thank you <3
r/KotlinAndroid • u/Alternative-Sky-4404 • Apr 02 '24
Good evening, a question, how can I refresh my application every 8 minutes, is that I am managing a token that is changed every 8 minutes.
r/KotlinAndroid • u/gnyangolo • Mar 01 '22
Convertion of String to Double or Int in Kotlin and android studio.
Hello , I hope you are all fine , i am new to kotlin and android studio. I am trying to to convert the string to interger or to double but for some reason android studio(4.1.2) does not recognize the .toDouble() or .toInt().
Here is a code snippet
fun computeTipAndTotal() {
val stringInTextField = binding.etBaseAmount.text.toString() val cost= stringInTextField.toInt()
}the .toInt() iturned red and is not recognized by the IDE.
Any leads will be helpful.
r/KotlinAndroid • u/MadProgrammer232 • Dec 12 '18
Why can inheritance be dangerous? The Perils of Inheritance
r/KotlinAndroid • u/EugeneAndroid • Jul 23 '20
Why People Do Not Adopt Kotlin for Android Development?
Hey crew!
I believe most in this subreddit is Kotlin fans. But I wonder do you ever heart about obstacles or even blockers to use Kotlin for Android development?
I'm interested in the evolution of the programming environment and started research about Java vs Kotlin for Android. So, happy to hear real-life stories from your practice.
Thanks in advance)
r/KotlinAndroid • u/ilteriskeskin • Nov 17 '18
FreeSoftware License Kotlin Android App
Hi, NokulSoft is a StartUp. NokulSoft, make open source and freesoftware license mobile and web app.
NokulSoft: http://nokulsoft.com
NokulSoft GitHub Repo: https://github.com/ilteriskesk/NokulSoft
r/KotlinAndroid • u/Abhishekraj2003 • Feb 24 '19
How to make a wallet in android app through Kotlin
I am doing a startup of an app so, I want to know how we can integrate wallet in android app
r/KotlinAndroid • u/nikunjshingalaa • Nov 10 '21