android-listview

Android Fatal error:main

十年热恋 提交于 2020-02-06 06:47:32
问题 when i click button Order, to this CatalogActivity.java, it show me fatal error. package com.example.barcode; import java.util.List; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.Button; import android.widget.ListView; public class CatalogActivity extends Activity { private

how to load images from resources folder into android listview

痴心易碎 提交于 2020-02-05 08:14:30
问题 I have a 200 images in resource folder i named them as name_1.png , name_2.png . and I have a array in that I have few numbers such as 2, 4 , 6 ,30 , 40 ... and so on . I want to load image and text view into android listview and show the images according to the number from resource folder. For this I have created a activity class and image adapter class for custom list view . I am able to show the text view data but not the images according to the array data numbers . can any one suggest me

onItemClick in ListView doesn't work

人盡茶涼 提交于 2020-02-04 22:56:17
问题 I am unable to get Toast message as onItemClick is never called. Log-cat doesn't show any error. Please check out my code and correct me, if I am going wrong anywhere. I have used array adapter. public class Open extends ListActivity { DbAdapter mDb = new DbAdapter(this); @Override protected void onDestroy() { // TODO Auto-generated method stub mDb.close(); super.onDestroy(); } /** Called when the activity is first created. */ public void onCreate(Bundle savedInstanceState) { super.onCreate

ListView is showing gapes in list items Android

醉酒当歌 提交于 2020-02-04 04:54:27
问题 i am trying to implement listView through setListAdapter and Efficient Adapter. I want that when list is show then the background should not be repeat. My code is repeating the whole layout of list.xml due to which my list item are showing with so much gap. Right now my list is working like that: But i want this type of view: Here is my editText.xml in which i type the word and a list View is opened. <EditText android:id="@+id/start_edit" android:layout_width="match_parent" android:layout

simple cursor adapter requires minimum api 11 issue

不羁的心 提交于 2020-02-01 05:18:07
问题 I am working on a app , in which i require to populate list view from the database. I am getting compatibility issue in following code dataAdapter = new SimpleCursorAdapter( this, R.layout.eventlisting, cursor, columns, to, 0); It requires min api level 11 , mine is 8. Is there any alternative for this to make this code work on api 8 as well. Can i use support library? 回答1: Try the SimpleCursorAdapter from the support class. It is used like the API 11+ version and it is already backwards

How to fix this ArrayAdapter requires the resource ID to be a TextView

半城伤御伤魂 提交于 2020-01-30 13:13:10
问题 I am new to android, I'm trying to develop an application with gridview and listview using json. Through json I displayed set of images in gridview and based on the position of the gridview, i am displaying the results in the next page which is listview. This is my Sub_Category.java (2nd page java file) package com.javatechig.gridviewexample; public class Sub_Categories extends ActionBarActivity { private ArrayList<GridItem> SubCatgyData; private static final String TAG = Sub_Categories.class

Android list view setOnItemClickListener not working

馋奶兔 提交于 2020-01-29 13:23:53
问题 I want to hide the edit text and button field initially in list view and show that edit text and button for a particular raw in list view when that raw is clicked.So I tried to set the height to 0 in layout xml and then set it to some other value when user clicks on a raw, but it is not working I think my list view click event is not working. In the Android layout that I have list view there are Image view as a button, edit text field and list view also. Like follows <RelativeLayout xmlns

Android list view setOnItemClickListener not working

不问归期 提交于 2020-01-29 13:22:45
问题 I want to hide the edit text and button field initially in list view and show that edit text and button for a particular raw in list view when that raw is clicked.So I tried to set the height to 0 in layout xml and then set it to some other value when user clicks on a raw, but it is not working I think my list view click event is not working. In the Android layout that I have list view there are Image view as a button, edit text field and list view also. Like follows <RelativeLayout xmlns

ScrollView with a ListView doesn't scroll - android

巧了我就是萌 提交于 2020-01-29 04:11:26
问题 My problem with the following layout is that the layout doesn't scroll. My requirement is that I have to display 2 lists which at times can be big. So i put both the ListViews inside a ScrollView so that i can scroll to the bottom and have a look at both the ListViews. I don't want the ListView to scroll . I only want my ScrollView to behave as it should. Any suggestions?? <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android

Access Fragment in Activity?

谁说胖子不能爱 提交于 2020-01-27 04:20:26
问题 I have one main activity with 2 fragments. Both fragments have a ListView . I want to update the list in MainActivity . Is there any way to access fragment list adapter in activity with out making adapter as static adapter. Currently I am doing like this in Mainactivity.java public void updatelist() { if(fragmentstate=0) Fragment1.adapter.notifyDataSetChanged(); else Fragment2.adapter.notifyDataSetChanged(); } 回答1: You could do the following with Otto event bus: public class UpdateListEvent {