共享意图破坏活动



我在应用程序中使用几种共享意图,但是当我共享时,我的应用程序在后台移动并在共享活动后移动。我尝试了:

android:configChanges="orientation|keyboardHidden|screenSize"

android:noHistory="true"

对于特定活动并调用明确意图,例如(Google ,Facebook,Twitter和Email)

startActivityForResult(Intent.createChooser(intent,"Send mail..."),4);

和我的 activityOnresult

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if(requestCode==FB_SIGN_ING){
        callbackManager.onActivityResult(requestCode,resultCode,data);
    } //else do nothing
}

更新:香港专业教育学院弄清楚了我的活动在转到前面的背景时会破坏。但是,即使我使用特定的配置和 activityOnresult

意图示例:

public void ShareByEmail(){
        final String newsTitle = singleNews.get(0).getNews_title().trim();
        String newsPhoto=SingleNewsImages.get(0);
        String url = BASE_URL+newsPhoto;
        final String newsLink = "http://motorcityarabia.com"+singleNews.get(0).getLink().trim();
        final Uri uri = Uri.parse(url);
        Target target = new Target() {
            @Override public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
               // Intent intent = new Intent(Intent.ACTION_SENDTO,Uri.parse("mailto:"));
                Intent intent = new Intent();
              intent.setAction(Intent.ACTION_SEND);
                intent.putExtra(Intent.EXTRA_SUBJECT,newsTitle);
                intent.putExtra(Intent.EXTRA_TEXT , Html.fromHtml("<strong><a href='"+newsLink+"'>"+newsTitle+"</a></strong><br/><a href='"+newsLink+"'>READ MORE</a>"));
                intent.putExtra(Intent.EXTRA_STREAM, getLocalBitmapUri(bitmap));
                intent.setType("image/*");
                startActivityForResult(Intent.createChooser(intent,"Send mail..."),4);

            }
            @Override public void onBitmapFailed(Drawable errorDrawable) {
                Toast.makeText(SingleNewsActivity.this, "Error Drawable", Toast.LENGTH_SHORT).show();
            }
            @Override public void onPrepareLoad(Drawable placeHolderDrawable) {
                Toast.makeText(SingleNewsActivity.this, "Prepairing Image", Toast.LENGTH_SHORT).show();
            }
        };
        Picasso.with(getApplicationContext()).load(url).into(target);

    }

在您的清单中添加以下内容

 <application......android:noHistory="false">....</application>

相关内容

  • 没有找到相关文章

最新更新