1. Are you ready for the Galaxy S20? Here is everything we know so far!

MainActivity setup creates different code on startup

Discussion in 'Android Development' started by JXWD, Jun 18, 2019.

  1. JXWD

    JXWD Lurker
    Thread Starter

    Hi just setting out need a little pointer please...

    One I go though all the setup in android studio 3.1.2 I get:

    package com.example.simplelogin

    ...
    class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)
    }
    }



    Where as all the tutorials I open start something like below:

    is this the equivalent? why is it different? Thanks -Hagen



    package com.example.sairamkrishna.myapplication;

    ...


    public class MainActivity extends Activity {


    @override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    }

    }
     

    Advertisement

  2. Deleted User

    Deleted User Guest

    The difference is because you have created a project using the Kotlin programming language, as opposed to Java.

    The example code you're seeing is different, because that code is Java. If you recreate the project, using the Java option, the example should be just about the same as your code.
     
    JXWD and 23tony like this.
Loading...
Similar Threads - MainActivity setup creates
  1. Mikabella
    Replies:
    3
    Views:
    131
  2. GAMESHARQ
    Replies:
    7
    Views:
    298
  3. Nayeem Pervez
    Replies:
    3
    Views:
    328
  4. ZepTepi
    Replies:
    6
    Views:
    381
  5. Rgarner
    Replies:
    4
    Views:
    517
  6. another_bald_eagle
    Replies:
    8
    Views:
    707
  7. SomeRandom12YearOldHacker
    Replies:
    1
    Views:
    121
  8. JimPalik
    Replies:
    0
    Views:
    261
  9. UnknownBoy
    Replies:
    0
    Views:
    276
  10. ericosman
    Replies:
    2
    Views:
    789

Share This Page

Loading...