Need a bit of assistance [closed] - android

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I need help with my app, I created an app but it runs slowly, i guess because of the background and the images, now i read somwhere i should use threads and a loading screen until all app images are loaded so it runs faster. I dont know how to use threads, could you elp me or at least send me somewhere I can learn how to do it. One more thing i get an error whne i am using Activity extends fragment at loading sql something at getappid or something like that. is there an easy way to fix it? This app is made for android 4.0 - android L
My application can be found at the link below:
https://www.dropbox.com/s/22kchus06l2lf0u/app-release.apk
If you need more info like main xml and main java code i can paste it here...
Thanks anyway !

A very basic example of a Thread:
Thread thread = new Thread(
public void run(){
// Do stuff here
}
).start();
Everything inside the body of run() will be executed separately from the UI thread.

Related

How Retrofit library working faster than default AsyncTask? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Today i used retrofit library in my project instead of AsyncTask because it is faster than HttpUrlConnection but i am wondering how it is faster and what mechanism they are using. I searched about that but didn't get the accurate or satisfactory answer. Please help me out to understand the concept behind it.
Async task execute serially and are single threaded by default and they will wait for last call to complete before execution of next one and designed in a way so that to avoid common errors due to parallel running threads. Retrofit is not. It sends calls parallely and use ThreadPoolExecutor.

App is Lagging/Hanging. Why? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I made a simple profile in my android app and after uploading image to firebase storage my app is lagging in speed, the image uploaded is in KBs size and in my profile I am using a Navigation Drawer whose sliding animation is also hanging. I am unable to figure out whats going wrong.
Maybe your are using the Main thread for doing all the job. This is one reason for UI thread to hang(i.e) the app didn't hang but it waits for the main UI thread to complete its work.
Generally, the app hangs for this reason. As suggested by Commonsware track methods. Also, try using background threads instead of main thread.

Why does not allow network access in the main thread of a process in Android? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
can you explain why does not allow network access in the main thread of a process in Android?
If anybody can explain. Its will be helpful for me.
Because the main thread is responsible for all the UI (user interface) operations (it is also called the UI thread). Everything related to displaying stuff in the screen is done by it. So if you occupy the main thread with long operations such as a network operation, you will experience jitter in the screen and even ANR errors (Application Not Responding). In more recent versions of Android you will not even be allowed to do that as the application throws NetworkOnMainThreadException.
Till Donut it is used to create multiple threads from 1.6-2.3 that you was using before but if now you are using 3.0 or above then it is used to create single threaded model by using AsyncTask otherwise you ll get the NetworkOnMainThreadException.

is it possible to write a surface view without creating thread? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I want to write a surface View without creating a thread. is it possible to create a surfaceview ,without calling it from thread. if possible, please provide me a simple example.
Your question doesn't entirely make sense to me, but I'll try to answer what I think you're asking.
Yes, you can draw on a SurfaceView without creating a dedicated thread. This is not the recommended approach; you should do your rendering off the main thread so that the app doesn't become slow to respond, but it's not an absolute requirement.
I don't know if it counts as a "simple" example, but Grafika's "multi-surface test" draws on three overlapping SurfaceViews from the UI thread. These are static images, drawn once, so there's not really a need for a separate thread. If you start an animation on one of the surfaces (with the "bounce" button) it kicks off a new thread, because it's just easier to manage that way.

Adding Canvas within Canvas but as a separate Thread [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I'm creating a game where I use a custom view.I use onDraw(Canvas canvas) to draw my game with touch listeners.Now that I'm in need of a bitmap to be drawn on the same canvas but running on a different thread,I don't know how to proceed.The thread I create must draw the bitmap for a specific time only.I tried creating another custom view implementing runnable and drawing the bitmap i need.But i dont know where to call it.As I'm new to programming,guide me on how to deal with this idea of mine.Thanks in advance.
I recommend You to follow this order ( and how often to read ? That often, until You understand everything in each topic ).
There we go:
Basics to go :
Process
Thread
Multithreading
Multithreading 2
All about multithreading 1
Original docs about mt ( java )
mt programming java
Basics of android mt programming
I suppose, You now will have much to read.
But keep in mind, You must do it. Threading can bring You in situations, where You almost cen get lost, if one thread hangs up and or blocks some other thread. Therefore You need all the background information, because, once, You are in trouble, You then know, where to look first.
Have fun.

Categories

Resources