xml - Transparent dialog in android -
i using checkboxes , displayed on dialogbox(dynamically).the next thing need make dialog box transparent.i tried many methods,but failed(wasted entire day behind this).can please give me solution
nb:currently getting white colour inside dialog box(not transparent) below code..... transparent_alert.java
public class transparent_alert extends activity{ string tag="transparent_alert class"; static final string key_userid = "userid"; string errormsg = "", user_id; sessionmanager session; int k=0; intrested_in_adapter m_adapter; private builder mdialog; private dialog alertdialog; list<requestencapsulation> offferlist; list<offeringencapsulation> offerlist; public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); hashmap<string, string> user = session.getuserdetails(); user_id = user.get(sessionmanager.key_id); setcontentview(r.layout.requests); new serviceclass1().execute(); } class serviceclass1 extends asynctask<void, void, string> { @override protected string doinbackground(void... params) { // todo auto-generated method stub try { userfunctions usf = new userfunctions(); log.e(tag,"user_id"+user_id); jsonobject json2 = usf.intrestlist(user_id); jsonarray contacts = json2 .getjsonarray("interested_list"); (int j = 0; j < contacts.length(); j++) { log.e(tag, "intrestedin forloop"); jsonobject c = contacts .getjsonobject(j); requestencapsulation bean = new requestencapsulation(); bean.setintrest_id(c .getstring("interested_id")); bean.setintrest_name(c .getstring("interested_name")); bean.setkey_status(c .getstring("status")); if (c.getstring("interested_info") .equals("null")) { bean.setinterested_info(""); } else { bean.setinterested_info(c .getstring("interested_info")); } offferlist.add(bean); } k=offferlist.size(); } catch (exception e) { e.printstacktrace(); } return null; } protected void onpostexecute(string result) { new serviceclass2().execute(); } } class serviceclass2 extends asynctask<void, void, string> { @override protected string doinbackground(void... params) { // todo auto-generated method stub try { userfunctions usf1 = new userfunctions(); jsonobject json3= usf1.offerlistlist(user_id); jsonarray contacts1 = json3.getjsonarray("offer_list"); (int = 0; < contacts1.length(); i++) { log.e(tag,"inside offering loop"); jsonobject d= contacts1.getjsonobject(i); log.e(tag,"created json object"); requestencapsulation bean=new requestencapsulation(); log.e(tag,"object created offeringencapsulation"); bean.setintrest_id(d .getstring("offer_id")); log.e(tag, "offerid is::" + d.getstring("offer_id")); bean.setintrest_name(d .getstring("offer_name")); log.e(tag, "offer name is::" + d.getstring("offer_name")); bean.setkey_status(d.getstring("status")); log.e(tag, "status is" + d.getstring("status")); // if (d.getstring("offer_info").equals( // "null")) { // bean.setinterested_info(d // .getstring("interested_info")); // } else { // bean.setinterested_info(d // .getstring("interested_info")); // // } offferlist.add(bean); log.e(tag,"process bean1 completed"); ; } } catch (jsonexception e) { // todo auto-generated catch block e.printstacktrace(); } return null; } protected void onpostexecute(string result) { new serviceclass2().execute(); context c = getparent(); m_adapter = new intrested_in_adapter( transparent_alert.this, r.layout.intrestedin, offferlist); mdialog = new alertdialog.builder(c); mdialog.settitle("intrested in"); mdialog.setadapter(m_adapter, new dialoginterface.onclicklistener() { public void onclick( dialoginterface dialog, int item) { } }); alertdialog = mdialog.create(); alertdialog.show(); } }
intrestedin.xml
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <checkbox android:id="@+id/checkbox" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textcolor="#000000" /> </linearlayout>
intrested_in_adapter.java
public class intrested_in_adapter extends arrayadapter<requestencapsulation>{ checkbox checkbox; checkbox checkbox1; private list<requestencapsulation> alist; private list<offeringencapsulation> alist1; public intrested_in_adapter(context context, int textviewresourceid) { super(context, textviewresourceid); } public intrested_in_adapter(context context, int resource, list<requestencapsulation> items) { super(context, resource,items); this.alist=items; log.e("inside constructor","list size is:"+alist.size()); } @override public requestencapsulation getitem(int position) { return alist.get(position); } public long getid(int position) { return position; } @override public view getview(int position, view convertview, viewgroup parent) { // viewholder mholder; requestencapsulation p = getitem(position); if (convertview == null) { log.e("inside convertview","inside convertview"); convertview = layoutinflater.from(getcontext()).inflate(r.layout.intrestedin, parent, false); } if (p != null) { // mholder = new viewholder(); checkbox=(checkbox)convertview.findviewbyid(r.id.checkbox); if(alist.get(position).getkey_status().equalsignorecase("true")) { checkbox.setselected(true); }else{ checkbox.setselected(false); } checkbox.settext(alist.get(position).getintrest_name()); } return convertview; } }
maifest.xml
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.gatekeeper.dropswitch" android:installlocation="auto" android:largeheap="true" android:versioncode="3" android:versionname="1.1" > <uses-sdk android:minsdkversion="9" android:targetsdkversion="18" /> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="android.permission.access_network_state" /> <uses-permission android:name="android.permission.wake_lock" /> <uses-permission android:name="com.google.android.c2dm.permission.receive" /> <permission android:name="com.example.gate.permission.c2d_message" android:protectionlevel="signature" /> <uses-permission android:name="com.example.gate.permission.c2d_message" /> <uses-permission android:name="android.permission.vibrate" /> <application android:allowbackup="true" android:icon="@drawable/gate_logo" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name="com.example.gate.redirectclass" android:label="@string/app_name" android:screenorientation="portrait" android:theme="@android:style/theme.notitlebar" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:theme="@android:style/theme.notitlebar" android:name="com.example.gate.userpage" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.guardpage" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.transparent_alert" android:screenorientation="portrait" android:theme="@android:style/theme.translucent.notitlebar.fullscreen" > </activity> <activity android:name="com.example.gate.registerpage" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.profileactivity" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.selectbuttonfromrequestclass" android:screenorientation="portrait"> </activity> <activity android:name="com.example.gate.actionclass" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.tabgroup1activity" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.tabgroup2" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.tabgroup3" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.mainactivity" android:screenorientation="portrait"> </activity> <activity android:name="com.example.gate.home" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.homenext" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.family" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.familymain" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.familyedit" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.guestmain" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.guest" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.guestedit" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.services" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.addprovider" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.addservices" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.offering" android:screenorientation="portrait" android:windowsoftinputmode="adjustpan" > </activity> <activity android:name="com.example.gate.interest" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.accesspreferences" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.actionactivity" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.messageclass" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.report" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.requestclass" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.notify" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.rsidenceinfo" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.latestservice" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.guardactiongroup" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.guardprofilegroup" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.guardinfogroup" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.otherresidence" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.directoryguardedit" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.guardaction" android:screenorientation="portrait" > </activity> <activity android:name="com.skype.raider.main" android:configchanges="keyboardhidden|orientation" android:launchmode="singletask" android:windowsoftinputmode="adjustresize" > <intent-filter android:priority="0" > <action android:name="android.intent.action.call_privileged" /> <category android:name="android.intent.category.default" /> <data android:scheme="tel" /> </intent-filter> </activity> <activity android:name="com.example.gate.guardinfo" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.guardprofile" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.video" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.guard_message_class" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.guard_report_class" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.guard_notify_class" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.guard_request_class" android:screenorientation="portrait" > </activity> <activity android:name="com.example.gate.guard_addnew_residence" android:screenorientation="portrait" > </activity> <receiver android:name="com.example.gate.gcmbroadcastreceiver" android:permission="com.google.android.c2dm.permission.send" > <intent-filter> <!-- receives actual messages. --> <action android:name="com.google.android.c2dm.intent.receive" /> <category android:name="com.example.gate" /> </intent-filter> </receiver> <service android:name="com.example.gate.gcmintentservice" /> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> </application> </manifest>
i not getting clue .please help.any highly appreciated....
try making dialog transparent,
intrestedin.xml
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="@android:color/transparent"
Comments
Post a Comment