forestzhu01 2016-02-29 11:59 采纳率: 50%
浏览 1390

这是什么类型错误?看了蛮久

对着视频中写了一个expandablelist,到错了求教图片

 一个小部分:跳转页面
if(msg.arg1==100){
                String facterstr = text_02.getText().toString();
            Intent intent = new Intent();
            intent.putExtra("name",facterstr);
            intent.setClass(denglu.this,main.class);
            denglu.this.startActivity(intent);
            }
Main的代码:
public class main extends ExpandableListActivity{
    TextView text_01;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
       text_01 = (TextView)findViewById(R.id.text);
         Intent intent = getIntent();
         String fcterone = intent.getStringExtra("name");
        text_01.setText(fcterone);


        List<Map<String,String>> groups = new ArrayList<Map<String,String>>();
        Map<String,String> group1= new HashMap<String,String>();
        group1.put("group","我的家人" );
        Map<String,String> group2= new HashMap<String,String>();
        group2.put("group","朋友" );
        groups.add(group1);
        groups.add(group2);

        List<Map<String,String>> child1 = new ArrayList<Map<String,String>>();
        Map<String,String> child1Data1 = new HashMap<String,String>();
        child1Data1.put("child","张珊");
        child1.add(child1Data1);
        Map<String,String> child1Data2 = new HashMap<String,String>();
        child1Data2.put("child","李斯");
        child1.add(child1Data2);
        List<Map<String,String>> child2 = new ArrayList<Map<String,String>>();
        Map<String,String> child2Data1 = new HashMap<String,String>();
        child2Data1.put("child","张珊");
        child2.add(child2Data1);
        Map<String,String> child2Data2 = new HashMap<String,String>();
        child2Data2.put("child","李斯");
        List<List<Map<String,String>>> childs = new ArrayList<List<Map<String,String>>>();
        child2.add(child2Data2);
        childs.add(child1);
        childs.add(child2);


        SimpleExpandableListAdapter sela = new SimpleExpandableListAdapter(this, groups,R.layout.group, new String[]{"group"},new int[]{R.id.groupTo}, childs, R.layout.child, new String[]{"child"},new int[]{R.id.childTo});
        setListAdapter(sela);
    }
}
Main的xml文件:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    tools:context="com.example.helper.main"
    tools:ignore="MergeRootFrame" >

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="81dp"
            android:orientation="horizontal" >

            <ImageView
                android:layout_width="104dp"
                android:paddingTop="0dp"
                android:layout_height="78dp"
                android:src="@drawable/touxiang" />

            <TextView 
                android:textSize="10pt"            
                android:layout_width="wrap_content"
                android:paddingTop="15dp"
                android:paddingLeft="15dp"
                android:layout_height="wrap_content"
                android:id="@+id/text"
                android:text="@string/boy"/>
            </LinearLayout>

            <LinearLayout 
             android:layout_width="fill_parent"
             android:layout_height="0dip"
             android:orientation="vertical"
             android:layout_weight="6">
             <ExpandableListView
                 android:id="@id/android:list"
                 android:layout_width="fill_parent"
                 android:layout_height="fill_parent"
                 android:drawSelectorOnTop="false"/>
             <TextView 
                 android:id="@+id/text_003"
                 android:layout_width="fill_parent"
                 android:layout_height="fill_parent"
                 android:text="No data"/>
         </LinearLayout>
</LinearLayout>
我一共写了三个activity,可以编译成功但是当点击按钮跳转到第三个activity的时候程序蹦了。


  • 写回答

2条回答 默认 最新

  • devmiao 2016-02-29 14:03
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 求解 yolo算法问题
  • ¥15 虚拟机打包apk出现错误
  • ¥30 最小化遗憾贪心算法上界
  • ¥15 用visual studi code完成html页面
  • ¥15 聚类分析或者python进行数据分析
  • ¥15 三菱伺服电机按启动按钮有使能但不动作
  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