android-listview

ListView does not show changes until focus changes after notifyDataSetChanged

人盡茶涼 提交于 2019-12-02 07:20:05
问题 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

Why my ListView with CheckBox id getting confused?

ぐ巨炮叔叔 提交于 2019-12-02 07:13:15
问题 I'm implementing a ListView with checkbox in witch cell. But the problem is when I check in one cell and roll down the list, it get confused and others cells get checked too. Do I havo to do something else in my getView method? This is my CustonAdapter: public class AcessoriosItemAdapter extends BaseAdapter { ArrayList<AcessoriosItensLista> listAcessorios = new ArrayList<AcessoriosItensLista>(); Context context; public AcessoriosItemAdapter(Context context) { this.context = context; }

Navigation drawer listview position not refreshing

拜拜、爱过 提交于 2019-12-02 07:09:30
I have one NavigationDrawer in my Application and I have five items in my drawer: Home Accounts stock help logout Now if user click on logout it is displaying two items: Home Login Now the issue is when user click on login it always getting view of Accounts public class MainActivity extends FragmentActivity { private DrawerLayout mDrawerLayout; private ListView mDrawerList; private ActionBarDrawerToggle mDrawerToggle; private String abc; private Intent ii; // nav drawer title private CharSequence mDrawerTitle; // used to store app title private CharSequence mTitle; // slide menu items private

Android Listview Adds The Same Item

旧时模样 提交于 2019-12-02 07:04:31
I'm developing an Android Application and I'm using Android ListView. I'm getting datas from the web service and fill them into the Arraylist. It's size is 37. Then i try to fill the listview with Arraylist but it always get the same element(last one). Below you can see the code part: private void ctv_listele(String res){ ArrayList<CTV> ctvList = new ArrayList<CTV>(); try { JSONObject jsonObject = new JSONObject(res); JSONArray jsonArray = jsonObject.getJSONArray("tarife"); int max = jsonArray.length(); for(int i = 0; i < max; i++) { JSONObject tmp = jsonArray.getJSONObject(i); ctv.setYear(tmp

click event for all dynamic generated buttons android

前提是你 提交于 2019-12-02 06:39:55
I write code to generate dynamic buttons , but I don't know how to implement click event for each button dynamically. I found some answers but not work with my code... Please help me.. This is my code public class dynamicbuttion extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ScrollView sv = new ScrollView(this); LinearLayout ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); sv.addView(ll); for(int i = 0; i < 5; i++) { Button btn = new Button(this); btn.setId(i); btn.setText("dynamic buttion " + i); ll

Android: Remove item (ListView)

随声附和 提交于 2019-12-02 06:37:40
问题 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

Starting AnimationDrawable in ListView items. When are the items attached?

夙愿已清 提交于 2019-12-02 06:29:03
问题 So I've been doing some reading for the past few hours and I understand that calling start() on an AnimationDrawable before the Drawable/ImageView is fully attached will not start the animation. This seems pretty consistent with the usual UI initialization process (like view's dimensions being returned as 0 right after adding the view). I imagine that this same issue is at fault when I try to start the animation from the getView() method of an Adapter. Using a delayed Runnable that performs

Weird frames appear when using TextureView to play video in ListView

与世无争的帅哥 提交于 2019-12-02 06:05:56
问题 I managed to play multiple videos in one screen circularly, I added TextureViews to ListView with BaseAdapter which is very common and I created a IjkMediaPlayer (IjkMediaplay github)instance for each textureview. I have reused textureview in getView() callback of BaseAdapter, once getView() called, I stop the previous video and play the new video. This works fine in most of time, but occasionally, TextureView will display some frames which is not belong to the current video, the frames

How to start an activity by click of image button of a List view?

自古美人都是妖i 提交于 2019-12-02 05:59:12
问题 i have a list there is a image button in each item when i click on a image i have to start another Activity with intent following are my code my problem is i couldn't call startActivity() from custom adapter! ! in custom adapter's getView() holder.profilePicture.setOnClickListener(new OnClickListener() { public void onClick(View v) { Log.d("OnImageButton","Clicked"); Intent zoom=new Intent(AllProfile.getAppContext(), ImageZoom.class); int imageID=holder.profilePicture.getId(); zoom.putExtra(

Make listview from SQLite database

耗尽温柔 提交于 2019-12-02 05:32:30
I'm trying to populate listview from my SQLite database... this is how I get my data from database: Cursor c = database.rawQuery("SELECT * FROM " + TableName, null); int Column1 = c.getColumnIndex("uri"); int Column2 = c.getColumnIndex("file"); int Column3 = c.getColumnIndex("id"); c.moveToFirst(); if (c != null) { do { String uri = c.getString(Column1); String file = c.getString(Column2); int id = c.getInt(Column3); } while (c.moveToNext()); } I would normally add an array to listview like that: ListView my_listview2 = (ListView) findViewById(R.id.listView1); String my_array[] = {"Android",