how can i print from service - android

my problem is that i don't know if the service is working,
and whats happend in it at all..
so i want to print out to console or LogCat from the functions.
thare is an option to do that or that cannot print from service?
i do that because i don't sure that the service is seuccess to create..
i just copy this code from this guide to understand.
http://androidexperinz.wordpress.com/2012/02/14/communication-between-service-and-activity-part-1/

By using the normal Log-classe. You'll see the logged content in the LogCat output window in Eclipse/IntelliJ

Related

Android Studio 3.0 Logcat continuously showing messages and does not stop

When I start debugging my App in Android Studio 3.0 and open the Logcat, it displays so many messages and warnings, but the problem is, it never stops, even when the debugging is completed and the App is terminated, it still prints so many messages continuously.
Can anybody help???
Since you are not debugging or running any application on the device you have connected. Hence, the logcat is displaying the logs generated by all the apps in the device as well as the system logs. Which makes the log cat window go nuts.
What you can do is.
On the top right corner of the log cat window, there is a filter config combo box. Select or create a filter of your own to filter out relevant logs.
The filter could be created using any details, it could be a process ID (PID), the tag name e.g I/ActivityManager: where I stands for Info, V for Verbose, D for Debug and so on.
You can add filter in your Logcat, and mention all the classes whose logs you want to discard.
In the field LogTag (shown in the pic) define a regex like this ^(?!Class A | Class B|#). Here Class A and Class B are the classes whose logs you don't want to see.That's it.
If you see no debuggable application then change it to your app name. If that wont help change the log level to error. Last thing you can try is to filter the results. Good luck!

Eclipse Logcat goes crazy

I was using my Eclipse Logcat crazy normally until yesterday where it started displaying messages without stop.
My message that I am printing using log.d are no longer printed to the log.
Or maybe they are but because of the huge number of messages printed they are gone.
The messages do not stop printing to the log whether I am using the app or not.
The only way to stop it is to unplug my device from the PC otherwise the messages will keep flushing to the logcat
Any suggestions ?
Thanks in advance :)
It sounds like you have no filtering of the log output and therefor sees output for every app on the phone.
Create a logcat filter with your application package name.
In the logcat window, go to "Saved filters", create a new one (if Eclipse hasnĀ“t autocreated one for you) by clicking plus-sign to add. Type a name of your filter and write your application package name under "by Application Name". Click "ok".
When you select it you only see logcat outputs for your specified app.

Can I catch LogCat messages when using the phone normally (not connected to the pc)?

I want to know if there's any way of recording logcat's messages when I'm testing my app with a real phone in a real environment. What I'm trying to achieve is to take my phone elsewhere and if anything goes wrong with my app, trace back why it went wrong. Especially if I give my app to a friend (or a boss) to try it out, they can't give me a lot of feedback on problems.
I could just print all the output to a .txt and then read it, but I'd like something a bit nicer
Any Ideas?
Yep ! Install aLogcat ! Very useful :)
aLogcat app
One way is to create your own Log.java function and then just change the import function to match your Class. In your Log.java you could write all the logs to some buffer and periodically save it to sdcard.
one more way is to
open adb shell
logcat > \sdcard\log.txt &
This will continue to run until restart of phone.

how to stop logs generated from/about my application

I want log collector to do not display any/minimal of the information about my application.
To achieve this I am not printing any logs from my application , and took care to my code should not generate any exception.
But still I am observing some logs about my application in Logcat.
I know this requirement is strange , but I really need this.
is there any way to tell Logcat to it should not display any information about my app..??
Pl. help me in this.
No, this is not possible.
If you want a "empty screen", then you can just create a filter (green + sign in LogCat UI).

Android app crash when progress dialog is on progress and app's orientation changed. why?

I have an application in which a progress dialog is shown. The progress dialog is working properly on any one orientation. But when I change the orientation during the progress dialog is on progress mode, then the app crashes.
So, now how can i fix this problem?
Update
Hello,
Thanks for your answer.
Here I have extracted the progress dialog code from the whole project and there is no problem.
You have said to see the Log cat file. But I do not understand the Logcat file.
Actually what type of error message will be on the Logcat file if the Activity.onCreate() function will create any problem?
If you have any senario please help me.
Best Regards,
gsmaker
Most chances, this is not the ProgressDialog fault.
Take into an account that Activity.onCreate() is called on every orientation change.
In any case, look at LogCat output, you will get more information about the FC.
in your AndroidManifest.xml, add in the used activity this:
android:screenOrientation="nosensor" android:configChanges="keyboardHidden|orientation"
Post the logcat, go to the terminal.. Type the directory /home/xyz/andorid -sdk-xxx/tools
once in this directory. type ./abd logcat
if you are in windows, direct via command prompt to tools directory. Type adb logcat on command line.
do this after you have started the emulator. Once the emulator is running you will see the logcat printing data every time something happens on ur emulator/device (whatever is running).
Now change the orientation and you will see data being printed onto the logcat.. When the app crashes, normally a message will be printed... In my advice you copy all that and paste it here, or better, just paste your code here. Only then can we help...

Categories

Resources