design - Unable to click interface on Android app I've made -


first time poster here. although have been shadowing lot lately , decided post today.

i have made android app - first ever - yay! right, displays fine , looks good. works 100% in avd samsung galaxy sii.

the problem not able click anywhere. when click i'm supposed nothing happens. suspect may 1 of layouts being above other layouts preventing me sending click events appropriate controls.

so, did play around layout , doesn't matter how organize them, nothing happens ( no clicking happens )

here layouts in question :

activity_fullscreen_activity_ncc.xml

<framelayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:id="@+id/fullscreen_content_controls"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:background="#ffffff"     tools:context=".fullscreenactivityncc"     android:clickable="true"     android:focusable="true" >     <requestfocus />       <!--          primary full-screen view. can replaced whatever view          needed present content, e.g. videoview, surfaceview,          textureview, etc.     -->       <!--          framelayout insets children based on system windows using          android:fitssystemwindows.     --><button         android:id="@+id/contact"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_gravity="bottom|left"         android:text="@string/contact"         android:textcolor="#000000" />      <button         android:id="@+id/download"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_gravity="bottom|right"         android:text="@string/download"         android:textcolor="#000000" />      <framelayout         android:id="@+id/fullscreen_content"         android:layout_width="match_parent"         android:layout_height="407dp"             android:clickable="true"     android:focusable="true">          <imageview             android:id="@+id/image2"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:contentdescription="@string/downloadprogress" />          <include             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_gravity="center_vertical|center_horizontal"             android:layout_marginbottom="50dp"             android:layout_margintop="30dp"             layout="@layout/literacy" />          <textview             android:id="@+id/textview1"             android:layout_width="wrap_content"             android:layout_height="52dp"             android:gravity="center_vertical|center_horizontal"             android:text="@string/welcomebrowse"             android:textcolor="#000000" />          <textview             android:id="@+id/textview2"             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:layout_gravity="bottom"             android:gravity="center_vertical|center_horizontal"             android:text="@string/contactncc"             android:textalignment="center"             android:textcolor="#ff0000" />      </framelayout>      </framelayout> 

literacy.xml

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" >  <listview     android:id="@+id/srlistview"     android:layout_width="fill_parent"     android:layout_height="wrap_content"     android:layout_weight="0.24" />  </linearlayout> 

can identify why buttons , listview aren't clickable?

my code activity :

