package com.example.decnail.decnail;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.FileAsyncHttpResponseHandler;
import com.squareup.picasso.OkHttpDownloader;
import com.squareup.picasso.Picasso;
import java.io.File;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.List;
import cz.msebera.android.httpclient.Header;
import static android.support.v4.app.ActivityCompat.*;
public class TareaArrayAdapter extends ArrayAdapter<Tarea> {
private Picasso picasso;
public Bitmap bitmap;
customButtonListener customListner;
public TareaArrayAdapter(Context context, List<Tarea> objects) {
super(context, 0, objects);
}
public interface customButtonListener {
public void onButtonClickListner(int position,String value);
}
public void setCustomButtonListner(customButtonListener listener) {
this.customListner = listener;
}
//override es automatico
@Override
public View getView(final int position, View convertView, ViewGroup parent){
LayoutInflater inflater = (LayoutInflater)getContext()
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.itemlista, null, true);
//Obteniendo una instancia del inflater el layout con los items nombre y hora
//Salvando la referencia del View de la fila
View listItemView = convertView;
Log.i("imagen", "adapter vamos bien ");
ImageView image2 = (ImageView)listItemView.findViewById(R.id.image1);
TextView txt_descrip = (TextView)listItemView.findViewById(R.id.txt_descripcion);
Button correo = (Button)listItemView.findViewById(R.id.btn_enviar);
//Obteniendo instancia de la Tarea en la posición actual
final Tarea item = getItem(position);
txt_descrip.setText(item.getDescrip());
Picasso.with(getContext())
.load(item.getImage())
.resize(400, 600)
.into(image2);
correo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("*/*");
intent.putExtra(Intent.EXTRA_EMAIL, "unab99@gmail.com");
intent.putExtra(Intent.EXTRA_SUBJECT, "envio");
intent.setType("message/rfc822");
// intent.putExtra(Intent.EXTRA_STREAM, attachment);
startActivity(intent,"enviar");
Toast toast = Toast.makeText(getContext(), item.getImage(), Toast.LENGTH_LONG);
toast.show();
String to = "toast";
Log.i("Toast", to);
}
});
return listItemView;
}
//Devolver al ListView la fila creada
}
但我有这个错误
在startActivity中(意图,&#34; enviar&#34;);
错误:(104,29)错误:类ActivityCompat中的方法startActivity无法应用于给定类型; 必需:活动,意图,捆绑 发现:Intent,String 原因:实际和正式的参数列表长度不同
所以我不做我做的事