java - onActivityResult() is not being called -


i've been trying while work no avail. attempting retrieve data detailactivity , return mainactivity. can 1 assist.

 @override     protected void onactivityresult(int requestcode, int resultcode, intent data) {         super.onactivityresult(requestcode, resultcode, data);         log.v(log_tag, "kjhvlerhvrhogvinorwui " + my_child_activity + " " + resultcode +" "+activity.result_ok);         switch(requestcode) {             case (my_child_activity) : {                 if (resultcode == activity.result_ok) {                     system.out.println("log_tag"+ "mainactivity.extra_search" + data.getstringextra(mainactivity.extra_search));                 }                 break;             }         }     }      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);          setcontentview(r.layout.activity_main);          artistsalbums = new arraylist<>();         tempalbums = new arraylist<>();          final restadapter adapter = new restadapter.builder()                 .setendpoint(end_point)                 .build();         service = adapter.create(apiservice.class);          edittext tview = (edittext) findviewbyid(r.id.artist_field);         tview.addtextchangedlistener(new textwatcher() {              @override             public void beforetextchanged(charsequence s, int start, int count,                                           int after) {                 log.v("log_tag", s + " ontextchanged() " + " start: " + start + " count: " + count + " after: " + after);             }              @override             public void aftertextchanged(editable s) { //aftertextchanged{                 log.v("log_tag", s + " aftertextchanged()");                 if (listviewrefresh) {                     if (madapter != null) {                         //madapter.clear();                         //madapter.notifydatasetchanged();                         artistsalbums.clear();                         displayitems();                     }                 }             }              @override             public void ontextchanged(charsequence s, int start, int before, int count) {                 name = s.tostring();                 log.v("log_tag", s.length() + " ontextchanged() " + " start: " + start + " before: " + before + " count:" + count);                 //listviewrefresh = (start == 0) && (before == 1) && (count == 0);                 listviewrefresh = name.length() == 0;                     //======================================a r t s t s=====================================m============                     service.searchartists(name, new callback<artistspager>() {                                 @override                                 public void success(artistspager artistspager, response response) {                                     image image;                                     if (artistspager.artists.items != null) { //for .. 6                                         artistsalbums.clear(); //this line doesn't work!!                                         //artistsalbums = new arraylist<artistsalbum>(); //this line works wrong!!                                          (int = 0; < artistspager.artists.items.size(); i++) { //for .. 1                                             try {  // try .. 1                                                 mname = artistspager.artists.items.get(i).name;         //breakpoint here!!                                                 mid = artistspager.artists.items.get(i).id;                                                 int size = artistspager.artists.items.get(i).images.size();                                                  if (size == 0) {                                                     //------------------------------------------                                                     album = new artistsalbum();                                                     album.setname(mname);                                                     album.setid(mid);                                                     artistsalbums.add(album);                                                     //------------------------------------------                                                 } else {                                                     (int j = 0; j < size; j++) {                                                         if ((300 <= artistspager.artists.items.get(i).images.get(j).width) &&                                                             (650 >= artistspager.artists.items.get(i).images.get(j).width)){                                                             murl = artistspager.artists.items.get(i).images.get(j).url;                                                             album = new artistsalbum();                                                             album.seturl(murl);                                                             album.setname(mname);                                                             album.setid(mid);                                                             artistsalbums.add(album);                                                             break;                                                         }                                                     }                                                 }                                             } catch (indexoutofboundsexception e) { //try .. 1                                                 e.printstacktrace();                                             }                                         }// .. 1                                          if (!listviewrefresh )                                             displayitems();                                         else {                                             artistsalbums.clear();                                             displayitems();                                         }                                          //displayitems(artistsalbums);                                          log.v(log_tag, "======================================= top ================================================");                                         (artistsalbum obj : artistsalbums)                                             system.out.println("log_tag" + "name: " + obj.getname() + " id: " + obj.getid() + " url: " + obj.geturl());                                         log.v(log_tag, "====================================== bottom ==============================================");                                           mlistview.setonitemclicklistener(new adapterview.onitemclicklistener() {                                             @override                                             public void onitemclick(final adapterview<?> parent, final view view,                                                                     int position, long id) {                                                 final artistsalbum item = (artistsalbum) parent.getitematposition(position);                                                 // system.out.println("log_tag" + "name: " + item.getname() + " id: " + item.getid() + " url: " + item.geturl());                                                 //sendmessage(item.getid());                                                 intent = new intent(mainactivity.this, detailactivity.class);                                                 intent.putextra(extra_message, item.getid());                                                 intent.putextra(extra_search, name);                                                 startactivityforresult(intent, my_child_activity);                                               }                                         });                                     } //for..6                                 }                                  @override                                 public void failure(retrofiterror error) {                                  }                     });             } //ontextchanged         }); } 

within detailactivity have setresult() within onpause() callback:

@override     protected void onpause   () {         super.onpause();         log.v(log_tag, "onpause()");         intent in = getintent();         in.putextra(mainactivity.extra_search, searchstr);         setresult(activity.result_ok, in);         log.v(log_tag, "activity.result_ok" + in);         finish();     } 

and completeness have supplied androidmanifest:

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"     package="com.example.richard.webapitest" >      <uses-permission android:name="android.permission.internet" />      <application         android:allowbackup="true"         android:icon="@mipmap/ic_launcher"         android:label="@string/app_name"         android:theme="@style/apptheme"         >         <activity             android:name="com.example.richard.webapitest.mainactivity"             android:label="@string/app_name"            >             <intent-filter>                 <action android:name="android.intent.action.main" />                  <category android:name="android.intent.category.launcher" />             </intent-filter>         </activity>         <activity             android:name=".detailactivity"             android:label="@string/title_activity_detail"             android:parentactivityname=".mainactivity">             <meta-data                 android:name="android.support.parent_activity"                 android:value="com.example.richard.webapitest.mainactivity" />         </activity>     </application> </manifest> 

many thank

addendum: log cat followed once run:

07-27 08:40:49.091    2080-2080/com.example.richard.webapitest v/log_tag﹕ ontextchanged()  start: 0 count: 0 after: 1 07-27 08:40:49.091    2080-2080/com.example.richard.webapitest v/log_tag﹕ 1 ontextchanged()  start: 0 before: 0 count:1 07-27 08:40:49.127    2080-2080/com.example.richard.webapitest v/log_tag﹕ e aftertextchanged() 07-27 08:40:49.515    2080-2294/com.example.richard.webapitest d/dalvikvm﹕ gc_for_alloc freed 318k, 4% free 9195k/9540k, paused 7ms, total 8ms 07-27 08:40:49.519    2080-2294/com.example.richard.webapitest w/dalvikvm﹕ vfy: unable find class referenced in signature (ljava/nio/file/path;) 07-27 08:40:49.523    2080-2294/com.example.richard.webapitest w/dalvikvm﹕ vfy: unable find class referenced in signature ([ljava/nio/file/openoption;) 07-27 08:40:49.523    2080-2294/com.example.richard.webapitest i/dalvikvm﹕ not find method java.nio.file.files.newoutputstream, referenced method okio.okio.sink 07-27 08:40:49.523    2080-2294/com.example.richard.webapitest w/dalvikvm﹕ vfy: unable resolve static method 17524: ljava/nio/file/files;.newoutputstream (ljava/nio/file/path;[ljava/nio/file/openoption;)ljava/io/outputstream; 07-27 08:40:49.523    2080-2294/com.example.richard.webapitest d/dalvikvm﹕ vfy: replacing opcode 0x71 @ 0x000a 07-27 08:40:49.523    2080-2294/com.example.richard.webapitest w/dalvikvm﹕ vfy: unable find class referenced in signature (ljava/nio/file/path;) 07-27 08:40:49.523    2080-2294/com.example.richard.webapitest w/dalvikvm﹕ vfy: unable find class referenced in signature ([ljava/nio/file/openoption;) 07-27 08:40:49.523    2080-2294/com.example.richard.webapitest i/dalvikvm﹕ not find method java.nio.file.files.newinputstream, referenced method okio.okio.source 07-27 08:40:49.523    2080-2294/com.example.richard.webapitest w/dalvikvm﹕ vfy: unable resolve static method 17523: ljava/nio/file/files;.newinputstream (ljava/nio/file/path;[ljava/nio/file/openoption;)ljava/io/inputstream; 07-27 08:40:49.523    2080-2294/com.example.richard.webapitest d/dalvikvm﹕ vfy: replacing opcode 0x71 @ 0x000a 07-27 08:40:49.767    2080-2080/com.example.richard.webapitest v/mainactivity﹕ in displayitems0 07-27 08:40:49.767    2080-2080/com.example.richard.webapitest v/mainactivity﹕ ======================================= top ================================================ 07-27 08:40:49.767    2080-2080/com.example.richard.webapitest v/mainactivity﹕ ====================================== bottom ============================================== 07-27 08:40:50.255    2080-2304/com.example.richard.webapitest d/dalvikvm﹕ gc_for_alloc freed 390k, 5% free 9319k/9736k, paused 5ms, total 5ms 07-27 08:40:50.275    2080-2304/com.example.richard.webapitest d/dalvikvm﹕ gc_for_alloc freed 25k, 4% free 9352k/9736k, paused 6ms, total 6ms 07-27 08:40:50.275    2080-2304/com.example.richard.webapitest i/dalvikvm-heap﹕ grow heap (frag case) 10.036mb 921612-byte allocation 07-27 08:40:50.283    2080-2094/com.example.richard.webapitest d/dalvikvm﹕ gc_for_alloc freed <1k, 4% free 10252k/10640k, paused 7ms, total 7ms 07-27 08:40:50.951    2080-2314/com.example.richard.webapitest d/dalvikvm﹕ gc_for_alloc freed 75k, 4% free 10257k/10640k, paused 7ms, total 7ms 07-27 08:40:50.959    2080-2314/com.example.richard.webapitest i/dalvikvm-heap﹕ grow heap (frag case) 11.604mb 1638412-byte allocation 07-27 08:40:50.967    2080-2314/com.example.richard.webapitest d/dalvikvm﹕ gc_for_alloc freed 0k, 4% free 11857k/12244k, paused 7ms, total 7ms 07-27 08:40:51.431    2080-2098/com.example.richard.webapitest d/dalvikvm﹕ gc_for_alloc freed 75k, 4% free 11859k/12244k, paused 6ms, total 6ms 07-27 08:40:51.435    2080-2098/com.example.richard.webapitest i/dalvikvm-heap﹕ grow heap (frag case) 12.535mb 974412-byte allocation 07-27 08:40:51.443    2080-2098/com.example.richard.webapitest d/dalvikvm﹕ gc_for_alloc freed 0k, 3% free 12810k/13196k, paused 7ms, total 7ms 07-27 08:40:51.723    2080-2099/com.example.richard.webapitest d/dalvikvm﹕ gc_for_alloc freed 75k, 3% free 12811k/13196k, paused 6ms, total 6ms 07-27 08:40:51.727    2080-2099/com.example.richard.webapitest i/dalvikvm-heap﹕ grow heap (frag case) 13.668mb 1188552-byte allocation 07-27 08:40:51.743    2080-2099/com.example.richard.webapitest d/dalvikvm﹕ gc_for_alloc freed 0k, 3% free 13972k/14360k, paused 6ms, total 6ms 07-27 08:40:51.975    2080-2295/com.example.richard.webapitest d/dalvikvm﹕ gc_for_alloc freed 149k, 3% free 15041k/15448k, paused 7ms, total 7ms 07-27 08:40:52.187    2080-2295/com.example.richard.webapitest d/dalvikvm﹕ gc_for_alloc freed 74k, 3% free 16641k/17052k, paused 5ms, total 5ms 07-27 08:40:59.359    2080-2080/com.example.richard.webapitest w/egl_genymotion﹕ eglsurfaceattrib not implemented 07-27 08:41:05.459    2080-2080/com.example.richard.webapitest v/detailactivity﹕ onpause() 07-27 08:41:05.459    2080-2080/com.example.richard.webapitest v/detailactivity﹕ activity.result_okintent { cmp=com.example.richard.webapitest/.detailactivity (has extras) } 07-27 08:41:05.539    2080-2080/com.example.richard.webapitest w/egl_genymotion﹕ eglsurfaceattrib not implemented 

@override  protected void onpause()  {     log.v(log_tag, "onpause()");    intent data = new intent();    data.putextra(mainactivity.extra_search, searchstr);    if (getparent() == null) {        setresult(activity.result_ok, data);    } else {        getparent().setresult(activity.result_ok, data);    }     log.v(log_tag, "activity.result_ok" + in);    super.onpause();  } 

check https://stackoverflow.com/a/2621390/2401265


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -