我在调试强制退出问题时遇到了困难。在下面的代码中,您可以看到我使用Intent导航到一个新活动。但是,当我按下Android设备上的后退按钮时,我得到一个强制退出错误。我有什么东西可以忽略以避免强行退出问题吗?
public class editList extends Activity implements OnItemClickListener{
ArrayList<String> stock_list;
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.edit);
Intent intent = getIntent();
stock_list = new ArrayList<String>();
stock_list = intent.getStringArrayListExtra("stock_list");
String [] stockArr = new String[stock_list.size()];
stockArr = stock_list.toArray(stockArr);
ListView lv = (ListView)findViewById(R.id.editView);
lv.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, stockArr));
lv.setOnItemClickListener(this);
}
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
// TODO Auto-generated method stub
Intent intent = new Intent(this, input.class);
intent.putExtra("ticker", stock_list.get(arg2));
//finish();
startActivity(intent);
}
}