Showing PopupWindow

Put your problem here if it does not fit any of the other categories.

Help Me

Postby Jitendra Kumar » Thu Mar 06, 2008 8:00 am

Hi Mathematics!
In my map application i want a window to displayed on click listener but its not working Here is my code:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. private ImageButton.OnClickListener mUserClickListener =
  3.  
  4.     new ImageButton.OnClickListener() {        
  5.  
  6.  
  7.  
  8.     public void onClick(View v) {
  9.  
  10.        
  11.  
  12.         View mMain =(View)findViewById(R.id.Main);  
  13.  
  14.          
  15.  
  16.         PopupWindow mWindow = new PopupWindow(mMap.findViewById(R.id.Main),10,10);     
  17.  
  18.         mWindow.setFocusable(true);
  19.  
  20.         mWindow.show(mMap.findViewById(R.id.Main), 10, 10);
  21.  
  22.         mWindow.update(10,10, 10, 10);
  23.  
  24.                 ;
  25.  
  26.     }
  27.  
  28. };
Parsed in 0.031 seconds, using GeSHi 1.0.8.4
Jitendra Kumar
Developer
Developer
 
Posts: 49
Joined: Thu Mar 06, 2008 7:55 am
Location: Bangalore

Top

Postby plusminus » Fri Mar 07, 2008 12:52 am

Hello Jitendra Kumar,

what is the reason you once use mMap.find.. :?:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.      View mMain =(View)findViewById(R.id.Main);  
  2.      
  3.      PopupWindow mWindow = new PopupWindow(mMap.findViewById(R.id.Main),10,10);
Parsed in 0.030 seconds, using GeSHi 1.0.8.4


What exactly is not working :?:

Remember that findViewByID only finds Views in the Layout set via: setContentView() of the Activity you are calling it on.

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby Jitendra Kumar » Fri Mar 07, 2008 2:21 pm

well an error is coming saying

view is already having a parent
Jitendra Kumar
Developer
Developer
 
Posts: 49
Joined: Thu Mar 06, 2008 7:55 am
Location: Bangalore

Postby Jitendra Kumar » Fri Mar 07, 2008 2:23 pm

sorry 4 misprinting mMap is currentActivity
Jitendra Kumar
Developer
Developer
 
Posts: 49
Joined: Thu Mar 06, 2008 7:55 am
Location: Bangalore

Postby plusminus » Fri Mar 07, 2008 2:58 pm

Hello Jitendra,

just like it says. "R.id.main" is already used (probably in your layout) and therefor cannot be used as the content of the PopupWindow. (it cannot be at two different places at the same time).

What do you want to display in the PopupWindow :?:

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby Jitendra Kumar » Mon Mar 10, 2008 5:52 am

I want to display user profile on clicking what should i do?
Jitendra Kumar
Developer
Developer
 
Posts: 49
Joined: Thu Mar 06, 2008 7:55 am
Location: Bangalore

Top

Postby plusminus » Mon Mar 10, 2008 7:42 pm

Hello Jitendra,

to view contact information for a person, you would create an intent with the VIEW action and the data set to a URI representing that person.

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Exabot [Bot] and 11 guests