How to avoid NoClassDefFoundError with different Android API versions -


i'm developing application apis v10 v17.

my activity implements ondraglistener available api v14.

public class myactivity extends activity implements view.ondraglistener {     .... } 

so, when application installed on device api v10 fails load activity java.lang.noclassdeffounderror.

i understand won't work on api v10, that's ok. i'm handling inside activity.

i want know practice handle different api versions when comes features this?

first of can check api levels , depending on execute or not code. example :

if(build.version.sdk_int < build.version_codes.honeycomb){      // don't use it. } else {      // use new api :      // myview.setondraglistener(...); } 

you should not implement interfaces new api's in activity if want support old android versions too. instead of use approach above.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -