android Toast报错 Activity context.this cannot be resolved to a variable
时间:2014-12-17 18:34:07
收藏:0
阅读:316
处理方法
你过你继承了Activity,就使用下面的2个方式
Toast.makeText(ClassName.this, "Couldn‘t launch the market",Toast.LENGTH_LONG).show();
或者
Toast.makeText(getApplicationContext(), "Couldn‘t launch the market",Toast.LENGTH_LONG).show();
如果你的类继承了 Fragment ,就使用下面的方式
Toast.makeText(getActivity(), "Couldn‘t launch market",Toast.LENGTH_LONG).show();
原文地址:http://www.itmmd.com/201411/153.html
该文章由 萌萌的IT人 整理发布,转载须标明出处。
原文:http://blog.csdn.net/androidmylove/article/details/41984073
评论(0)