跳过了Android Studio onCreate()方法

时间:2018-07-12 02:47:37

标签: java android android-studio android-fragments oncreate

我正在创建一个类似Instagram的应用,现在我很难过。用户选择图像时,他们单击下一步按钮,然后转到下一个场景以编写标题。但是发生的事情是用户只是上传图片而没有去现场添加字幕。他们直接添加到要添加字幕后显示的场景。

这些是我的LogCat上显示的错误:

07-10 15:23:21.150 30970-31309/tabian.com.hash E/ImageLoader: UIL doesn't support scheme(protocol) by default [com.google.android.gms.tasks.zzu@f488c6e]. You should implement this support yourself (BaseImageDownloader.getStreamFromOtherSource(...))
java.lang.UnsupportedOperationException: UIL doesn't support scheme(protocol) by default [com.google.android.gms.tasks.zzu@f488c6e]. You should implement this support yourself (BaseImageDownloader.getStreamFromOtherSource(...))
at com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStreamFromOtherSource(BaseImageDownloader.java:280)
at com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStream(BaseImageDownloader.java:99)
at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.downloadImage(LoadAndDisplayImageTask.java:291)
at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.tryCacheImageOnDisk(LoadAndDisplayImageTask.java:274)
at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.tryLoadBitmap(LoadAndDisplayImageTask.java:230)
at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.run(LoadAndDisplayImageTask.java:136)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)

GalleryFragment:

TextView nextScreen = view.findViewById(R.id.tvNext);
nextScreen.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        Log.d(TAG, "onClick: Navigating to the final share screen.");

        if(isTaskRoot ()){
            Intent intent = new Intent(GalleryFragment.this.getActivity(), NextActivity.class);
            intent.putExtra(getString(R.string.selected_image), mSelectedImage);
            GalleryFragment.this.startActivity(intent);
        }else{
            Intent intent = new Intent(GalleryFragment.this.getActivity(), AccountSettingsActivity.class);
            intent.putExtra(getString(R.string.selected_image), mSelectedImage);
            intent.putExtra(getString(R.string.return_to_fragment), getString(R.string.edit_profile_fragment));
            GalleryFragment.this.startActivity(intent);
            Objects.requireNonNull(GalleryFragment.this.getActivity()).finish();
        }
    }
});

UniversalImageLoader:

public static void setImage(String imgURL, ImageView image, final ProgressBar mProgressBar, String append){
    ImageLoader imageLoader = ImageLoader.getInstance();
    imageLoader.displayImage(append + imgURL, image, new ImageLoadingListener() {
        @Override
        public void onLoadingStarted(String imageUri, View view) {
            if(mProgressBar != null){
                mProgressBar.setVisibility(View.VISIBLE);
            }
        }

        @Override
        public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
            if(mProgressBar != null){
                mProgressBar.setVisibility(View.GONE);
            }
        }

        @Override
        public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
            if(mProgressBar != null){
                mProgressBar.setVisibility(View.GONE);
            }
        }

        @Override
        public void onLoadingCancelled(String imageUri, View view) {
            if(mProgressBar != null){
                mProgressBar.setVisibility(View.GONE);
            }
        }
    });
}

0 个答案:

没有答案