相关疑难解决方法(0)

导航抽屉中的刷新标题

虽然我一直在四处寻找,但找不到正确的答案.在我的导航抽屉标题中,我向用户提供了他的图像和名称,但我也允许用户从应用程序中更改他/她的名字和图像.这些更改存储在会话管理器中.现在我想在导航抽屉标题中反映这些变化.一切都运行正常,因为当我关闭应用程序并再次运行它时,它会显示更改.所以现在我需要的是一种刷新导航抽屉头的方法.

从Profile Fragment中的库中选择图像.

 private void onSelectFromGalleryResult(Intent data) {

        String selectedImagePath = getPathFromCameraData(data, getActivity());

        Bitmap bm;
        BitmapFactory.Options options = new BitmapFactory.Options();
        options.inJustDecodeBounds = true;
        BitmapFactory.decodeFile(selectedImagePath, options);
        final int REQUIRED_SIZE = 200;
        int scale = 1;
        while (options.outWidth / scale / 2 >= REQUIRED_SIZE
                && options.outHeight / scale / 2 >= REQUIRED_SIZE)
            scale *= 2;
        options.inSampleSize = scale;
        options.inJustDecodeBounds = false;
        bm = BitmapFactory.decodeFile(selectedImagePath, options);
        bitmap = bm;
        profilephoto = BitMapToString(bm);

        session.setprofilepic(profilephoto);// make changes in session.
          profilepic.setImageBitmap(bm);

    }
Run Code Online (Sandbox Code Playgroud)

主页活动

@Override
    protected void …
Run Code Online (Sandbox Code Playgroud)

android android-fragments

3
推荐指数
1
解决办法
3826
查看次数

标签 统计

android ×1

android-fragments ×1