@override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);      setcontentview(r.layout.activity_fullscreen_activity_ncc);      registerbaseactivityreceiver();     final view controlsview = findviewbyid(r.id.fullscreen_content_controls);     final view contentview = findviewbyid(r.id.fullscreen_content);  //  controlsview.requestfocus();     //controlsview.bringtofront();      addlisteneronb2();      view v = findviewbyid(r.id.contact);     //set event listener         v.setonclicklistener((onclicklistener) this);       arraylist<searchresults> searchresults = getsearchresults();      final listview lv = (listview) findviewbyid(r.id.srlistview);     lv.setadapter(new courseadapter(this, searchresults));      lv.setonitemclicklistener(new onitemclicklistener() {         @override         public void onitemclick(adapterview<?> a, view v, int position, long id) {             object o = lv.getitematposition(position);             searchresults fullobject = (searchresults)o;                         toast.maketext(fullscreenactivityncc.this, "you have chosen: " + " " + fullobject.getname(), toast.length_long);                          string selprods = (string)fullobject.getname();                          if (selprods == "computer literacy") {                            intent intent = new intent(fullscreenactivityncc.this,literacy.class);                          //start second activity                         startactivity(intent);                                                          }                          else if (selprods == "office assistant") {                          intent intent = new intent(fullscreenactivityncc.this,officeassistant.class);                          startactivity(intent);                          }                          else if (selprods == "pastel") {                          intent intent = new intent(fullscreenactivityncc.this,pastel.class);                          startactivity(intent);                          }                          else if (selprods == "technical") {                          intent intent = new intent(fullscreenactivityncc.this,technical.class);                          startactivity(intent);                          }                          else if (selprods == "graphic design") {                          intent intent = new intent(fullscreenactivityncc.this,graphicdesign.class);                          startactivity(intent);                          }                          else if (selprods == "it") {                          intent intent = new intent(fullscreenactivityncc.this,it.class);                          startactivity(intent);                          }                                        else if (selprods == "web design") {                          intent intent = new intent(fullscreenactivityncc.this,webdesign.class);                          startactivity(intent);                          }                          else if (selprods == "programming") {                          intent intent = new intent(fullscreenactivityncc.this,programming.class);                          startactivity(intent);                          }                          else if (selprods == "business administration") {                          intent intent = new intent(fullscreenactivityncc.this,businessadmin.class);                          startactivity(intent);                          }                         }     });        // set instance of systemuihider control system ui     // activity.     msystemuihider = systemuihider.getinstance(this, contentview,             hider_flags);     msystemuihider.setup();     msystemuihider             .setonvisibilitychangelistener(new systemuihider.onvisibilitychangelistener() {                 // cached values.                 int mcontrolsheight;                 int mshortanimtime;                  @override                 @targetapi(build.version_codes.honeycomb_mr2)                 public void onvisibilitychange(boolean visible) {                     if (build.version.sdk_int >= build.version_codes.honeycomb_mr2) {                         // if viewpropertyanimator api available                         // (honeycomb mr2 , later), use animate                         // in-layout ui controls @ bottom of                         // screen.                         if (mcontrolsheight == 0) {                             mcontrolsheight = controlsview.getheight();                         }                         if (mshortanimtime == 0) {                             mshortanimtime = getresources().getinteger(                                     android.r.integer.config_shortanimtime);                         }                         /*controlsview                                 .animate()                                 .translationy(visible ? 0 : mcontrolsheight)                                 .setduration(mshortanimtime);*/                     } else {                         // if viewpropertyanimator apis aren't                         // available, show or hide in-layout ui                         // controls.                         controlsview.setvisibility(visible ? view.visible                                 : view.gone);                     }                      if (visible && auto_hide) {                         // schedule hide().                         delayedhide(auto_hide_delay_millis);                     }                 }             });      // set user interaction manually show or hide system ui.     contentview.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view view) {             if (toggle_on_click) {                 msystemuihider.toggle();             } else {                 msystemuihider.show();             }         }     });        // upon interacting ui controls, delay scheduled hide()     // operations prevent jarring behavior of controls going away     // while interacting ui.     findviewbyid(r.id.contact).setontouchlistener(             mdelayhidetouchlistener);   }  private arraylist<searchresults> getsearchresults() {     // todo auto-generated method stub     arraylist<searchresults> results = new arraylist<searchresults>();      searchresults sr = new searchresults();     sr.setname("computer literacy");     sr.setdescription("all our computer literacy options");     sr.setprice("for prices , course content, click here!");     results.add(sr);      sr = new searchresults();     sr.setname("office assistant");     sr.setdescription("secretarial courses");     sr.setprice("for prices , course content, click here!");     results.add(sr);      sr = new searchresults();     sr.setname("pastel");     sr.setdescription("pastel options");     sr.setprice("for prices , course content, click here!");     results.add(sr);      sr = new searchresults();     sr.setname("technical");     sr.setdescription("technician courses");     sr.setprice("for prices , course content, click here!");     results.add(sr);      sr = new searchresults();     sr.setname("graphic design");     sr.setdescription("graphic design options");     sr.setprice("for prices , course content, click here!");     results.add(sr);      sr.setname("it");     sr.setdescription("our options");     sr.setprice("for prices , course content, click here!");     results.add(sr);      sr = new searchresults();     sr.setname("web design");     sr.setdescription("web design courses");     sr.setprice("for prices , course content, click here!");     results.add(sr);      sr = new searchresults();     sr.setname("programming");     sr.setdescription("our programming options");     sr.setprice("registration: r350. deposit: r750. monthly: r405");     results.add(sr);      sr = new searchresults();     sr.setname("business");     sr.setdescription("business oriented courses");     sr.setprice("registration: r350. deposit: r850. monthly: r445");     results.add(sr);       return results; }  //download private void addlisteneronb2() {     button b2 = (button) findviewbyid(r.id.download);      b2.setonclicklistener(new onclicklistener() {          @override         public void onclick(view arg0) {              new downloadfilefromurl().execute(file_url);         }      });  }  /**  * showing dialog  * */ @override protected dialog oncreatedialog(int id) {     switch (id) {     case progress_bar_type:         pdialog = new progressdialog(this);         pdialog.setmessage("downloading file. please wait...");         pdialog.setindeterminate(false);         pdialog.setmax(100);         pdialog.setprogressstyle(progressdialog.style_horizontal);         pdialog.setcancelable(true);         pdialog.show();         return pdialog;     default:         return null;     } }  /**  * background async task download file  * */ public class downloadfilefromurl extends asynctask<string, string, string> {      imageview my_image = (imageview) findviewbyid(r.id.image2);      /**      * before starting background thread      * show progress bar dialog      * */     @suppresswarnings("deprecation")     @override     protected void onpreexecute() {         super.onpreexecute();         showdialog(progress_bar_type);     }      /**      * downloading file in background thread      * */     @override     protected string doinbackground(string... f_url) {         int count;         try {             url url = new url(f_url[0]);             urlconnection conection = url.openconnection();             conection.connect();             // getting file length             int lenghtoffile = conection.getcontentlength();              // input stream read file - 8k buffer             inputstream input = new bufferedinputstream(url.openstream(), 8192);              // output stream write file             outputstream output = new fileoutputstream(environment.getexternalstoragedirectory().getpath() + "prospectus.pdf");              byte data[] = new byte[1024];              long total = 0;              while ((count = input.read(data)) != -1) {                 total += count;                 // publishing progress....                 // after onprogressupdate called                 publishprogress(""+(int)((total*100)/lenghtoffile));                  // writing data file                 output.write(data, 0, count);             }              // flushing output             output.flush();              // closing streams             output.close();             input.close();          } catch (exception e) {             log.e("error: ", e.getmessage());         }          return null;     }      /**      * updating progress bar      * */     protected void onprogressupdate(string... progress) {         // setting progress percentage         pdialog.setprogress(integer.parseint(progress[0]));    }      /**      * after completing background task      * dismiss progress dialog      * **/     @suppresswarnings("deprecation")     @override     protected void onpostexecute(string file_url) {         // dismiss dialog after file downloaded         dismissdialog(progress_bar_type);          // displaying downloaded image image view         // reading image path sdcard         string imagepath = environment.getexternalstoragedirectory().tostring() + "/downloadedfile.jpg";         // setting downloaded image view         my_image.setimagedrawable(drawable.createfrompath(imagepath));     }  }  @override protected void onpostcreate(bundle savedinstancestate) {     super.onpostcreate(savedinstancestate);      // trigger initial hide() shortly after activity has been     // created, briefly hint user ui controls     // available.     delayedhide(100); }  /**  * touch listener use in-layout ui controls delay hiding  * system ui. prevent jarring behavior of controls going away  * while interacting activity ui.  */ view.ontouchlistener mdelayhidetouchlistener = new view.ontouchlistener() {     @override     public boolean ontouch(view view, motionevent motionevent) {         if (auto_hide) {             delayedhide(auto_hide_delay_millis);         }         return false;     } };  handler mhidehandler = new handler(); runnable mhiderunnable = new runnable() {     @override     public void run() {         msystemuihider.hide();     } };  /**  * schedules call hide() in [delay] milliseconds, canceling  * scheduled calls.  */ private void delayedhide(int delaymillis) {     mhidehandler.removecallbacks(mhiderunnable);     mhidehandler.postdelayed(mhiderunnable, delaymillis); }  //contactform button @override public void onclick(view arg0) {     if(arg0.getid() == r.id.contact){         //define new intent second activity         intent intent = new intent(this,contactform.class);          //start second activity         this.startactivity(intent);     }   }  @override protected void ondestroy() {     super.ondestroy();     unregisterbaseactivityreceiver(); } 


Comments