Tag Archives: android

Android customize output path and file name compile error [How to Solve]

API ‘variant.getPackageApplication()’ is obsolete and has been replaced with ‘variant.getPackageApplicationProvider()’.
It will be removed in version 5.0 of the Android Gradle plugin.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variant.getPackageApplication(), use -Pandroid.debug.obsoleteApi=true on the command line to display more information.
Affected Modules: app

Solution:
Modify
variant.getPackageApplication().outputDirectory
to
variant.getPackageApplicationProvider().get().outputDirectory

How to Solve Android wireless debug Error

1. Commands for ADB related wireless debugging:

adb tcpip < PORT>

connects Android devices wirelessly through TCPIP. Port is the port number, which can be specified at will (e.g. ADB TCPIP 6666)).

ADB connect
ADB: Usage: ADB connect host [: Port]

after entering ADB connect enter on the command line, the system prompts the usage of the command:
where host is the IP address of the Android device, port is the port number specified when using the ADB TCPIP command, and: connection is used between them (e.g. ADB connect 192.168.1.188:6666).

2. Commands to supplement ADB display/designated devices

ADB devices

View current device

adb -s < device>

it is used to operate the specified equipment we want

3. Specific operation of wireless connection

1. Connect Android device with USB data cable;

2. Enter ADB TCPIP command on the command line (for example: ADB TCPIP 9999);

3. Disconnect the USB data cable (the data cable is disconnected from the device);

4. On the command line, enter ADB connect & lt; host> [:<port>] Command (for example: ADB connect 192.168.1.188:9999)

4. Problems encountered

Open the terminal command window (or terminal in as) and enter the following command:

ADB TCPIP 6666
error: more than one device/emulator

an error is reported here: “error: more than one device/emulator”
then use the following command to view the device

adb devices
List of devices attached
D1CGAP1234506666 device
192.16. 31.55:5555 device

find the device d1cgap1234506666, which is the serial number of the Android mobile phone I need to conduct wireless debugging. 172.16 can be found in its mobile phone status information 31.39 is the IP address of Android phone (the location of checking the IP address of each phone may be different).

Continue using the following command:

adb -s D1CGAP1234506666 tcpip 6666
adb -s D1CGAP1234506666 connect 172.16. 31.39:6666
connected to 172.16. 31.39:6666

connected to host [: Port] indicates that the infinite connection is successful.

Android — problem — Open someone else’s program and report an error

It may be because there is no corresponding SDK in the local area. Click and double-click on the error URL to pop up a window for downloading

This should be the simplest solution, simple and rough, but it must be carried out in a smooth network environment

Another way is to modify the settings in the project

I haven’t learned this yet

 

Another case

This is the confidence to report mistakes

Error:Failed to open zip file.

Gradle’s dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
< a href=”syncProject”> Re-download dependencies and sync project (requires network)</ a>
< a href=”syncProject”> Re-download dependencies and sync project (requires network)</ a>

And the link below is useless

This may be because the gradle in the zip file is incomplete

Select preference

Then search for gradle in the window

Then click gradle

Select use local gradle contribution

Then enter the local gradle directory below, such as/applications/Android studio. App/contents/gradle/gradle-2.14.1

Then close and reopen the project, there will be no such error reports, but there may be other SDK like errors. Refer to the above

 

How to view the local gradle

/.gradle/wrapper/dists/gradle-2.2-all

This is the directory of the local gradle

Find it in the terminal and use the open. Command to directly open the folder

[Solved] Android Warning: android.content.res.Resources$NotFoundException: Resource ID #0x7f08010a

1.question

Running a page on my oppo machine doesn’t crash, but running a page on Hongmi Android 5.1 does. The crash information is as follows

