I am trying to start a activity from ListActivity but its crashing.
package net.apachetechnology.Organizer;
import android.R;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class Organizer extends ListActivity {
private ArrayAdapter m_adapterItems;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Item[] items = {
new Item(Task.class, "Add Task"),
new Item(test.class, "Testing"),
};
m_adapterItems = new ArrayAdapter(this,
R.layout.simple_list_item_1, items);
setListAdapter(m_adapterItems);
}
@Override
protected void onListItemClick(ListView l, View v, int position,
long id) {
//startActivity(m_adapterItems.getItem(position));
//m_adapterItems.getClass();
Intent intent = new Intent();
intent.setClass(Organizer.this, test.class);
startActivity(intent);
}
class Item extends Intent {
String s;
public Item(Class c, String s) {
super(Organizer.this, c);
this.s = s;
}
@Override
public String toString() {
return s;
}
}
}
+++
+
package net.apachetechnology.Organizer;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
public class test extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState) {
try {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
catch (Exception e)
{
Log.e("ERROR", e.toString());
e.printStackTrace();
}
}
}
===
http://schemas.android.com/apk/res/android";
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_vertical|center_horizontal"
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en