读书人

quot;Uses or overrides a deprecated API

发布时间: 2012-11-07 09:56:10 作者: rapoo

"Uses or overrides a deprecated API" in android compiling.

Sometimes we write android apps with eclipse and generate apks normally, but put the apks' package in base for entire build, we get the warning/error "uses or overrides a deprecated API", then quit the building.

?

A deprecated API is an API or part of API that is not officially supported anymore, the compiler will check for it and throw the warning/error then.

?

Here we should manage our APIs.

i.e.

?

?

btn.setOnClickListener(new View.OnClickListener(){public void onClick(View v) {// TODO Auto-generated method stubActivityManager am = (ActivityManager)cnx.getSystemService(Context.ACTIVITY_SERVICE);ComponentName cn = am.getRunningTasks(1).get(0).topActivity;String des = (String)am.getRunningTasks(1).get(0).description;bmp = am.getRunningTasks(1).get(0).thumbnail;Log.i("SnapshotDemo","bmp = "+bmp+"/ncn = "+cn+"/ndes = "+des);}                });
?

Android recommend to use new View.OnClickListener()

读书人网 >Android

热点推荐