0

This is the error that I'm getting:

11-01 18:40:55.535: D/dalvikvm(1636): Not late-enabling CheckJNI (already on) 11-01 18:40:55.575: D/AndroidRuntime(1636): Shutting down VM 11-01 18:40:55.575: W/dalvikvm(1636): threadid=1: thread exiting with uncaught exception (group=0xb0d9ece8) 11-01 18:40:55.575: E/AndroidRuntime(1636): FATAL EXCEPTION: main 11-01 18:40:55.575: E/AndroidRuntime(1636): Process: com.example.inflate, PID: 1636 11-01 18:40:55.575: E/AndroidRuntime(1636): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.inflate/com.example.inflate.MainActivity}: android.util.AndroidRuntimeException: You cannot combine swipe dismissal and the action bar. 11-01 18:40:55.575: E/AndroidRuntime(1636): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2197) 11-01 18:40:55.575: E/AndroidRuntime(1636): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2258) 11-01 18:40:55.575: E/AndroidRuntime(1636): at android.app.ActivityThread.access$800(ActivityThread.java:138) 11-01 18:40:55.575: E/AndroidRuntime(1636): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1209) 11-01 18:40:55.575: E/AndroidRuntime(1636): at android.os.Handler.dispatchMessage(Handler.java:102) 11-01 18:40:55.575: E/AndroidRuntime(1636): at android.os.Looper.loop(Looper.java:136) 11-01 18:40:55.575: E/AndroidRuntime(1636): at android.app.ActivityThread.main(ActivityThread.java:5026) 11-01 18:40:55.575: E/AndroidRuntime(1636): at java.lang.reflect.Method.invokeNative(Native Method) 11-01 18:40:55.575: E/AndroidRuntime(1636): at java.lang.reflect.Method.invoke(Method.java:515) 11-01 18:40:55.575: E/AndroidRuntime(1636): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777) 11-01 18:40:55.575: E/AndroidRuntime(1636): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602) 11-01 18:40:55.575: E/AndroidRuntime(1636): at dalvik.system.NativeStart.main(Native Method) 11-01 18:40:55.575: E/AndroidRuntime(1636): Caused by: android.util.AndroidRuntimeException: You cannot combine swipe dismissal and the action bar. 11-01 18:40:55.575: E/AndroidRuntime(1636): at com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:275) 11-01 18:40:55.575: E/AndroidRuntime(1636): at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:2872) 11-01 18:40:55.575: E/AndroidRuntime(1636): at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3129) 11-01 18:40:55.575: E/AndroidRuntime(1636): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:303) 11-01 18:40:55.575: E/AndroidRuntime(1636): at android.app.Activity.setContentView(Activity.java:1930) 11-01 18:40:55.575: E/AndroidRuntime(1636): at com.example.inflate.MainActivity.onCreate(MainActivity.java:25) 11-01 18:40:55.575: E/AndroidRuntime(1636): at android.app.Activity.performCreate(Activity.java:5242) 11-01 18:40:55.575: E/AndroidRuntime(1636): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 11-01 18:40:55.575: E/AndroidRuntime(1636): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2161)

Here is the MainActivity of my code:

public class MainActivity extends Activity {



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);



        ListView listview =(ListView) findViewById(R.id.listView);
        CustomAdapter adapter= new CustomAdapter(MainActivity.this);
        listview.setAdapter(adapter);
   }

    public class CustomAdapter extends BaseAdapter {




        private String[] str_mediumtext = { "INDIA", "UK","SINGAPORE", "THAILAND", };
        private String[] str_smalltext = { "aaaaaaaaaaaa", "agfffffffff","gfdnvmnvnjkfdndnmcnv", "chfvdkfhfkdhfjfh"};
        private Integer[] int_images = { R.drawable.images, R.drawable.dessert,R.drawable.pilaurice,R.drawable.prawn};
        //private boolean [] bool_check = { true, true, false, true};
        private LayoutInflater layoutinflator;

        public CustomAdapter (Context context) {
            layoutinflator = LayoutInflater.from(context);

        }
        @Override
        public View getView(final int position, View convertView, ViewGroup parent) {
            // TODO Auto-generated method stub
            final Holder holder;



            if(convertView != null) {
                holder = new Holder();


                //convertView = layoutinflator.inflate(R.layout.listview, Anull);
                convertView = layoutinflator.inflate(R.layout.listview, parent, false);

                holder.imageview = (ImageView)convertView.findViewById(R.id.imageView1);
                holder.tvMedium = (TextView)convertView.findViewById(R.id.textView1);
                holder.tvSmall = (TextView)convertView.findViewById(R.id.textView2);
                holder.checkbox = (CheckBox)convertView.findViewById(R.id.checkBox1);


                convertView.setTag(holder);
            } else {
                holder = (Holder) convertView.getTag();
            }
            holder.tvMedium.setText(str_mediumtext[position]);
            holder.tvSmall.setText(str_smalltext[position]);
            holder.imageview.setImageResource(int_images[position]);
            return convertView;

        }

    @Override
        public int getCount() {
            // TODO Auto-generated method stub
            return str_mediumtext.length;
        }
     @Override
        public Object getItem(int position) {
            // TODO Auto-generated method stub
            return position;
        }
     @Override
        public long getItemId(int position) {
            // TODO Auto-generated method stub
            return position;
        } }
    class Holder {
        ImageView imageview;
        TextView tvMedium, tvSmall;
        CheckBox checkbox;
    }



    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
}

I am getting fatal exception. please help me to solve this

Alex K
  • 8,269
  • 9
  • 39
  • 57
sudheir
  • 11
  • 2

1 Answers1

0

You are probably trying to compile for a Wear device, or trying to run it on a 4.4W API emulator. Set your targetSdk version to 19, and try it on a 4.4 (without W) emulator / device.

Daniel Zolnai
  • 16,487
  • 7
  • 59
  • 71