AVD problem in creating an interface with Java

+2 Bharatt Kukreja · January 9, 2016
In tutorial 13 (Creating an interface with Java), I did everything what Bucky did. However when I run the app in my AVD, it says "Allison has stopped working" and quits the application. I don't know why this is happening. I have been on this for long. Can someone please help me!

Post a Reply

Replies

Oldest  Newest  Rating
0 Gary Whitney · January 9, 2016
Is allison the name of your app or activity?

The logCat should tell you the line where the error is occurring.

My notes from that tutorial indicates the activity extended ActionBar Activity.

API23  is Marshmallow and a lot has changed including the blank activity, which now includes a floating action icon.
API 23 did away with the action bar in favor of a tool bar.
Try this:
* Create an Empty Activity.
* Don't change the type of activity i.e. leave AppCompat
* See that little droid icon with 23 next to it. Change it to 21. That is what was used at the time the tutorials were created.

Now paste your code for the tutorial
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        //Layout
        RelativeLayout buckysLayout = new RelativeLayout(this);

        //Button
        Button redButton = new Button(this);

        //Add widget to layout(button is now a child of layout)
        buckysLayout.addView(redButton);

        //Set this activities content/display to this view
        setContentView(buckysLayout);
}
  • 1

Java / Android Development

107,024 followers
About

Very popular language used to create desktop applications, website applets, and Android apps.

Links
Moderators
Bucky Roberts Administrator