Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

Can I use Android Studio for Systemizer project?

Would like to avoid setting up IntelliJ when I already have Android Studio. But I am not getting any output for the first exercise except Hello World! Here is my code below. I do have Systemizer class and java files in place. <br><br>

package com.joshbgold.systemizer;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import java.util.Set;
import java.util.TreeSet;

public class MainActivity extends AppCompatActivity {

    public static void main(String[] args) {
        System.out.printf("This is the classpath:  %s %n",
                System.getProperty("java.class.path"));
        Set<String> propNames = new TreeSet<String>(System.getProperties().stringPropertyNames());
        for (String propertyName : propNames) {
            System.out.printf("%s is %s %n",
                    propertyName,
                    System.getProperty(propertyName));
        }

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}
Ben Deitch
Ben Deitch
Treehouse Teacher

Android doesn't use a 'main' function. Id' try putting the code into the bottom of onCreate.

Hello Ben, I previously tried putting the code into the onCreate method. I didn't get any output from that. Maybe because I am not passing in the required String[] args?

Ok, what I was thinking would be a shortcut (just using Android Studio) was not a shortcut. I just installed IntelliJ and completed the task successfully. Thanks for your recommendation Ben that allowed me to move forward!

1 Answer

Ben Deitch
STAFF
Ben Deitch
Treehouse Teacher

Hmm not sure. I'd probably just do it in IntelliJ. Android Studio isn't great for Java development.