// Start of code for PopupWindow PopupWindow popupWindow = new PopupWindow(context); TextView textView = new TextView(context); popupWindow.setContentView(textView); LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); textView.setLayoutParams(layoutParams); textView.setText("My text goes here"); *popupWindow.showAtLocation(v, Gravity.CENTER, 0, 0); ????????????? * * * * * *I think you have to give textView instead of v in this line of code.* // End of code for PopupWindow
On Fri, Nov 25, 2011 at 5:01 PM, Mukesh Srivastav <mukicha...@gmail.com>wrote: > I am sure, the problem must with the context. > > Any ways, for the popupwindow, you could always go with the AlertDialog, > it will also work as popup. > > > On Fri, Nov 25, 2011 at 4:57 PM, Shajahan <lovesa...@gmail.com> wrote: > >> its not working...:( >> looking for some help >> >> On Nov 25, 4:20 pm, Mukesh Srivastav <mukicha...@gmail.com> wrote: >> > Let use know, if it works. >> > >> > Warm Regards, >> > *Mukesh Kumar*, >> > Android Consultant/Freelancer, >> > India,Hyderabad. >> > >> > >> > >> > On Fri, Nov 25, 2011 at 4:43 PM, Shajahan <lovesa...@gmail.com> wrote: >> > > Hi Mukesh, >> > >> > > Thanks for the reply. >> > >> > > am doing the same >> > > Context context = this; >> > >> > > On Nov 25, 4:04 pm, Mukesh Srivastav <mukicha...@gmail.com> wrote: >> > > > Code looks fine but the problem would be with context. >> > >> > > > do the following. >> > >> > > > 1.create a context class variable. some thing like this. >> > > > Context parentcontext; >> > >> > > > 2.Assign this in the onCreate Method. >> > >> > > > parentcontext = this; >> > >> > > > 3. then pass the parentcontext to the popupwindow >> > >> > > > or The another solution would be >> > >> > > > use getParentContext(), Might helps. >> > >> > > > On Fri, Nov 25, 2011 at 4:29 PM, Shajahan <lovesa...@gmail.com> >> wrote: >> > > > > I need to show the information about the field in an activity. For >> > > this i >> > > > > have created a buton and placed next to the field. >> > > > > Now when wants to know abt this field, he can click on that >> button and >> > > get >> > > > > the info. >> > > > > I am trying for PopupWindow. i have placed my code on the onClick >> event >> > > > > of the button >> > >> > > > > // Start of code for PopupWindow >> > > > > PopupWindow popupWindow = new PopupWindow(context); >> > > > > TextView textView = new TextView(context); >> > > > > popupWindow.setContentView(textView); >> > > > > LayoutParams layoutParams = new >> LayoutParams(LayoutParams.WRAP_CONTENT, >> > > > > LayoutParams.WRAP_CONTENT); >> > > > > textView.setLayoutParams(layoutParams); >> > > > > textView.setText("My text goes here"); >> > > > > popupWindow.showAtLocation(v, Gravity.CENTER, 0, 0); >> > > > > // End of code for PopupWindow >> > >> > > > > But the above doent help in showing the PopupWindow. >> > >> > > > > -- >> > > > > You received this message because you are subscribed to the Google >> > > > > Groups "Android Developers" group. >> > > > > To post to this group, send email to >> > > android-developers@googlegroups.com >> > > > > To unsubscribe from this group, send email to >> > > > > android-developers+unsubscr...@googlegroups.com >> > > > > For more options, visit this group at >> > > > >http://groups.google.com/group/android-developers?hl=en >> > >> > > > -- >> > > > Warm Regards, >> > > > *Mukesh Kumar*, >> > > > Android Consultant/Freelancer, >> > > > India,Hyderabad.- Hide quoted text - >> > >> > > > - Show quoted text - >> > >> > > -- >> > > You received this message because you are subscribed to the Google >> > > Groups "Android Developers" group. >> > > To post to this group, send email to >> android-developers@googlegroups.com >> > > To unsubscribe from this group, send email to >> > > android-developers+unsubscr...@googlegroups.com >> > > For more options, visit this group at >> > >http://groups.google.com/group/android-developers?hl=en- Hide quoted >> text - >> > >> > - Show quoted text - >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Android Developers" group. >> To post to this group, send email to android-developers@googlegroups.com >> To unsubscribe from this group, send email to >> android-developers+unsubscr...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/android-developers?hl=en > > > > > -- > Warm Regards, > *Mukesh Kumar*, > Android Consultant/Freelancer, > India,Hyderabad. > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > 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 post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en