android-listview

Previously added items are added again when saving an ArrayList using SharedPreferences

丶灬走出姿态 提交于 2019-12-12 00:28:40
问题 In my app I have 3 activities A,B and C. In Activity A when a button is pressed it starts Activity B and an empty arraylist is passed to it using putExtra. In Activity B, if the arraylist is empty it starts Activity C which adds an item in the ArrayList and passes it to Activity B. Activity B then displays and the arraylist. In Activity B there is a 'back' button which when pressed restarts the Activity A. In Activity A, the number of items in the arraylist is displayed and when an EditText

How to save state of changed ImageView in Listview row, after it has disappeared from screen?

不想你离开。 提交于 2019-12-12 00:24:52
问题 I have designed an application with a list-view in which I can change the colors of list items, here is a link to a screen from the application: The colors are changed by changing an image on the left part of the list row. Now when I change the color slide down in the list, and the come back up the color go back to their original state (meaning the Image-view come back to its original source). The data for the list is taken from an XML file, parsed to a hash-map and the using an adapter

how to pass image from listview item to a dialog box WITHOUT the use of an intent

╄→尐↘猪︶ㄣ 提交于 2019-12-11 23:34:48
问题 I have an activity and custom dialog. the activity has two textview and 1 image view. the dialog box has a textview and an imageview. when a user clicks the item in the listview the dialog box shows. i am trying to get the imageview from the activity to show in the dialog box's imageview. With some help, i got the textview from the activity to the dialog box. but i am having problems passing the image as well. My custom dialog: public class MyDialogFragment extends DialogFragment { @Override

Android - Navigation Drawer - OnItemClick

*爱你&永不变心* 提交于 2019-12-11 23:26:45
问题 i have a problem with the Navigation Drawer in my app. I cant get the "OnItemClick" - Event of the row items in my drawerlist. My app contains a Actionbar with some tabs. So my Activity extends from "ActionBarActivity". Here is my code. I hope someone could help me. public class Hauptmenue_extended extends ActionBarActivity implements ListView.OnItemClickListener, android.content.DialogInterface.OnClickListener { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate

listview adding spinner in each row?

浪子不回头ぞ 提交于 2019-12-11 23:16:44
问题 I am facing problem while putting Spinner in layout. My acctual requirement is to place Spinner once, at the top of layout. This output I am getting: I have Relative layout <Spinner android:id="@+id/spinner1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:entries="@array/string_array" android:prompt="@string/spinner_msg" /> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/notesTextView" android:layout_width="fill_parent"

How to show selected record of Custom list view on Toast

随声附和 提交于 2019-12-11 22:58:09
问题 I have created two textView and one EditText in Custom ListView,I want to show all record which is entered in edittext on toast on button click ,in my code it show only first record,I want to show two textview and edittext value which in entered...... public class Mmnue extends Activity { ArrayList<HashMap<String, String>> MyArrList; String rate ; String itemnam ; String quan; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout

Navigation Drawer ListView is empty

可紊 提交于 2019-12-11 22:38:40
问题 I have an app with the first activity being a log-in page. When the user successfully logs in he sees his projects. I am using ListFragment to diplay this list(since I also have public projects which the user sees in one-half of the login page). And I am adding a Navigation Drawer to the activity after he logs in. After a lot of confusion I was able to add the Navigation Drawer on the activity, but the it has an empty list. DrawerActivity.java: public class DrawerActivity extends Activity {

Android set image on ListView in Fragment

此生再无相见时 提交于 2019-12-11 22:34:53
问题 in simple Slide menu of my application i can set array to Adapter and this is work correctly. but i want to set Icon for each row of ListView array. in this below code my array of listview and images of thats is ok but i can not set icon. public class NavigationDrawerFragment extends Fragment { . . . public NavigationDrawerFragment() { } @Override public void onCreate(Bundle savedInstanceState) { . . . . @Override public void onActivityCreated(Bundle savedInstanceState) { super

Adding custom data to ListView & ArrayAdapter items

核能气质少年 提交于 2019-12-11 22:21:14
问题 I'm creating an Android application. Inside a Fragment I have a ListView that is populated using an ArrayAdapter and an ArrayList . I'm using android.R.layout.simple_list_item_1 for the layout for the list items. I want to have an OnItemClickListener , so that when an item is clicked it will show another Activity based on its data. The problem is, there may be items with the same name. I'd like to attach an ID value to each of the elements, so that my code can distinguish them from each other

Android different Row layout only for first row in BaseAdapter

对着背影说爱祢 提交于 2019-12-11 22:15:06
问题 I am making an Custom listview with Custom Adapter extending BaseAdapter . Now I want to set a different layout only for first row and another layout for all other rows. I am using this code but it sets the special layout for 1st row and also repeats it after every 5/6 rows. How can I fix it and can set it only for 1st row and another layout for all other rows. public class NewsAdapter extends BaseAdapter { private Context context; List<News> newsList; private Typeface customBanglaFont;