Image sharing of a listview with Intent

Asked

Viewed 46 times

0

Guys help me pfv, well it’s like this. I have a listview with several images and then when the user selects an image from the list in the app, this image is assigned to an ID in the case R.id.ivCar It is time to pass the reference on the index is giving error because it cannot pass id with reference has to pass the image. good how do I do it? follows the code..

int resId = R.id.iv_car; // car.getIMAGEMRESOUCEID()
Uri uriToImage = Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE +
                                "://" + getResources().getResourcePackageName(resId));
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, uriToImage);
shareIntent.setType("image/jpeg");
startActivity(Intent.createChooser(shareIntent, getResources().getText(R.string.app_name)));

help me pfvvvvv... I have done from Tudoo to

1 answer

0

For given passes to a selected input from a listview I did so

ltsunidades.setOnItemClickListener(new AdapterView.OnItemClickListener() {

    @Override
    public void onItemClick(AdapterView adapter, View view, int posicao, long id) {
        Tab_UC obj = (Tab_UC) adapter.getItemAtPosition(posicao);
        String filial = "" + obj.getCod_UC();

        Preferencia.setfilial(Selecionar_Unidade.this, filial.toString().trim());

        Intent it = new Intent(getBaseContext(), Empresa.class);
        it.putExtra("Filial", filial);
        startActivity(it);
        // Toast.makeText(getApplicationContext(), " " + filial, Toast.LENGTH_SHORT).show();
    }
});

In my case I’m taking a code I need a select made in php via web service and I’m already saving it in a sharedpreferences..

Browser other questions tagged

You are not signed in. Login or sign up in order to post.