Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am implementing a dialog fragment which should open when i click on an item in a gridview of images. here is my code

public void onItemClick(AdapterView<?> arg0, View arg1, int position,
                long arg3) {
            // TODO Auto-generated method stub
            if(position==0)
            {
                    FragmentManager fm=getFragmentManager();

ImageDial1 id1=new ImageDial1();
                ImageDial1.show(fm,"image_title");

and the dialog fragment code is this

import android.app.DialogFragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public class ImageDial1 extends DialogFragment {
    public ImageDial1() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        return inflater.inflate(R.layout.imagefrag1, container, false);
      }


}

I am getting an error "cannot make a static reference to non static method show()" in this line

ImageDial1.show(fm,"image_title");

Where am i going wrong? Thanks

share

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.