Hi

I have a popup that i am using as a menu so from that popup i need to start 
an activity and call a function in my main activity that created the popup.
When i try start an activity i get 
android.util.AndroidRuntimeException: Calling startActivity() from outside 
of an Activity  context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this 
really what you want?
Is there anyway around using the flag?

Secondly how can i call a function from my main activity that created the 
popup. My code is below and any helo would be great.

Thank you,

lass MainPopupWindow extends BetterPopupWindow {
    Context context;
    
    public MainPopupWindow(View anchor) {
        super(anchor);
    }

    public void showLikePopDownMenu()
    {
        super.showLikePopDownMenu(false);}
    
        @Override
    protected void onCreate() {
            // inflate layout
        LayoutInflater inflater =
            (LayoutInflater) 
this.anchor.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        ViewGroup root = (ViewGroup) inflater.inflate(R.layout.mainpopdown, 
null);
        
        LinearLayout addTag = (LinearLayout) 
root.findViewById(R.id.addTagButtonContainer);
        addTag.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent tagPickerIntent = new Intent(context, 
TagPicker.class);
                
                context.startActivity(tagPickerIntent);
            }
        });
        
        this.setContentView(root);
    }
    public void setContext(Context c)
    {context = c;}
}

==========================================
And this is created in the main activity by

moreButton = (ImageButton) this.findViewById(R.id.moreButton);
        moreButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                MorePopupWindow mpw = new MorePopupWindow(v);
                mpw.setContext(getApplicationContext());
                mpw.showLikePopDownMenu(-10,0,true);
            }
        });


-- 
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

Reply via email to