android-listview

android fragment state restored only on back button , not when i select a fragment randomly from listview

≯℡__Kan透↙ 提交于 2019-12-13 07:00:01
问题 Hi i have a listview sidebar and i am displaying fragments based on user selection in listview. This is how i am replacing fragments public void switchFragment(Fragment fragment, boolean addBackStack) { try { FragmentManager manager = getSupportFragmentManager(); FragmentTransaction ft = manager.beginTransaction(); ft.replace(R.id.content, fragment); currentFragment = fragment; //if (addBackStack) ft.addToBackStack(null); ft.commit(); } catch (Exception e) { } } This is my sample fragment

Null Pointer Exception while inflating listview

蓝咒 提交于 2019-12-13 06:49:46
问题 I am getting a NullPointerException - I am trying to inflate a ListView inside a Fragment . The stacktrace of the Exception is 03-16 22:46:41.721: W/dalvikvm(1571): threadid=1: thread exiting with uncaught exception (group=0x400207d8) 03-16 22:46:41.840: E/AndroidRuntime(1571): FATAL EXCEPTION: main 03-16 22:46:41.840: E/AndroidRuntime(1571): java.lang.NullPointerException 03-16 22:46:41.840: E/AndroidRuntime(1571): at net.justanotherblog.swipeview.CustomListAdapter.getView(CustomListAdapter

Why intent makes my application crashed?

痴心易碎 提交于 2019-12-13 06:47:10
问题 I just want to ask you why using intent makes my system crashed? I've used same codes before and it works, then when I use it again now it won't. What do you think the problem guys? MANIFEST <?xml version="1.0" encoding="utf-8"?> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name=".MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android

Technical Details of Android Lollipop Settings View

独自空忆成欢 提交于 2019-12-13 06:47:06
问题 I am trying to figure out how would you implement something like an Android Settings View for both phones and tablets? It doesn't look like a ListView or RecyclerView utilizing CardView? Which Android class or component would you use to implement/design a similar looking ListView? Its sort of a 2 column layout on tablets and one column layout on phones: Any sample code or tips would be appreciated. 回答1: You can accomplish this by using a combination of RecyclerView and CardView for the

How change color/picture of specific one ListView row - Android?

青春壹個敷衍的年華 提交于 2019-12-13 06:46:48
问题 I am trying to change only one (maybe more) ListView row based on specific condition. I have read many answers on similar questions and tons of other tutorials but I am not able to make anything. Exactly what I want to achieve is to have row background (easier version) or row picture (I think harder version) set different than others when row from SQLite is set at specific value. I have got Activity that extends ListActivity and I am setting the ListView adapter like this: private void

Parsing jsoup list

让人想犯罪 __ 提交于 2019-12-13 06:26:47
问题 I created a list in which i parse a webpage. I can display the titles and the first image of the first article but what i want is display the image for each article. This is the code: EDITED CODE public class MainActivity extends Activity{ ProgressDialog mProgressDialog; public static final String TAG_TITOLI = "titoli"; private static final String TAG_IMMAGINE = "immagine"; ListView lista; Bitmap bitmap; public ImageView immagine; public ImageView logoimg; static final String BLOG_URL = "http

Change ImageView BackgroundResource in listview onItemSelected Android

ⅰ亾dé卋堺 提交于 2019-12-13 06:25:36
问题 I use an efficientAdapter to populate mylistview as shown below: 回答1: You can try something like this. I cleaned up and simplified your code. public class EfficientAdapter extends BaseAdapter { private Activity mActivity; private ArrayList<SearchTracks> mSearchTracks; private ResultatMultiple mResultatMultiple; private int mSelectedPosition; public EfficientAdapter(Activity activity, ArrayList<SearchTracks> searchTracks) { mActivity = activity; mSearchTracks = searchTracks; } public

In android am using multiple choice list for contact selection how to select all contact at one button click

大兔子大兔子 提交于 2019-12-13 06:17:38
问题 Hi am using multiple choice list can any one tell me how should i select all item on any button click event or how unselect all item on button click event my code is here /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.contact_list); findViewsById(); PhoneContacts pc = new PhoneContacts(ContactList.this); pc.readContacts(); for (int i = 0; i < pc.allPhoneNumbers.size(); i+

TextView not updating when deleting record in custom adapter

别说谁变了你拦得住时间么 提交于 2019-12-13 06:04:05
问题 I have a class which shows record in a ListView. The user can delete the records and everytime the user deletes a record I want to update a TextView from my layout with the new values. I've got a XML layout page, a class which then refers to a custom adapter. When the user deletes a record I trigger a function from another class (HistoryOverview.java) where I would like to update the textview. The thing is I've got everything coded without errors but my TextView does not update the values. Am

How to call notifyDataSetChanged() on ArrayList view?

守給你的承諾、 提交于 2019-12-13 05:56:31
问题 This is the ArrayList page that opens as a result page after update and save. I guess I would need to somehow refresh so that it reflects the changes on the UI. I've tried to call notifyDataSetChanged() but no luck with my level of experience. Could someone kindly show how to implement it please? @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.all_requests); requestsList = new ArrayList<HashMap<String, String>>(); new