android-listview

ListView not showing data in App Widget

亡梦爱人 提交于 2019-12-02 05:29:45
问题 I'm trying to implement a simple collection widget for my application, i'm trying to show a ListView inside a widget but the ListView is stuck at Loading... and never finish loading, and i have data in the database and the listview is still stuck with it. Here is the onUpdate method from my AppWidgetProvider class: @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { int length = appWidgetIds.length; for (int x = 0; x < length; x++){

I am unable to extend my activity to listactivity. help needed

被刻印的时光 ゝ 提交于 2019-12-02 05:24:51
问题 I am unable to extend my activity to listactivity. I want to extend it to listactivity and add onclicklistener to the list items. public class MainActivity extends Activity { private ListView lView; private ArrayList results = new ArrayList(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); lView = (ListView) findViewById(R.id.lvApps); PackageManager pm = this.getPackageManager(); Intent intent = new

Android, findViewById returns null

笑着哭i 提交于 2019-12-02 05:23:21
问题 I'm writing some code for Android, the matter is that, when I call findViewById it returns me null, and I cannot understand why! I've been wasting my brain since yesterday, but I cannot figure out the solution. The goal is to set a layout as a header for a listView. Here is my code, respectively my header and my page: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/header" android:orientation="horizontal" android

ListView rows with different layouts

点点圈 提交于 2019-12-02 04:51:00
问题 What I am trying to achieve is to have different layouts for each row. The code in my ArrayAdapter is as follows: @Override public int getCount() { return contentList.size(); } @Override public MyContents getItem(int position) { return content.get(position); } @Override public long getItemId(int position) { return position; } @Override public int getViewTypeCount() { // TODO Auto-generated method stub return 2; } @Override public int getItemViewType(int position) { // TODO Auto-generated

How to attach multiple touch actions to a single list item?

只愿长相守 提交于 2019-12-02 04:45:16
I am using the following list layout for items that have associated comments . The number of comments are indicated by the box on the right side. Currently, I am using the onListItemClick handler to launch another details view. public class CustomListFragment extends ListFragment implements LoaderCallbacks<Cursor> { private Activity mActivity; private CursorAdapter mAdapter; private QueryParameters mQueryParameters; @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setEmptyText("No data to display"); mActivity = getActivity(); if

Multiple ViewPagers Inside Single ListView is Crashing

拟墨画扇 提交于 2019-12-02 04:44:44
问题 When Swipe through Viewpagers its Working Perfectly which i had done using setId() method for ViewPagers on getView() method of BaseAdapter . Code Of Implementation is similar to this thread, which i found here: On This Post Just added setId(position+1) after creating each ViewPager's Object. But when i start scrolling through List (Horizontally) Application is getting crashed showing below Error in Logcat: 06-18 21:06:55.020: E/AndroidRuntime(1928): FATAL EXCEPTION: main 06-18 21:06:55.020:

Android - how to align list view items to be nicely spaced left and right align?

假装没事ソ 提交于 2019-12-02 04:25:17
问题 I am trying to add an image to my ListView to make it look more like a button. I would like the images to be a little smaller, maybe 60% of current. And the images to lign up nicely on the right in a column. Here is a screen of what I currently have: and here is my list view xml: <?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="fill_parent" android:padding="10dp" android:textSize="16sp" android:layout_width=

Android: Remove item (ListView)

不问归期 提交于 2019-12-02 04:05:08
I want to remove an item from ListView , but I don't know how can I do it. This is my code... public void FLYNOTE_refresh() { int i; SharedPreferences Pref = getSharedPreferences("nnote", MODE_WORLD_READABLE); //созаётся файл настроек "nnote" и туда барыжиться вся хня key = Pref.getInt("number", 0); key++; String lv_arr[] = new String[key]; for (i = 0; i < key; i++) { lv_arr[i] = Pref.getString("n" + i, "none"); } textView1.setText(String.valueOf(key)); listView1.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1 , lv_arr)); listView1.setTextFilterEnabled(true); } I

ListView does not show changes until focus changes after notifyDataSetChanged

一曲冷凌霜 提交于 2019-12-02 04:04:29
I have an AlertDialog with a ListView set to multiple selection on it. It also has a Button on it. The Button open another AlertDialog that if ok'ed will remove the selected items from the data set of the ListView , and then tell the adapter of the list view that the dataset has changed with the notifyDataSetChanged() method. This all works fine except for one thing. The ListView does not update it's content until I interact with something. Then it updates to the correct data. This is not a big problem, but I really would like the ListView to appear correct at once, and not just after the

Implement DialogFragment interface in OnClickListener

那年仲夏 提交于 2019-12-02 03:20:02
问题 I need to build a DialogFragment which returns user input from the dialog to an activity. The dialog needs to be called in an OnClickListener which gets called when an element in a listview gets clicked. The return value of the DialogFragment (the input of the user) should be directly available in the OnClickListener in the activity. I tried to implement this by sticking to the official docs: http://developer.android.com/guide/topics/ui/dialogs.html#PassingEvents I need something like the