• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Help with a ListActivity, activity crashes

Mattimus

Lurker
Jul 27, 2010
3
0
Hi guys, if someone could give me a hand that would be great -

The program crashes when this activity is initiated and i'm not sure why. When all the functions are gone except the

public class DetailForm extends ListActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.detail_form);
}
}

the activity gets a force close. when i change the EXTENDS command from LISTActivity to => Activity it will load... but not as a ListActivity

any thoughts?
 
Hi guys, if someone could give me a hand that would be great -

The program crashes when this activity is initiated and i'm not sure why. When all the functions are gone except the

public class DetailForm extends ListActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.detail_form);
}
}

the activity gets a force close. when i change the EXTENDS command from LISTActivity to => Activity it will load... but not as a ListActivity

any thoughts?

Does your detail_form.xml layout file contain a ListView?
 
Upvote 0
yes, the XML file detail_form.xml is as follows:


<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/blankbakgrnd"
>


<ListView
android:id="@+id/subjects"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"

/>


</LinearLayout>
 
Upvote 0
Guys!! I am stuck with the same problem...I have to use ListView in my project. If I use only list view without setting the content view, it works. But I have to use but simultaneously


public class StudentActivity extends ListActivity
{


String[] name = {"pen", "Lighter", "Chair"};

EditText txtList,txtName;
int i=0;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setListAdapter(new ArrayAdapter<String>(StudentActivity.this, android.R.layout.simple_expandable_list_item_1,name));
setContentView(R.layout.main);
txtName = (EditText) findViewById(R.id.txtName);

}


}


Please Suggest Something...
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones