猿问

怎么就会崩溃了,求各位学友解答啊。

package com.example.android_arrayadapter;


import android.R.anim;

import android.support.v7.app.ActionBarActivity;

import android.os.Bundle;

import android.view.Menu;

import android.view.MenuItem;

import android.widget.ArrayAdapter;

import android.widget.ListView;

import android.widget.SimpleAdapter;



public class MainActivity extends ActionBarActivity {

private ListView listView;

private ArrayAdapter<String>arrayAdapter;

private SimpleAdapter simpleAdapter;


    @Override

    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

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

        String[]arr_data={"慕课网1","慕课网2","慕课网3","慕课网4"};

        arrayAdapter=new ArrayAdapter<String>(this, android.R.layout.simple_expandable_list_item_1, arr_data);

        listView.setAdapter(arrayAdapter);

    }




}


小强321321
浏览 1568回答 3
3回答
随时随地看视频慕课网APP

相关分类

Android
我要回答