[Java for Android App Development] RoflFrankoc:
Hello today i was trying to code a ListView and in it says data from a database and them i tested it i was sure it will work this time and them this weird error comes up my logcat:

10-09 20:53:38.166: E/AndroidRuntime(279): FATAL EXCEPTION: main
10-09 20:53:38.166: E/AndroidRuntime(279): java.lang.IllegalStateException: ArrayAdapter requires the resource ID to be a TextView
10-09 20:53:38.166: E/AndroidRuntime(279):	at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:347)
10-09 20:53:38.166: E/AndroidRuntime(279):	at android.widget.ArrayAdapter.getView(ArrayAdapter.java:323)
10-09 20:53:38.166: E/AndroidRuntime(279):	at android.widget.AbsListView.obtainView(AbsListView.java:1315)
10-09 20:53:38.166: E/AndroidRuntime(279):	at android.widget.ListView.measureHeightOfChildren(ListView.java:1198)
10-09 20:53:38.166: E/AndroidRuntime(279):	at android.widget.ListView.onMeasure(ListView.java:1109)
10-09 20:53:38.166: E/AndroidRuntime(279):	at android.view.View.measure(View.java:8171)
10-09 20:53:38.166: E/AndroidRuntime(279):	at android.widget.RelativeLayout.measureChild(RelativeLayout.java:563)
10-09 20:53:38.166: E/AndroidRuntime(279):	at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:378)
10-09 20:53:38.166: E/AndroidRuntime(279):	at android.view.View.measure(View.java:8171)
10-09 20:53:38.166: E/AndroidRuntime(279):	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
10-09 20:53:38.166: E/AndroidRuntime(279):	at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
10-09 20:53:38.166: E/AndroidRuntime(279):	at android.view.View.measure(View.java:8171)
10-09 20:53:38.166: E/AndroidRuntime(279):	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
10-09 20:53:38.166: E/AndroidRuntime(279):	at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
10-09 20:53:38.166: E/AndroidRuntime(279):	at android.view.View.measure(View.java:8171)
10-09 20:53:38.166: E/AndroidRuntime(279):	at android.view.ViewRoot.performTraversals(ViewRoot.java:801)
10-09 20:53:38.166: E/AndroidRuntime(279):	at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
10-09 20:53:38.166: E/AndroidRuntime(279):	at android.os.Handler.dispatchMessage(Handler.java:99)
10-09 20:53:38.166: E/AndroidRuntime(279):	at android.os.Looper.loop(Looper.java:123)
10-09 20:53:38.166: E/AndroidRuntime(279):	at android.app.ActivityThread.main(ActivityThread.java:4627)
10-09 20:53:38.166: E/AndroidRuntime(279):	at java.lang.reflect.Method.invokeNative(Native Method)
10-09 20:53:38.166: E/AndroidRuntime(279):	at java.lang.reflect.Method.invoke(Method.java:521)
10-09 20:53:38.166: E/AndroidRuntime(279):	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
10-09 20:53:38.166: E/AndroidRuntime(279):	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
10-09 20:53:38.166: E/AndroidRuntime(279):	at dalvik.system.NativeStart.main(Native Method)
10-09 20:53:38.166: E/AndroidRuntime(279): Caused by: java.lang.ClassCastException: android.widget.RelativeLayout
10-09 20:53:38.166: E/AndroidRuntime(279):	at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:340)
10-09 20:53:38.166: E/AndroidRuntime(279):	... 24 more

and my main.java code is:

package com.example.frauprinzssapp;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Color;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

public class Main extends Activity {

private static String DDB_NAME = dbreader.FeedEntry.DB_TABLENAME;
SQLiteDatabase db;

List<String> userss = new ArrayList<String>();

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
database Mydb = new database(Main.this);
db = Mydb.getWritableDatabase();
String[] t = null;

ListView users = (ListView) findViewById(R.id.users);

try{
String query = "SELECT * FROM "+DDB_NAME+" ORDER BY "+dbreader.FeedEntry.COL_1+" DESC";
Cursor c = db.rawQuery(query, t);

while (c.moveToNext()){
if (c.moveToLast()){
userss.add(c.toString());
ArrayAdapter<String> adapter = new ArrayAdapter<String>(Main.this, R.layout.main, userss);
users.setAdapter(adapter);
return;
}
userss.add(c.toString());
}
}catch(Exception e){
userss.add("[ERRORMSG]: "+e.getMessage());
userss.add("[ERRORCAUSE]: "+e.getCause());
userss.add("[ERRORLOC]: "+e.getLocalizedMessage());
userss.add("[CLASS]: "+e.getClass());
ArrayAdapter<String> adapter = new ArrayAdapter<String>(Main.this, R.id.users, userss);
users.setAdapter(adapter);
}
}
//-----change view voids-----
public void main(View view){
setContentView(R.layout.main);
}
public void adduser(View view){
setContentView(R.layout.adduser);
}
public void removeuser(View view){
setContentView(R.layout.removeuser);
}

//------actions------
public void add(View view){
EditText name = (EditText) findViewById(R.id.aun);
EditText clas = (EditText) findViewById(R.id.auc);
String namee = name.getText().toString();
String clase = clas.getText().toString();

if (name.toString() == null || clas.toString() == null){
Toast.makeText(Main.this, "please fill in all textfields!", Toast.LENGTH_LONG);
return;
}
ContentValues values = new ContentValues();
values.put(dbreader.FeedEntry.COL_2, namee);
values.put(dbreader.FeedEntry.COl_3, clase);
values.put(dbreader.FeedEntry.COL_4, 0);

try{
db.insert(DDB_NAME, null, values);
Toast.makeText(Main.this, "added user "+name.toString()+"!", Toast.LENGTH_LONG);
setContentView(R.layout.main);
}catch(Exception e){
Toast.makeText(Main.this, "[ERROR] Could not create user maybe its already created!", Toast.LENGTH_LONG);
e.printStackTrace();
}
}
public void remove(){

}
public void show(){

}
}

the part where this is coming from is (i tihnk):

database Mydb = new database(Main.this);
db = Mydb.getWritableDatabase();
String[] t = null;

ListView users = (ListView) findViewById(R.id.users);

try{
String query = "SELECT * FROM "+DDB_NAME+" ORDER BY "+dbreader.FeedEntry.COL_1+" DESC";
Cursor c = db.rawQuery(query, t);

while (c.moveToNext()){
if (c.moveToLast()){
userss.add(c.toString());
ArrayAdapter<String> adapter = new ArrayAdapter<String>(Main.this, R.layout.main, userss);
users.setAdapter(adapter);
return;
}
userss.add(c.toString());
}
}catch(Exception e){
userss.add("[ERRORMSG]: "+e.getMessage());
userss.add("[ERRORCAUSE]: "+e.getCause());
userss.add("[ERRORLOC]: "+e.getLocalizedMessage());
userss.add("[CLASS]: "+e.getClass());
ArrayAdapter<String> adapter = new ArrayAdapter<String>(Main.this, R.id.users, userss);
users.setAdapter(adapter);
}

and also can you tell me if the ordering and displaying to the LIstView will work and when no can you help me display it please?