Im new to androiod coding. Ive only ever published one app which was a simple piano. Im trying to make a flash card app for studying but it keep crashing. When I debug I get a nullPointerException which Im not exactly sure what it means. Here is my code(I dont understand how to post code):
package com.example.hostoryflashcards;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
public class MainActivity extends ListActivity{
String classes[] = {
"Usa", "Canada", "New Mexico", "Other3", "Other4", "Other5"
};
String answer[] = {
"Washington DC", "Ottowa", "Santa fae"
};
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setListAdapter(new ArrayAdapter<String>(MainActivity.this, android.R.layout.simple_expandable_list_item_1, classes));
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
Button b1;
b1 = (Button)findViewById(position);
b1.setText("test");
}
}
Whats my problem?
Thanks, Jason