{"id":2946,"date":"2014-03-11T09:41:11","date_gmt":"2014-03-11T09:41:11","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/11\/androidandroid-listfragmentrelated-issues-collection-of-common-programming-errors\/"},"modified":"2014-03-11T09:41:11","modified_gmt":"2014-03-11T09:41:11","slug":"androidandroid-listfragmentrelated-issues-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/11\/androidandroid-listfragmentrelated-issues-collection-of-common-programming-errors\/","title":{"rendered":"android,android-listfragmentRelated issues-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/90571348d2e81b3efa3b97d5117018ac?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJan-Henk<br \/>\nandroid actionbarsherlock<br \/>\nI have a simple login layout that contains two EditText fields and a Button to login. The problem is that the ActionBar disappears when the soft keyboard is open and I change the focus from an EditText to the Button, and the ActionBar comes back again when I press back. The problem does not occur when the soft keyboard is closed and I navigate through the EditTexts and Button with the DPAD.I use ActionBarSherlock, and the problem occurs only on Android 2.x emulators, on the 4.x emulators everyth<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/ea91556d457094c20ac67f55131a5b7f?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nroly<br \/>\nandroid nfc<br \/>\nI&#8217;d like to know if it&#8217;s possible to handle NFC while the phone is sleeping ? It seems that no intent is launched so I imagine that the system turns off the nfc ?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/5ba9dd877c8a4bc5995b2101908ae648?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nNeal<br \/>\njava android json getjson<br \/>\nHey, I noticed this really weird behavior when calling getJSONArray. This is my code:JSONObject jsonObject = new JSONObject(data);if (!jsonObject.getJSONObject(&#8220;transfer&#8221;).has(&#8220;skill&#8221;))return Collections.emptyList();JSONArray events = jsonObject.getJSONObject(&#8220;transfer&#8221;).getJSONArray(&#8220;skill&#8221;);now, whenever transfer has more than 1 skill elements, everything works great, but when there is only 1 skill element, Im getting an exception:Caused by: org.json.JSONException:Value {&#8220;id&#8221;:&#8221;2&#8243;,&#8221;name&#8221;:&#8221;DOGS&#8221;<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/42851076ab3e8c0ca15f0fdd0097a22b?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nMKJParekh<br \/>\njava android date calendar<br \/>\nI have faced the same problem many times.The Same Problem was With This Question and Got Solution Like the Same, How to compare known hours ad current hour in android?Problem :When I use Calendar calCurr = Calendar.getInstance(); to get the Calendar object of current date and time, It always return me wrong.I have put logs and checked it and to make it correct I had to add in years and months and then I got the correct object for Current Date and Time.See My Example :Calendar calCurr = Calendar.<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/365fc01c886375cf198ca2534af92678?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\ntomjung<br \/>\njava android<br \/>\nbeen working on my app, I had 3 Icons because I had listed 3 intent filters with the action MAIN. Tried fixing it, and now I have no icons when the app is installed. Any idea why I don&#8217;t have an icon for my app?MANIFEST&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;utf-8&#8243;?&gt; &lt;manifest xmlns:android=&#8221;http:\/\/schemas.android.com\/apk\/res\/android&#8221; package=&#8221;com.myAppName&#8221; android:versionCode=&#8221;1&#8243; android:versionName=&#8221;1.0&#8243; &gt;&lt;uses-sdk android:minSdkVersion=&#8221;8&#8243;android:targetSdkVersion=&#8221;18&#8243; \/&gt;&lt;!&#8211; and<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/1c9a615fefd2fca50e1c20c9ef67eb66?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nashughes<br \/>\nandroid exception adt dalvik android-library<br \/>\nAfter updating to the latest developer tools, ADT 14, my Android project that includes library projects will no longer run producing the error:Dx UNEXPECTED TOP-LEVEL EXCEPTION: &#8230; already added: &#8230; &#8230; Conversion to Dalvik format failed with error 1The other threads describing this issue with solutions that include removing and re-adding the projects do not work.<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/6a0ef4178507d535d52892534da53c10?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nGagan<br \/>\nandroid renderscript<br \/>\nI intend to process RGB data through RenderScript.For this I&#8217;ve created Allocations in Java and passing them to RS Kernel function as below:uchar3 __attribute__((kernel)) invert(uchar3 v_in, uint32_t v_out) { v_in.r = &#8230;; v_in.g = &#8230;; v_in.b = &#8230;; }However ideally I would like to work on v_out in similar way i.e. setting values for v_out.r, v_out.g and v_out.b. Currently I can not do this with uint32_t v_out.Now if I define the above RS kernel as:uchar3 __attribute__((kernel)) invert(uchar3 v<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/6314bda7e26ab9d210c57b99b1cafbf8?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nRamin Zahedi<br \/>\nandroid opengl-es<br \/>\nI have got some strange and unexpected results from my program in OpenGL ES for android for example in the code below:matrix = ThisRot.get(); gl.glMultMatrixf(matrix, 0); currentRotation.toMatrix(matrix); temp.set(matrix);I set the matrix value before I use it as an argument for gl.glMultMatrixf and after that I change the value of matrix and use it for another purpose, but it has effect an the way the object rotate so it should have effect on gl.glMultMatrixf(). and that&#8217;s not the only one, som<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/c81e22a8a22d02e036ff00a9bbd2802b?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nRagunath Jawahar<br \/>\nandroid xml resources adt<br \/>\nI updated my ADT to the latest version after Gingerbread was released. And now&lt;string name=&#8221;date_format&#8221;&gt;%d:%d %s&lt;\/string&gt;shows the following errorMultiple annotations found at this line: &#8211; error: Multiple substitutions specified in non-positional format; did you mean to add the formatted=&#8221;false&#8221; attribute? &#8211; error: Unexpected end tag stringPrevious ADT version worked fine. Am I doing something wrong? I get this error whenever there are more than 1 format specifiers.<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/k7UvR.jpg?s=32&amp;g=1\" \/><br \/>\nsunshine<br \/>\nandroid in-app-billing<br \/>\nI got this kind of error from last night..i dont&#8217;t know what&#8217;s going on.Is there any problem from my side?. I didn&#8217;t change my code but when i clear data or i restall the application it shows me like&#8230;.!!!!!! frustrating&#8230;&#8230;..05-05 04:18:16.000: E\/Finsky(17538): [1] NotifyingErrorListener.onErrorResponse: Server error on InAppPurchaseInformationRequest: com.android.volley.ServerError05-05 04:18:16.010: D\/Finsky(17538): [1] MarketBillingService.sendResponseCode: Sending response RESULT_SERVICE<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/7d1655594f5bfe575e5cd92f142f40ec?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nvish<br \/>\nandroid listview android-listfragment android-fragmentactivity android-lazyloading<br \/>\nI am trying to implement lazy load on a listview in a tab fragment to load the elements of an array abc. I am trying to load 10 elements, then when the user scrolls down, next 10 elements will be loaded. But My app is not working as I am not able to jump to the UI thread in order to update it(runonUithread(returnRes); not working). COuld you [please take a look at the below code and suggest the right way to implement lazy load. Thank you.Fragment Class:package com.example.abe;import java.util.Ar<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/0d1721848d358b8be534bdc231ec501a?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\ntypedef<br \/>\nandroid fragment android-listfragment<br \/>\nI am developing an app in which there are three pan layout with fragments and each fragments are ListFragment. I am communicating between them via interface successfully but I am not able to update the ListView with new items. Here is my code of the ListView which need to be updated:public class SubChaptersListFragment extends SherlockListFragment {public interface OnSubChapterSelectListener {public void onSubChapterSelected(int position);}@Override public void onCreate(Bundle savedInstanceState<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/6d8157b4243cc4ddbc4c521bef062c78?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nnomnom<br \/>\nandroid android-listfragment<br \/>\nI place two ListFragment in my MainActivity.This is the ListFragment xml file: fragment1.xml&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;utf-8&#8243;?&gt; &lt;LinearLayout xmlns:android=&#8221;http:\/\/schemas.android.com\/apk\/res\/android&#8221;android:layout_width=&#8221;match_parent&#8221;android:layout_height=&#8221;match_parent&#8221;android:orientation=&#8221;vertical&#8221; &gt;&lt;ListViewandroid:id=&#8221;@id\/android:list&#8221;android:layout_width=&#8221;match_parent&#8221;android:layout_height=&#8221;match_parent&#8221;android:layout_weight=&#8221;1&#8243;android:drawSelectorOnTop=&#8221;false&#8221; \/&gt;&lt;\/L<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/94e14055beb795240caf503fb15a9028?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nNamikaze Minato<br \/>\nandroid android-fragments android-listfragment<br \/>\nI want to replace fragment B1 with fragment B2 after selecting listFragment A items.@Override public void onListItemClick(ListView l, View v, int position, long id) {Integer Position = position;WebViewerFragment fragment = (WebViewerFragment) getFragmentManager().findFragmentById(R.id.detailFragment);if (Position.equals(0)) {FragmentManager fm = getFragmentManager();WebViewerFragment newFragment = new WebViewerFragment();FragmentTransaction ft = fm.beginTransaction();ft.replace(R.id.detailFragme<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/31537b1c1737551512497cd629febfac?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nSohan Badaya<br \/>\nandroid android-fragments android-actionbar expandablelistview android-listfragment<br \/>\nI have two tabs using tabhost. One tab having activity extends ExpandableListActivity. It works fine. Now I wanted to use actionbar for adding a layout. But it crash because of tabhost. so I thought of using actionbar for tab. I wanted to add the expandable list activity into actionbar&#8217;s tab. but its not adding as a tab.so I have 2 question here.Can&#8217;t we use activity in actinbar&#8217;s tab. If no then is there any implementation in fragment for expandable list view. Or Can I have tabhost and actionb<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/725c99e4272f0196ce93d7b44e1ac416?s=32&amp;d=identicon&amp;r=PG&amp;f=1\" \/><br \/>\nuser3102133<br \/>\nandroid-fragments fragment android-listfragment<br \/>\ni am using fragment with Base Adapter and having Image icon in ActionBar. when i click on the image button i will change list view to Grid View and similarly. both List View and Grid View are in single class. 1 st time the view changed and all life cycle is called again i click on the icon the life cycle is not called app getting crashed. please help me to come out of this and please don&#8217;t rate me downThanks on Advance<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/04a57ac8a8eefa299c4e5ac7949b4186?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nuser2407147<br \/>\nandroid android-listfragment<br \/>\nFacing an error which says My ListFragment Cannot be cast to android.app.Activity. It&#8217;s for a tablet app with a 2 pane layout and this is the left side. Getting a crash not sure why. Any help would be awesome.Code:import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.support.v4.app.ListFragment; import android.view.View; import android.widget.ArrayAdapter; import android.w<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/6a11819376a514f83bf8e056ee4e9299?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nBill Mote<br \/>\nandroid android-listview android-listfragment<br \/>\nI have problem with calling startActivity(intent) from onItemClickListener() on ListFragment. When I click on an item from listview the application crashes.Code is here: public class AndroidFragment extends SherlockListFragment{static{StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();StrictMode.setThreadPolicy(policy);}static final String URL = &#8220;***&#8221;;\/\/ XML node keysstatic final String KEY_ITEM = &#8220;novost&#8221;; \/\/ parent node\/\/static final String KEY_ID = &#8220;id&#8221;<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/12a9e1bb7bdaaf97f8209a4b380fcf54?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nSerj Lotutovici<br \/>\nandroid actionbarsherlock android-listfragment android-menu<br \/>\nI have a generic SherlockListFragment that is used in my App in different cases. This fragment has a Option Menu Item ( a SearchView), here is the code of the SearchView creation:@Override public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) {super.onCreateOptionsMenu(menu, inflater);inflater.inflate(R.menu.all_places, menu);final MenuItem searchMenuItem = menu.findItem(R.id.action_search);searchMenuItem.setOnActionExpandListener(this);final SearchView searchView = (Sear<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/hwdFP.jpg?s=32&amp;g=1\" \/><br \/>\nSanthosh<br \/>\nandroid android-listfragment<br \/>\nI was trying to implement lisadapter in a fragment, but Java does not allow to extend two superclasses. Thus I was not able to extend Fragment and ListActivity to the same class. Then I changed my app. I replaced all fragments with ListFragment. But When I run my application, it crashes. Earlier it was running fine. Could you pleasa help me out . Please find below the logcat entriesI have pasted the protab1.xml below:&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;utf-8&#8243;?&gt; &lt;LinearLayout xmlns:android=&#8221;ht<\/li>\n<\/ul>\n<p>Web site is in building<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Jan-Henk android actionbarsherlock I have a simple login layout that contains two EditText fields and a Button to login. The problem is that the ActionBar disappears when the soft keyboard is open and I change the focus from an EditText to the Button, and the ActionBar comes back again when I press back. The problem [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2946","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2946","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=2946"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2946\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=2946"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=2946"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=2946"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}