我使用的是在Android開發命名爲A
類,這個警告彈出,當我創建了一個名爲類:警告這種方法有一個構造函數名稱
private Intent a() // This method has a constructor name
{
b.setDrawingCacheEnabled(true);
Bitmap bitmap = b.getDrawingCache();
Intent intent = new Intent("android.intent.action.SEND");
intent.setType("image/jpg");
ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
bitmap.compress(android.graphics.Bitmap.CompressFormat.JPEG, 100,
bytearrayoutputstream);
File file = new File((new StringBuilder())
.append(Environment.getExternalStorageDirectory())
.append(File.separator).append("temp_file.jpg").toString());
try {
file.createNewFile();
FileOutputStream fileoutputstream = new FileOutputStream(file);
fileoutputstream.write(bytearrayoutputstream.toByteArray());
fileoutputstream.close();
} catch (IOException ioexception) {
ioexception.printStackTrace();
}
intent.addFlags(0x80000);
intent.putExtra("android.intent.extra.STREAM", Uri.fromFile(file));
a.startActivity(Intent.createChooser(intent, "Share via: "));
return intent;
}
我該怎麼辦?
重命名你的方法 – Raghunandan
這永遠不會發生,當你遵循Java命名約定;-) – Henry