/Timeline(11600): Timeline: Activity_launch_request time:61313216
I/WtProcessController( 3721): FOREGROUND INFO: name=com.appsinnova.android.keepshare uid=10234 pid=11600 TaskId:1079
W/ResourceType(11600): Failure getting entry for 0x7f08010a (t=7 e=266) (error -75)
I/ViewRootImpl(11600): CPU Rendering VSync enable = true
E/RecyclerView(11600): No adapter attached; skipping layout
W/ResourceType(11600): Failure getting entry for 0x7f08010a (t=7 e=266) (error -75)
D/AndroidRuntime(11600): Shutting down VM
E/AndroidRuntime(11600): FATAL EXCEPTION: main
E/AndroidRuntime(11600): Process: com.appsinnova.android.keepshare, PID: 11600
E/AndroidRuntime(11600): android.content.res.Resources$NotFoundException: Resource ID #0x7f08010a
E/AndroidRuntime(11600):        at android.content.res.Resources.getValue(Resources.java:1313)
E/AndroidRuntime(11600):        at android.content.res.MiuiResources.getValue(MiuiResources.java:146)
E/AndroidRuntime(11600):        at android.content.res.Resources.getDrawable(Resources.java:832)
E/AndroidRuntime(11600):        at android.widget.Editor.updateCursorPosition(Editor.java:1764)
E/AndroidRuntime(11600):        at android.widget.Editor.updateCursorsPositions(Editor.java:1597)
E/AndroidRuntime(11600):        at android.widget.TextView.getUpdatedHighlightPath(TextView.java:5257)
E/AndroidRuntime(11600):        at android.widget.TextView.onDraw(TextView.java:5444)
E/AndroidRuntime(11600):        at android.view.View.draw(View.java:15261)
E/AndroidRuntime(11600):        at android.view.View.updateDisplayListIfDirty(View.java:14197)
E/AndroidRuntime(11600):        at android.view.View.getDisplayList(View.java:14219)
E/AndroidRuntime(11600):        at android.view.View.draw(View.java:14989)
E/AndroidRuntime(11600):        at android.view.ViewGroup.drawChild(ViewGroup.java:3408)
E/AndroidRuntime(11600):        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3201)
E/AndroidRuntime(11600):        at android.view.View.updateDisplayListIfDirty(View.java:14192)
E/AndroidRuntime(11600):        at android.view.View.getDisplayList(View.java:14219)
E/AndroidRuntime(11600):        at android.view.View.draw(View.java:14989)
E/AndroidRuntime(11600):        at android.view.ViewGroup.drawChild(ViewGroup.java:3408)
E/AndroidRuntime(11600):        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3201)
E/AndroidRuntime(11600):        at android.view.View.updateDisplayListIfDirty(View.java:14192)
E/AndroidRuntime(11600):        at android.view.View.getDisplayList(View.java:14219)
E/AndroidRuntime(11600):        at android.view.View.draw(View.java:14989)
E/AndroidRuntime(11600):        at android.view.ViewGroup.drawChild(ViewGroup.java:3408)
E/AndroidRuntime(11600):        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3201)
E/AndroidRuntime(11600):        at android.view.View.updateDisplayListIfDirty(View.java:14192)
E/AndroidRuntime(11600):        at android.view.View.getDisplayList(View.java:14219)
E/AndroidRuntime(11600):        at android.view.View.draw(View.java:14989)
E/AndroidRuntime(11600):        at android.view.ViewGroup.drawChild(ViewGroup.java:3408)
E/AndroidRuntime(11600):        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3201)
E/AndroidRuntime(11600):        at android.view.View.draw(View.java:15264)
E/AndroidRuntime(11600):        at android.widget.FrameLayout.draw(FrameLayout.java:598)
E/AndroidRuntime(11600):        at android.widget.ScrollView.draw(ScrollView.java:1689)
E/AndroidRuntime(11600):        at android.view.View.updateDisplayListIfDirty(View.java:14197)

2 analysis process

The Key log is as follows. It is obvious that the resource ID is # 0x7f08010a

android.content.res.Resources$NotFoundException: Resource ID #0x7f08010a

Next, we went to the resource file and found that it was et_ search_ The cursor control ID, we will find the specific layout, and then look at its call. Obviously, here

it is found that the layout is under drawable-v24, and the image resources are put into drawable-v24, resulting in no images below 7.0 can be found

I corrected the above, so there are only two displays

3 solutions

Create a new Android project under drawable directory_search_Cursor layout is OK

How to connect Android mobile phone with ADB & reasons and solutions of unable to connect to 192.168.1.100:5555

Programmer algorithm practice must read, common Java API skills to share>>>

There are two ways to connect a mobile phone with an ADB:

1, wifi

2, usb.

1. Connect the mobile phone through WiFi and ADB

Enter the command in the CMD of PC:

adb connect 192.168.1.100

If the connection is successful, you can enter the Android shell

In the process of my own operation, the PC can ping through the mobile phone, but there is a little problem when the ADB connects to the mobile phone, indicating that it is unable to connect to 192.168.1.100:5555. What is the reason?The original mobile phone’s default ADB service is not turned on, otherwise, other people’s ADBS can connect at will, isn’t it very unsafe?Therefore, we need to find a way to turn on the ADB service on the mobile phone. What’s going on?First, download an Android emulator on your mobile phone (of course, if you have one, you don’t need to download it), then switch to the root permission and execute the following command to open the ADB service:

su

setprop service.adb.tcp.port 5555

stop adbd

start adbd

Then the ADB can connect to the mobile phone, as shown in the figure:

