Showing posts with label android studio. Show all posts
Showing posts with label android studio. Show all posts

Monday 17 August 2020

Add Azure Devops plugins in Android Studio for Git or TFVC Version control

 By default, Android studio can not connect to the Azure devops source codes. To connect to the Azure devops, a plugins by Microsoft needs to be installed in the android studio. To install the plugin, follow the below steps:


1) Open a project in Android studio
2) go to File --> Setting
3) go to Plugins
4) Search for azure devops
5) Click Install
6) Restart the Android studio.
7) Menu->VCS->Checkout from Version Control -> Azure Devops Git
8)Click Sign in ... 
9) Follow the wizard to connect the project.

Tuesday 11 August 2020

Scrollable readonly EditView in Kotlin

 Scrollable readonly EditView in Kotlin


In the view xml file: 
<EditText
        android:id="@+id/etResult"
        android:layout_width="match_parent"
        android:layout_height="343dp"
        android:background="@color/backgroundColor"
        android:backgroundTint="#00000000"
        android:ems="10"
        android:enabled="true"
        android:fontFamily="sans-serif-condensed"
        android:gravity="start|top"
        android:hint="@string/blankfoldermessage"
        android:importantForAutofill="no"
        android:inputType="none"
        android:paddingTop="2dp"
        android:singleLine="false"
        tools:targetApi="o" />

in the kotlin file (init function): 
etResult.keyListener = null


this will allow the edit text to be multiline, not editable but scrollable. 

Wednesday 5 August 2020

Simple use of Timer in Kotlin


the code below will set the button to clickable after 30 sec:

btnOk.isClickable=false
Timer().schedule(timerTask {

    btnOk.isClickable=true

}, 1000*30)

the above code runs in a separate thread, 
so the UI is responsive while running this code.

Working with UI controls from Non main thread in Kotlin


import org.jetbrains.anko.doAsync
import org.jetbrains.anko.uiThread


fun anyFunction(){
doAsync {
      // Normal code inside Async thread
      I=I+1
     If(I=100){

    uiThread {

        tvResult.setText =”I is now 100!!”
      }
    }
   //More code
   If(x==0){
     uiThread {

        tvResult.setText =”there’s some problem!”
      }
   }


}
}

Note: - you can include multiple uiThread inside same doAsync
          - you can include multiple doAsync inside any function

How to delete Local_lvm storage and resize local storage to use full disk space?

1) Delete the Local_lvm from othe proxmox interface . "datacenter" > Storage. Select the local_lvm storage and click "Remo...