我在片段中有功能
public void resetUpdating()
{
MenuItem menuItem = Mymenu.findItem(R.id.action_refresh);
if(menuItem.getActionView()!=null)
{
menuItem.getActionView().clearAnimation();
menuItem.setActionView(null);
}
}
在AsyncTask中调用并获取错误“无法转换的类型无法转换为android.content.Context”
protected void onPostExecute(ArrayList<String> strings) {
super.onPostExecute(strings);
((Currency_list)mContext).resetUpdating();
}
片段
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_refresh:
if (isOnline()) {
LayoutInflater inflater = (LayoutInflater)getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
ImageView iv = (ImageView)inflater.inflate(R.layout.animated_view, null);
Animation rotation = AnimationUtils.loadAnimation(getActivity(), R.anim.refresh_anim);
rotation.setRepeatCount(Animation.INFINITE);
iv.startAnimation(rotation);
item.setActionView(iv);
parseData = new ParseData(getActivity());
try {
arrayList = parseData.execute().get();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
setCustomList();
}
break;
请告诉我我错在哪里?