last day (15 days later) » 

14:27
0
A: Sending data from Servica to BroadcasReceiver to update progress bar

RicardoHere is how you can do it. In your Main Activity: public class MainActivity extends Activity { private BroadcastReceiver myReceiver = new BroadcastReceiver { ProgressBar pBar = (ProgressBar) findViewById(R.id.progressBar); @Override public void onReceive(Context...

OnCreate ... shouldn't be in Service? and how then call myReceiver from service?
onCreate of your main activity. In your service just call the sendBroadcast like I mentioned in my answer.
FATAL EXCEPTION: main, java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.serwis/com.example.serwis.MainActivity}: java.lang.NullPointerException
What code is in the line of the exception?
There is no line. It's copied from LogCat
14:27
Yes, but your logcat refers to a line in your code where the error occurred. I need to know where the null pointer was found to be able to help you further.
LogCat doesn't refer me to any line. I passed LogCat info below my question
Hi
First thing, you see in your logcat, for example, this line: 1-23 14:20:23.723: E/AndroidRuntime(20992): at com.example.serwis.MainActivity$1.(MainActivity.java:19)
?
The number 19, after MainActivity.java refers to the line in your code where the error occurred.
I can see from the rest of your logcat that your problem was at android.app.Activity.findViewById(Activity.java:1637). So it has nothing to do with your BroadcastReceiver implementation. You are trying to call a findViewById() with a null object, probably a null inflater.
this is line number 19: ProgressBar pBar = (ProgressBar) findViewById(R.id.progressBar);
thanks for info about logcat
did you call setContentView(R.layout.your_layout) where your progress bar is located?
no... and it's look like, this is solution
14:33
Please, accept my answer if it works.
okey, just want to check if it work
Thank you
You are welcome. Glad I could help.

last day (15 days later) »