0

I am trying to generate a dynamic table problematically It's working properly above API > 11 but its showing some error like this

05-06 12:35:30.303: E/AndroidRuntime(386): FATAL EXCEPTION: main
05-06 12:35:30.303: E/AndroidRuntime(386): java.lang.NoClassDefFoundError: android.app.ActionBar$LayoutParams
05-06 12:35:30.303: E/AndroidRuntime(386):  at com.ica.icacounselor.Follow_ups_list_third_level.populateTable(Follow_ups_list_third_level.java:105)
05-06 12:35:30.303: E/AndroidRuntime(386):  at com.ica.icacounselor.Follow_ups_list_third_level.onCreate(Follow_ups_list_third_level.java:65)
05-06 12:35:30.303: E/AndroidRuntime(386):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-06 12:35:30.303: E/AndroidRuntime(386):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
05-06 12:35:30.303: E/AndroidRuntime(386):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
05-06 12:35:30.303: E/AndroidRuntime(386):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
05-06 12:35:30.303: E/AndroidRuntime(386):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
05-06 12:35:30.303: E/AndroidRuntime(386):  at android.os.Handler.dispatchMessage(Handler.java:99)
05-06 12:35:30.303: E/AndroidRuntime(386):  at android.os.Looper.loop(Looper.java:123)
05-06 12:35:30.303: E/AndroidRuntime(386):  at android.app.ActivityThread.main(ActivityThread.java:3683)
05-06 12:35:30.303: E/AndroidRuntime(386):  at java.lang.reflect.Method.invokeNative(Native Method)
05-06 12:35:30.303: E/AndroidRuntime(386):  at java.lang.reflect.Method.invoke(Method.java:507)
05-06 12:35:30.303: E/AndroidRuntime(386):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
05-06 12:35:30.303: E/AndroidRuntime(386):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
05-06 12:35:30.303: E/AndroidRuntime(386):  at dalvik.system.NativeStart.main(Native Method)

My code follows

    //--------------------------------------------------------------------------------------------------
    // Creating Table Header
    //--------------------------------------------------------------------------------------------------

    TableRow followup_tr_head = new TableRow(this);
    followup_tr_head.setId(10);
    followup_tr_head.setBackgroundResource(R.drawable.list_header);
    followup_tr_head.setLayoutParams(new LayoutParams(
            LayoutParams.FILL_PARENT,
            LayoutParams.WRAP_CONTENT));


    final TextView time_name_title = new TextView(this);
    time_name_title.setId(20);
    time_name_title.setText("Time");
    time_name_title.setTextColor(Color.WHITE);
    time_name_title.setPadding(5,5,5,5);
    followup_tr_head.addView(time_name_title);// add the column to the table row here
    time_name_title.setTextSize(12);    

    final TextView student_name_title = new TextView(this);
    student_name_title.setId(20);
    student_name_title.setText("Student Name");
    student_name_title.setTextColor(Color.WHITE);
    student_name_title.setPadding(5,5,5,5);
    followup_tr_head.addView(student_name_title);// add the column to the table row here
    student_name_title.setTextSize(12);    
4

3 回答 3

2

the ActionBar is presented in API 11. You can't use it in lower API levels.

于 2013-05-06T07:24:08.067 回答
1

Yes you can't use ActionBar below API level 11. To use actionbar in lower api levels use ActionBarSherlock

于 2013-05-06T07:28:32.263 回答
0

I had imported import android.app.ActionBar.LayoutParams;

I should import android.widget.TableRow.LayoutParams;

于 2013-05-06T07:38:40.633 回答