Check this out: https://developer.android.com/training/multiple-threads/communicate-ui.html
On Sat, Sep 14, 2013 at 5:40 PM, Amit Mangal <[email protected]> wrote: > What do u mean by ui thread ? Where is ui thread i didnt implemented any ui > thread > > On 14-Sep-2013 8:54 PM, "Dmitry" <[email protected]> wrote: >> >> I believe you should try to dismiss your popup in UI thread. >> >> On Thursday, September 12, 2013 5:44:25 AM UTC+4, Amit Mangal wrote: >>> >>> Any idea developers how to remove this crash ? >>> >>> On Thursday, September 12, 2013, Amit Mangal <[email protected]> >>> wrote: >>> > Problem is my popup window class shows message correct. i am having a 3 >>> > sec timer to dismiss popup. this dismiss popup is crashing my app here is >>> > my >>> > popup window class >>> > >>> > public class PopupMessage { >>> > >>> > private Context context ; >>> > SetCustomFonts customFonts ; >>> > private TextView tv_message_popup ; >>> > private ImageView iv_imageview ; >>> > Timer dismissPopupTimer ; >>> > View popupView ; >>> > PopupWindow message_Popup ; >>> > Timer timer; >>> > >>> > PopupMessage ( Context context ) { >>> > this.context = context ; >>> > } >>> > >>> > public void DisplayPopupMessage (String messageString, int >>> > resourceID, RelativeLayout relativeLayout, int alphaValue) { >>> > >>> > LayoutInflater inflater = >>> > (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) >>> > ; >>> > popupView = inflater.inflate(R.layout.message_popup, null); >>> > >>> > customFonts = new SetCustomFonts(context) ; >>> > tv_message_popup = (TextView) >>> > popupView.findViewById(R.id.id_tv_message_popup) ; >>> > tv_message_popup.setText(messageString) ; >>> > customFonts.SetBookFont(tv_message_popup) ; >>> > >>> > iv_imageview = (ImageView) >>> > popupView.findViewById(R.id.id_iv_imageview) ; >>> > iv_imageview.setBackgroundResource(resourceID) ; >>> > >>> > popupView.getBackground().setAlpha(alphaValue) ; >>> > >>> > message_Popup = new PopupWindow( >>> > popupView, >>> > LayoutParams.MATCH_PARENT, >>> > LayoutParams.WRAP_CONTENT); >>> > >>> > //message_Popup.showAtLocation(relativeLayout, >>> > Gravity.CENTER,0,0); >>> > message_Popup.showAsDropDown(relativeLayout); >>> > >>> > dismissPopupTimer = new Timer(); >>> > dismissPopupTimer.schedule(new TimerTask() { >>> > @Override >>> > public void run() { >>> > DismissPopupWindow(); >>> > } >>> > >>> > }, 3000, 10000); >>> > >>> > } >>> > >>> > public void DismissPopupWindow () { >>> > dismissPopupTimer.cancel() ; >>> > >>> > if (message_Popup.isShowing()) { >>> > message_Popup.dismiss() ; /// At this line app is crashing >>> > getting error >>> > message_Popup = null ; >>> > >>> > } >>> > } >>> > >>> > >>> > here is the error it is coming due to relative layout which i am >>> > passing for displaying popup. i want to display popup as a drop down thats >>> > why this relative layout i am passing >>> > >>> > popup is displaying correct but while dismissing app get crashed >>> > >>> > 09-12 00:42:03.599: E/WindowManager(15187): Activity >>> > com.app.fashion.TabbbActivity has leaked window >>> > android.widget.RelativeLayout{41e1cb28 V.E..... ......I. 0,0-720,78 >>> > #7f0a0141 app:id/id_rl_layout} that was originally added here >>> > 09-12 00:42:03.599: E/WindowManager(15187): android.view.WindowLeaked: >>> > Activity com.app.fashion.TabbbActivity has leaked window >>> > android.widget.RelativeLayout{41e1cb28 V.E..... ......I. 0,0-720,78 >>> > #7f0a0141 app:id/id_rl_layout} that was originally added here >>> > 09-12 00:42:03.599: E/WindowManager(15187): at >>> > android.view.ViewRootImpl.<init>(ViewRootImpl.java:409) >>> > 09-12 00:42:03.599: E/WindowManager(15187): at >>> > android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:218) >>> > 09-12 00:42:03.599: E/WindowManager(15187): at >>> > android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69) >>> > 09-12 00:42:03.599: E/WindowManager(15187): at >>> > android.widget.PopupWindow.invokePopup(PopupWindow.java:993) >>> > 09-12 00:42:03.599: E/WindowManager(15187): at >>> > android.widget.PopupWindow.showAsDropDown(PopupWindow.java:899) >>> > 09-12 00:42:03.599: E/WindowManager(15187): at >>> > android.widget.PopupWindow.showAsDropDown(PopupWindow.java:862) >>> > 09-12 00:42:03.599: E/WindowManager(15187): at >>> > com.app.fashion.PopupMessage.DisplayPopupMessage(PopupMessage.java:54) >>> > 09-12 00:42:03.599: E/WindowManager(15187): at >>> > com.app.fashion.SearchProductActivity$SaveRemoveAsyncTask.onPostExecute(SearchProductActivity.java:984) >>> > 09-12 00:42:03.599: E/WindowManager(15187): at >>> > com.app.fashion.SearchProductActivity$SaveRemoveAsyncTask.onPostExecute(SearchProductActivity.java:1) >>> > 09-12 00:42:03.599: E/WindowManager(15187): at >>> > android.os.AsyncTask.finish(AsyncTask.java:631) >>> > 09-12 00:42:03.599: E/WindowManager(15187): at >>> > android.os.AsyncTask.access$600(AsyncTask.java:177) >>> > 09-12 00:42:03.599: E/WindowManager(15187): at >>> > android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644) >>> > 09-12 00:42:03.599: E/WindowManager(15187): at >>> > android.os.Handler.dispatchMessage(Handler.java:99) >>> > 09-12 00:42:03.599: E/WindowManager(15187): at >>> > android.os.Looper.loop(Looper.java:153) >>> > 09-12 00:42:03.599: E/WindowManager(15187): at >>> > android.app.ActivityThread.main(ActivityThread.java:5297) >>> > 09-12 00:42:03.599: E/WindowManager(15187): at >>> > java.lang.reflect.Method.invokeNative(Native Method) >>> > 09-12 00:42:03.599: E/WindowManager(15187): at >>> > java.lang.reflect.Method.invoke(Method.java:511) >>> > 09-12 00:42:03.599: E/WindowManager(15187): at >>> > com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833) >>> > >>> > >>> > >>> > On Wed, Sep 11, 2013 at 10:29 PM, TreKing <[email protected]> wrote: >>> >> >>> >> On Wed, Sep 11, 2013 at 10:23 AM, Amit Mangal <[email protected]> >>> >> wrote: >>> >>> >>> >>> i want to develop a popup window class so that i could call that from >>> >>> any of my activity to display that popup window. >>> >>> >>> >>> also i want to add one button on that so that i could start activity >>> >>> from that. >>> >> >>> >> So what is stopping you? >>> >> >>> >> >>> >> ------------------------------------------------------------------------------------------------- >>> >> TreKing - Chicago transit tracking app for Android-powered devices >>> >> >>> >> -- >>> >> You received this message because you are subscribed to the Google >>> >> Groups "Android Developers" group. >>> >> To post to this group, send email to [email protected] >>> >> To unsubscribe from this group, send email to >>> >> [email protected] >>> >> For more options, visit this group at >>> >> http://groups.google.com/group/android-developers?hl=en >>> >> --- >>> >> You received this message because you are subscribed to the Google >>> >> Groups "Android Developers" group. >>> >> To unsubscribe from this group and stop receiving emails from it, send >>> >> an email to [email protected]. >>> >> For more options, visit https://groups.google.com/groups/opt_out. >>> > >>> > >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Android Developers" group. >> To post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/android-developers?hl=en >> --- >> You received this message because you are subscribed to the Google Groups >> "Android Developers" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/groups/opt_out. > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Android Developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. -- Michael Banzon http://michaelbanzon.com/ -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

