java - ButtonClikListner event is not being fired in Custom_dialogue | Android -


मेरी एक गतिविधि में Surah.java , मैं custom_dialogue का उपयोग कर रहा हूँ custom_dialog xml उपयोगकर्ता को संकेत देने के लिए उस संवाद बॉक्स में उस पर दो बटन होते हैं मैं बस दोनों बटनों के लिए क्लिक ईवेंट को संभालना चाहता हूं मैंने custom_dialog.java में हैंडलर लिखे हैं लेकिन इससे कोई फर्क नहीं पड़ा।

custom_dialog.xml <पूर्व> & lt; LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android "Android: layout_width =" match_parent "एंड्रॉइड: layout_height =" match_parent "एंड्रॉइड: अभिविन्यास =" ऊर्ध्वाधर "& gt; एंड्रॉइड: टेक्स्ट एपरेरेंस = "एंड्रॉइड: attr / textAppearanceMedium" एंड्रॉइड: textColor = एंड्रॉइड: एंड्रॉइड: एंड्रॉइड: एंड्रॉइड: एंड्रॉइड: "# एफएफएफएफएफएफ" / & gt; & lt; LinearLayout एंड्रॉइड: layout_width = "match_parent" एंड्रॉइड: layout_height = "wrap_content" एंड्रॉइड: गुरुत्व = "केंद्र" एंड्रॉइड: अभिविन्यास = "क्षैतिज" & gt; एंड्रॉइड: एंड्रॉइड: एंड्रॉइड: एंड्रॉइड: लेआउट_विड्थ = "9 0 डीपी" एंड्रॉइड: लेआउट_हेइट = "40 डीपी" एंड्रॉइड: लेआउट_अलग parentbottom = "true" एंड्रॉइड: टेक्स्ट = "ओके" / & gt; एंड्रॉइड: एंड्रॉइड: एंड्रॉइड: एंड्रॉइड: लेआउट_विड्थ = "9 0 डीपी" एंड्रॉइड: लेआउट_हेइट = "40 डीपी" एंड्रॉइड: लेआउट_अलग parentBottom = "true" एंड्रॉइड: टेक्स्ट = "रद्द करें" / & gt; & Lt; / LinearLayout & gt; & Lt; / LinearLayout & gt;

custom_dialog.java <पूर्व> पैकेज com.quran.peacequran; आयात एंड्रॉइड। एप। Importroid.os.Bundle; आयात करें android.view.View; आयात करें android.widget.Button; आयात करें android.widget.Toast; सार्वजनिक श्रेणी custom_dialog गतिविधि को बढ़ाता है {@ ओवरराइड संरक्षित शून्य पर क्रिएट (बंडल सहेजा गया इन्स्टैंसस्टेट) {super.onCreate (savedInstanceState); setContentView (R.layout.custom_dialog); बटन बटन = (बटन) findViewById (R.id.cancel); Button.setOnClickListener (नया देखें। OnClickListener () {@Override सार्वजनिक शून्य पर क्लिक करें (देखें वी) {टोस्ट। मेक टेक्स्ट (getApplicationContext), "कोई स्टोर नहीं", 5000) .show ();}}); }}

सूरत.जावा <पूर्व> पैकेज कॉम। कुरान.पीसकुरान; आयात करें java.util.ArrayList; आयात करें android.app.AlertDialog; आयात करें android.app.Dialog; आयात करें android.content.Context; आयात करें android.content.DialogInterface; Import android.content.Intent; आयात android.database.Cursor; Android.graphics आयात करें। टाइपफ़ेस; Importroid.os.Bundle; Import android.support.v4.app.Fragment; आयात करें android.view.LayoutInflater; आयात करें android.view.View; आयात करें android.view.View.OnLongClickListener; आयात करें android.view.ViewGroup; आयात करें android.widget.AdapterView; आयात करें android.widget.ArrayAdapter; आयात करें android.widget.Button; आयात करें android.widget.EditText; आयात करें android.widget.ListView; आयात करें android.widget.TextView; आयात करें android.widget.Toast; सार्वजनिक वर्ग की सुराह टुकड़ा फैली हुई है .... (सार्वजनिक अव्यवस्था पर गतिविधि) (बंडल से बचाया इन्स्टैंसस्टेट) {सुपर। चालू गतिविधि (सहेजे गए इन्स्टेंसस्टेट); MyAdapter एडाप्टर = नया MyAdapter (getActivity (), उत्पन्नडेटा ()); // 2. Activity_main.xml ListView ListView = (ListView) getView () से सूची देखें। FindViewById (R.id.listView1); ListView.setOnItemLongClickListener (नया एडाप्टरव्यू.ऑन इटैमक्लिकलिस्टनर () {सार्वजनिक बूलियन ऑन आईटेम लाँगक्लिक (एडाप्टरव्यू और लेफ्टिनेंट;? & Gt; आर्ग0, वी वी, इंट इंडेक्स, लम्ब अरजे 3) {टोस्ट। मेक टेक्स्ट (getActivity (), "थुल थुक!", टोस्ट। एलएनजीएचआईएचओआरटी) डायलॉग डायलॉग = नए डायलॉग (getActivity ()); डायलॉग .सेट कंटेंटव्यू (आर। लेटाउट कस्टमाइजोलोग); डायलॉग .सेटटिटल ("बुकमार्क सूरत?"); डायलॉग। शो (); वापसी वापस;}}) ; } ...}

  पर क्लिक करने के लिए नीचे कोड का उपयोग करें सूची के अंदर Surah.javaView.setOnItemLongClickListener (....... यदि आप डायलॉग ऑब्जेक्ट डायलॉग को बनाते हैं, तो। ऑब्जेक्ट (नया। क्लिक करें) {@Override public void onClick (देखें v)} // टूडो ऑटो-जनरेटेड विधि स्टब टोस्ट। मेक टेक्स्ट (getApplicationContext (), "यह काम करता है", 2000)। दिखाएं ();}});    

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -