我正在制作一个应用程序,允许用户使用android意图共享图像,但如何获取该URI
一个位图,无需将其保存到SD卡
我使用这个代码工作正常,但我不需要将此位图保存到SD卡
private Uri getImageUri(Context inContext, Bitmap inImage) {
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
inImage.compress(Bitmap.CompressFormat.JPEG, 100, bytes);
String path = Images.Media.insertImage(inContext.getContentResolver(), inImage, "title", null);
return Uri.parse(path);
}
Run Code Online (Sandbox Code Playgroud)
我需要获取该URI而不将该位图保存到SD卡
在使用EncryptedSharedPreferences之前,我的应用程序在使用 (minifyEnabled = true) 的发布模式下工作正常,将安全库 (版本 1.0.0-rc01)添加到我的应用程序后,应用程序在打开时崩溃,如果我使用 (minifyEnabled = false),应用程序可以正常工作好吧,我想我在proguard-rules.pro 中遗漏了一些东西,但我搜索了很多没有找到任何东西。
我正在使用collapsingToolbarlayoutwithnestedscrollview并且它工作正常,直到collapsingToolbarlayout完全崩溃并actionbar显示。这里nestedscrollview停止滚动,一些项目仍然隐藏。
这是我的 xml 文件
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
>
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginStart="48dp"
app:expandedTitleMarginEnd="64dp"
>
<FrameLayout
android:id="@+id/topLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
app:layout_collapseMode="parallax"
>
<ImageView
android:id="@+id/BigThumbnailImage"
android:layout_width="match_parent"
android:layout_height="200dp"
android:adjustViewBounds="true"
android:fitsSystemWindows="true"
android:src="@drawable/bg_health_news"
android:scaleType="fitXY" />
</FrameLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:layout_collapseMode="pin" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1"
>
<include
android:layout_width="match_parent"
android:layout_height="0dp"
layout="@layout/place_item_details_views"
android:layout_weight="1"
/> …Run Code Online (Sandbox Code Playgroud)