Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7173937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:55:44+00:00 2026-05-28T15:55:44+00:00

Hello I am new to Android programming and I am a bit rusty with

  • 0

Hello I am new to Android programming and I am a bit rusty with Java too since I haven’t done it in a while.
I am trying to use an example that I found online and when I try to run it with the emulator it said that my program has stopped and I have no idea why.

All that I modified was the main Java file

The code that I have is:

import android.app.Activity;
import android.app.ListActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;


public class ScottTestActivity extends ListActivity {
/** Called when the activity is first created. */

public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.main);
    //Values to display
    String[] values = new String[] { "Android", "iPhone",                                         
    "Windows Mobile", "Blackberry", "WebOS", "Ubuntu", "Windows7", "Max OS X",
            "Linux", "OS/2" };
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
            android.R.layout.simple_list_item_1, values);
    setListAdapter(adapter);
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
    String item = (String) getListAdapter().getItem(position);
    Toast.makeText(this, item + " selected", Toast.LENGTH_LONG).show();
}

}

Could someone please help me? and if possible point me in a good direction that explains Android programming?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T15:55:45+00:00Added an answer on May 28, 2026 at 3:55 pm

    is this where you took your sample :

    http://www.vogella.de/articles/AndroidListView/article.html

    anyway as Dawid Sajdak refers, it looks that there is no listview tag in main.xml

    you need to add this to res/layout/main.xml

    <

    ListView
      android:id="@+android:id/list"
      android:layout_width="match_parent"
      android:layout_height="wrap_content" >
    </ListView>
    

    good luck

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello I am new to android programming, I haven't started writing the code for
I'm new to android and I have not done any Java programming for probably
I'm new in android development and I am trying out the WebView example in
Hello im new to programming, im trying to construct my first simple application, im
Hello everyone I am beginner in Android Programming, and fresh developer too, In my
hello I'm new to PHP programming and I migrated from ASP .net to PHP..
Hi I am new to android Programming and NDK.Yet i am not clear with
Hello i m new to android and working on Radio application i gt stuck
I'm new to Android, I've followed the hello world tutorial through and have a
Hello dear programmers, I am very new to android application development and for practice

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.