0

the code compile without errors. but my phone is resetting when the code runs. I encode the main page "Blue.Class" objects with DragDrop.class to act and grab the function. DragDrop.class has static functions. for this reason I get an error while running the code. the same code is working on the normal page. The DragDrop page does not have an interface xml, it just consists of the code. my main goal is to play music but if the message is working in music.

public class DragDrop extends Application {

public static boolean sonuc=false;
public static ImageView suruklenen;
private static Context context;


public void onCreate() {
    super.onCreate();

}
public void DragDrop()
{

    DragDrop.context=getApplicationContext();
    mavi aaa=new mavi();

    aaa.musical();
}
public static Context getAppContext()
{
    return DragDrop.context;
}

public static final class MyClickListener implements View.OnTouchListener {
    @Override
    public boolean onTouch (View v, MotionEvent event) {
        ClipData.Item item = new ClipData.Item((CharSequence)v.getTag());
        String[] mimeTypes = { ClipDescription.MIMETYPE_TEXT_PLAIN };
        ClipData data = new ClipData(v.getTag().toString(), mimeTypes, item);
        View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(v);
        v.startDrag( data, //data to be dragged
                shadowBuilder, //drag shadow
                v, //local data about the drag and drop operation
                1);   //no needed flags
        System.out.println("Suruklenen id ne : "+v.getResources().getResourceName(v.getId()));

        suruklenen= (ImageView) v;

        System.out.println("Saklanan id ne : "+suruklenen.getResources().getResourceName(suruklenen.getId()));

        v.setVisibility(View.VISIBLE);

        Toast.makeText(getAppContext(), "Demo mesage but not working", Toast.LENGTH_SHORT).show();
        return false;
    }

}
James Z
  • 12,209
  • 10
  • 24
  • 44
tedris
  • 1,118
  • 2
  • 7
  • 11

0 Answers0