2. Connect the mobile phone through USB and ADB

I connected the mobile phone to the PC through USB, but the ADB didn’t connect the mobile phone, so I downloaded the Android driver and installed it. So the ADB is connected to the phone. So you can use the ADB shell to enter the Android system of the mobile phone

Pay attention to the way of USB connection, do not need ADB connect xxx.xxx.xxx.xxx

  

Comparison: Method 1 has higher requirements, needs to rely on a stable network, and the operation is troublesome. Method 2 is much simpler

Of course, first of all, open the developer option – > USB debugging is recommended to connect with 360 mobile assistant, install USB driver and debug development interface before exiting

After the successful connection of the ADB, you can use windows CMD terminal mode to debug, and of course, you can also use Android Studio – > Tools-> Android-> Android device monitor debugging:

  

[Android test] solution to error closed after ADB shell carriage return

Programmer algorithm practice must read, common Java API skills to share>>>

Phenomenon 1: when the mobile phone is connected to USB for monkey test, start a CMD window to input again, and error closed appears after the ADB shell returns. In some cases, some mobile phones will appear this phenomenon

Phenomenon 2: when the mobile phone is connected to USB for eclipse debugging or app installation, Eclispe console prompts: failed to install * *. APK on device ‘019417a3’: unable to open sync connection

I think the reasons for the two phenomena are the same

The solution is as follows:

First: restart the computer, then check the mobile phone to the computer and start eclipse

Second: mobile phone – Settings – Application – Development – USB debugging, open and close again

Third: restart the phone, USB debugging on and off again

Fourth: try “ADB kill server” and then “ADB start server” under CMD

In my opinion, the second and third methods are more practical

Android about LIBS, jnilibs library basic instructions and conflict resolution

Programmer algorithm practice must read, common Java API skills to share>>>

Recently, we encountered a problem in the development, because the project needs to integrate different SDKs. The corresponding. So files are also different

There are some problems in the introduction of. So Library in LIBS

For example, to integrate a third-party NDK Library:

If you are in eclipse, you need to put it in the corresponding library directory under LIBS
in Android studio, the jnilibs directory in main will be matched by default. If there is no directory, you need to create it manually. And the name of the library can’t be changed at will

But there is a problem here. If you are using Android studio but want to use the Library under LIBS, you need to specify the location of the library manually

Add the following configuration in build.gradle under app

Android {

sourcesets {
main {
jnilibs. Srcdirs = [‘libs’]

}

}

}
1
2
3
4
5
6
7
8
9
10
11
when integrating the third-party service provider’s SDK, most of them will let you download demo, Or the SDK collection package allows you to directly copy the entire LIBS or jnilibs directory and merge local projects. This will cause problems

Take iFLYTEK voice development documents, baidu voice development documents and Aurora push documents as examples

IFLYTEK’s document states that all the files in the LIBS directory will be copied to the LIBS directory in its own project

Baidu’s is to copy all the files under app/SRC/main/jnilibs to its own project

Aurora documents are more humanized

If you want to integrate the first two SDKs, there will obviously be conflicts

After the build configuration, the jnilibs library cannot be recognized. But if it is not configured, LIBS library cannot recognize it
as a result, there is always one library that cannot load the. So file

So if you want to solve this problem, discard the previous documents

A little digression

Most of the NDK libraries provided by the third party are complete sets, in order to adapt to different CPU manufacturers, such as Qualcomm and MediaTek

When copying beiku, a complete set of copy into the project, generally four or five, baidu voice. So library all import words add up to more than 15m

Therefore, this is also a factor to be considered when choosing a third-party service<
take my demo as an example. Recently, the company has to choose a voice solution, so we have experienced Baidu’s and iFLYTEK’s for the time being

If you want to reduce the size of the installation package through the so library, you can also dynamically select the. So library to be added

Configure in build.gradle under app:

