大家早上好,我是一个没有经验的开发人员,我需要你..
我有这个代码来选择图像并发送(到附件)电子邮件......请帮助我,因为这个代码失败了。
private static int RESULT_LOAD_IMAGE = 1;
private static final int PICK_FROM_GALLERY = 2;
private static final int REQ_CODE_PICK_IMAGE = 0;
Uri selectedImage;
public void galleria(View v){
Intent in = new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(in, RESULT_LOAD_IMAGE);
}
protected void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent) {
super.onActivityResult(requestCode, resultCode, imageReturnedIntent);
switch(requestCode) {
case REQ_CODE_PICK_IMAGE:
if(resultCode == RESULT_OK){
Uri selectedImage = imageReturnedIntent.getData();
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("plain/text");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{"stefano.pietrella@gmail.com"});
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Object");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Message...");
//Uri attachment = Uri.parse("file:///sdcard/fil.txt");
emailIntent.putExtra(Intent.EXTRA_STREAM,selectedImage);
startActivity(Intent.createChooser(emailIntent, "Send email..."));
}
}
}
日志猫
02-21 09:53:20.359: E/AndroidRuntime(16440): FATAL EXCEPTION:
main 02-21 09:53:20.359: E/AndroidRuntime(16440): java.lang.IllegalStateException:
Could not find a method k(View) in the activity class com.supermoney.campionatoruzzle.LeagueSummaryV2 for onClick handler on view class android.widget.Button with id 'buttonStartMatch2'
02-21 09:53:20.359: E/AndroidRuntime(16440): at android.view.View$1.onClick(View.java:3678)
02-21 09:53:20.359: E/AndroidRuntime(16440): at android.view.View.performClick(View.java:4211)