kotlin

How do I programmatically get the current screen background color?

I write a simple program in kotlin. Creating an application that has one screen. The screen color is white, and the text fiel ... lement of the screen is called root_srl. I tried something like root_srl.getBackground (), but I didn't find anything similar

Injecting fields without the c Dagger 2 constructor

On the site with documentation for Dagger 2, there is the following example code and words: class CoffeeMaker { @Inject He ... In case the Heater object has not been created before? And if this is its object is it currently being used by another class?

How to translate code from Java to Kotlin?

Please tell me, was there such a code in the Java project before private static Queries q; private static SQLiteDatabase db; ... tion(), and can I call it as before in Java classes with this method? q = App.getQueriesInstance(getApplicationContext());

How to use the Gismeteo Token API?

Until today, I did not work with the api and I had a question about the use of the token. How to establish a connection to th ... eader.readLine() } return null } override fun onPostExecute(result: Void?) { super.onPostExecute(result) } }

How to wait for the end of the coroutine

I just started learning kotlin and korutin, so please do not swear too much for a stupid question. It is necessary to wait f ... ould be possible to press btnStop and stop cycle. But in my code, everything hangs during the loop, including all the Views.

How are Java and Kotlin going for mobile app and game development?

I've read a bunch of topics on this subject, but there are other questions from me already. What are the advantages of kno ... rm in general can you create games on J. + K.? Is it possible to create 3D games in these languages separately or together?

Change the color of radiobutton android elements

I have an alertdialog in which I create a radiogroup, how can I change the color of the text and the color of the radiobutton ... or.BLACK) } else{ dialog.getWindow()!!.setBackgroundDrawableResource(R.color.pole) } dialog.show() }

Intent.putExtra android Kotlin

Faced with a very simple problem, but I can not understand why it is not solved. There are two Activities, when passing from ... xt = dateInString } In him the variable id gets from MainActivity, and in onOptionItemSelected, does not want to get out.

Android Q, scoped storage

As you know, in Android Q (API=29), Google once again changed the rules for accessing external memory (external storage) and ... rd design: SQLiteDatabase db=SQLiteDatabase.openDatabase(file.getPath(), null, SQLiteDatabase.OPEN_READWRITE);

Enabling the fragment (item) in the recycler view)

There is a separate fragment with a Recyclerview. You need to "include" some items in the recycler view in order for it to di ... android:src="@drawable/ic_play_button"> </ImageView> </RelativeLayout> </LinearLayout>

Back arrow | Kotlin | Android

I have 2 activities. After switching from the first to the second, I want to display a back arrow in the AppBarLayout, which ... tivity. How do I do this? P. s: I need this because the back button toggles my menu, which is located in the activity itself.

Android countdown

Previously, in Java, I used scheduleAtFixedRate() to count down the time Is there anything new in Kotlin? And is there any ... solution... Update2 I think I understood, the second number is not the time when the timer ends, but the size of the tick?

Translating code from Kotlin to Java

I have the code on Kotlin (Android Studio 3.5): Class RadioPlayerActivity : AppCompatActivity() { private lateinit var pla ... iew){ playWhenReady = false; } } In the first case, the stream is played back. In the Java code-silence. What's wrong?

Changing the color of "label text" in the TextField. Material Design

Is it possible to set a specific color for all the states of the selected area in the blue rectangle? For example, the Erro ... all the components of the TextField red, but is it possible to make the selected area remain a specific color and not change?

How do I change the button text when clicked? kotlin

I have a function that triggers when a button is pressed: fun cellPress(view: View) { } How do I change the button ... ithout using findViewById<>()? Something like this: fun cellPress(view: View) { view.setText("text") }

BitConverter analog in Kotlin

In C#, there is a BitConverter c method ToInt32. Is there a similar analogue in Kotline?

It is not possible to link an Android application on Kotlin and a server on Python using a socket. help please

I wrote a server in Python and a client in Kotlin. When I launch an app in Android Studio and click on the button that should ... taOutputStream(socket.getOutputStream()) dout.writeUTF("Hello") dout.flush() dout.close() socket.close() }

Methods that use Context in arbitrary classes

I am studying Android development and came across a question. Let's say I create an arbitrary class and there I need to call ... se the findViewById method. What to do in such situations? Is it reasonable to pass Context to the constructor of this class?

Kotlin integration tests for spring-boot

What I have: there is a microservice on Spring boot, with the web and MongoDB as a storage. For integration tests, I use test ... runs/576320155?check_suite_focus=true The funny thing is that if you rewrite the tests and config in java, everything works)

Retrofit. POST. Android. Kotlin

There is a POST request to the server using the Retrofit library. If the request is successful, a certain object with data is ... d()) .subscribe({ view.onSuccessful() }, { view.onFailure(it.message!!) }) }