NDK {
// select the. So Library of the corresponding CPU type to be added
abifilters’ armeabi ‘,’armeabi-v7a’,’arm64-v8a ‘
// you can also add’ x86 ‘,’x86’_ In this way, the loading library can be specified

Reference to related documents:
some problems should be paid attention to when using so library with Android dynamic loading
detailed explanation of directory under Android jnilibs (. So file)

Project demo reference:
Android collection demo
— –
Author: wapchief
source: CSDN
Original: https://blog.csdn.net/wapchief/article/details/78229097
Copyright notice: This article is the original article of the blogger, please attach the blog link if you reprint it

[Solved] Android Warning: Cannot call this method while RecyclerView is computing a layout or scrolling

1 error

java.lang.IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling androidx.recyclerview.widget.RecyclerView{24d6f3b VFED.V... ......ID 0,657-1074,1911 #7f090143 app:id/recyclerView}, adapter:com.appsinnova.android.keepshare.widget.PopupLanguage$LanguageListAdapter@57e8658, layout:androidx.recyclerview.widget.LinearLayoutManager@3de33b1, context:com.appsinnova.android.keepshare.account.SettingActivity@4b834ad
        at androidx.recyclerview.widget.RecyclerView.assertNotInLayoutOrScroll(RecyclerView.java:3051)
        at androidx.recyclerview.widget.RecyclerView$RecyclerViewDataObserver.onChanged(RecyclerView.java:5536)
        at androidx.recyclerview.widget.RecyclerView$AdapterDataObservable.notifyChanged(RecyclerView.java:12253)
        at androidx.recyclerview.widget.RecyclerView$Adapter.notifyDataSetChanged(RecyclerView.java:7354)
        at com.appsinnova.android.keepshare.widget.PopupLanguage$LanguageListAdapter$convert$1.onCheckedChanged(PopupLanguage.kt:108)
        at android.widget.CompoundButton.setChecked(CompoundButton.java:171)
        at com.appsinnova.android.keepshare.widget.PopupLanguage$LanguageListAdapter.convert(PopupLanguage.kt:104)
        at com.appsinnova.android.keepshare.widget.PopupLanguage$LanguageListAdapter.convert(PopupLanguage.kt:98)
        at com.chad.library.adapter.base.BaseQuickAdapter.onBindViewHolder(BaseQuickAdapter.java:937)
        at com.chad.library.adapter.base.BaseQuickAdapter.onBindViewHolder(BaseQuickAdapter.java:66)
        at androidx.recyclerview.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:7065)
        at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:7107)
        at androidx.recyclerview.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:6012)
        at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6279)
        at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6118)
        at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6114)
        at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2303)
        at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1627)
        at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1587)
        at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:665)
        at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:4134)
        at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:3851)
        at androidx.recyclerview.widget.RecyclerView.onLayout(RecyclerView.java:4404)
        at android.view.View.layout(View.java:21112)
        at android.view.ViewGroup.layout(ViewGroup.java:6400)
        at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1828)
        at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1656)
        at android.widget.LinearLayout.onLayout(LinearLayout.java:1565)
        at android.view.View.layout(View.java:21112)

Where is the problem code

            helper.getView<CheckBox>(R.id.selecte_state).setOnCheckedChangeListener { buttonView, isChecked ->
                if (isChecked) {
					adapter.notifyDataSetChanged()
                }
            }

sets the status listener in checkbox, and then calls

in notifyDataSetChanged ().

Method for the first line of error log

assertNotInLayoutOrScroll

Let’s look at the source code

    /**
     * Checks if RecyclerView is in the middle of a layout or scroll and throws an
     * {@link IllegalStateException} if it <b>is</b>.
     *
     * @param message The message for the exception. Can be null.
     * @see #assertInLayoutOrScroll(String)
     */
    void assertNotInLayoutOrScroll(String message) {
        if (isComputingLayout()) {
            if (message == null) {
                throw new IllegalStateException("Cannot call this method while RecyclerView is "
                        + "computing a layout or scrolling" + exceptionLabel());
            }
            throw new IllegalStateException(message);
        }
        if (mDispatchScrollCounter > 0) {
            Log.w(TAG, "Cannot call this method in a scroll callback. Scroll callbacks might"
                            + "be run during a measure & layout pass where you cannot change the"
                            + "RecyclerView data. Any method call that might change the structure"
                            + "of the RecyclerView or the adapter contents should be postponed to"
                            + "the next frame.",
                    new IllegalStateException("" + exceptionLabel()));
        }
    }

We found that the iscomputinglayout() function is true and throws this exception, so let’s take a look at the implementation of this function

We can see that recycleview is locked down. How can we solve this problem?As mentioned above, wait for the view to load or use the handler

Treatment

2 solutions

Method 1

            helper.getView<CheckBox>(R.id.selecte_state).setOnCheckedChangeListener { buttonView, isChecked ->
                if (isChecked) {
                     Handler().post(Runnable {
                        selectedIndex = position
                        listener(helper.itemView, item!!.languageIndex)
                    })
                }
            }

Method 2

            helper.getView<CheckBox>(R.id.selecte_state).setOnCheckedChangeListener { buttonView, isChecked ->
                if (isChecked) {
                    recycleView.post(Runnable {
                        selectedIndex = position
                        listener(helper.itemView, item!!.languageIndex)
                    })
                }
            }

 

[Solved] Android.os.networkonmainthreadexception exception of Android

