Skip to content Skip to sidebar Skip to footer

Android Findviewbyid In Service

I am doing something like when a service get started, a custom toast notification shows up. The custom toast view is defined in a xml file, the problem is that findViewById is not

Solution 1:

check this post

http://www.cloud208.com/blogica/Android+Custom+Toast+from+a+Service

According to that post, you can use an inflater with null as the second argument:

LayoutInflaterinflater= (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
Viewlayout= inflater.inflate(R.layout.toast_layout, null);

Post a Comment for "Android Findviewbyid In Service"