Load the network image in mainactivity. The code is as follows:

publicclassNetImageActivityextendsActivity{

StringimageUrl="http://content.52pk.com/files/100623/2230_102437_1_lit.jpg";
BitmapbmImg;
ImageViewimView;

@Override
publicvoidonCreate(BundlesavedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
imView=(ImageView)findViewById(R.id.imageViewId);
imView.setImageBitmap(returnBitMap(imageUrl));
}

publicBitmapreturnBitMap(Stringurl){
URLmyFileUrl=null;
Bitmapbitmap=null;
try{
myFileUrl=newURL(url);
}catch(MalformedURLExceptione){
e.printStackTrace();
}
try{
HttpURLConnectionconn=(HttpURLConnection)myFileUrl
.openConnection();
conn.setDoInput(true);
conn.connect();
InputStreamis=conn.getInputStream();
bitmap=BitmapFactory.decodeStream(is);
is.close();
}catch(IOExceptione){
e.printStackTrace();
}
returnbitmap;
}
}

error is reported, and the information is as follows

Causedby:android.os.NetworkOnMainThreadException
atandroid.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1145)
atjava.net.InetAddress.lookupHostByName(InetAddress.java:385)
atjava.net.InetAddress.getAllByNameImpl(InetAddress.java:236)
atjava.net.InetAddress.getAllByName(InetAddress.java:214)
atcom.android.okhttp.internal.Dns$1.getAllByName(Dns.java:28)
atcom.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:216)
atcom.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:122)
atcom.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:292)
atcom.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255)
atcom.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206)
atcom.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345)
atcom.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:89)

android.os.networkonmainthreadexception means not to access the network in the main thread. Since Android 3.0, it has forced the program not to access the network in the main thread, so it should be placed in an independent thread

in development, in order to prevent the access network from blocking the main thread, it is generally necessary to put the access network in the independent thread or asynchronous thread asynctask

1. If you want to ignore these mandatory policy problems, you can add to oncreate() method

StrictMode.ThreadPolicypolicy=newStrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);

and add @ suppresslint (“newapi”) to the method to try again, OK

2. Put network access into a separate thread: 

publicclassNetImageActivityextendsActivity{

StringimageUrl="http://content.52pk.com/files/100623/2230_102437_1_lit.jpg";
Bitmapbitmap;
ImageViewimView;

@Override
publicvoidonCreate(BundlesavedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
imView=(ImageView)findViewById(R.id.imageViewId);
ThreadimageViewHander=newThread(newNetImageHandler());
imageViewHander.start();
}


classNetImageHandlerimplementsRunnable{
@Override
publicvoidrun(){
try{
URLurl=newURL(imageUrl);
HttpURLConnectionconn=(HttpURLConnection)url.openConnection();
conn.setDoInput(true);
conn.connect();
InputStreamis=conn.getInputStream();
bitmap=BitmapFactory.decodeStream(is);
//Send a message to notify the UI component to display the image
handler.sendEmptyMessage(0);
is.close();
}catch(IOExceptione){
e.printStackTrace();
}
}
}

Handlerhandler=newHandler(){
@Override
publicvoidhandleMessage(Messagemsg){
if(msg.what==0){
imView.setImageBitmap(bitmap);
}
}
};

}

3. Put network access into asynctask. The code is as follows: 2

publicclassNetImageActivityextendsActivity{

StringimageUrl="http://content.52pk.com/files/100623/2230_102437_1_lit.jpg";
ImageViewimView;

@Override
publicvoidonCreate(BundlesavedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
imView=(ImageView)findViewById(R.id.imageViewId);
loadImage();
}

privatevoidloadImage(){
newAsyncTask<String,Void,Bitmap>(){
//This method runs in a background thread, so the UI cannot be updated in this thread, which is the main thread
@Override
protectedBitmapdoInBackground(String...params){
Bitmapbitmap=null;
try{
Stringurl=params[0];
URLHttpURL=newURL(url);
HttpURLConnectionconn=(HttpURLConnection)HttpURL.openConnection();
conn.setDoInput(true);
conn.connect();
InputStreamis=conn.getInputStream();
bitmap=BitmapFactory.decodeStream(is);
is.close();
}catch(IOExceptione){
e.printStackTrace();
}
returnbitmap;
}

//After the execution of doInBackground is completed, the onPostExecute method will be called by the UI thread.
// The results of the background calculation will be passed to the UI thread via this method and displayed to the user in the interface.
@Override
protectedvoidonPostExecute(Bitmapbitmap){
if(bitmap!=null){
imView.setImageBitmap(bitmap);
}
}
}.execute(imageUrl);
}

}