android-listview

How to access one class by two different classes with different parameters ?

旧街凉风 提交于 2019-12-13 08:15:17
问题 I wonder how can I achieve something like this. In my MainActivity, I want to call MyCustomBaseAdapter , getCount function. MainActivity public class MainActivity extends AppCompatActivity { InfoAPI sqlcon; private SimpleCursorAdapter dataAdapter; private SQLiteDatabase database; private MyDatabaseHelper dbHelper; private ListView listView; TextView txtNoResult; MyCustomBaseAdapter obj; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

How to fire different activities when buttons are clicked in android?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 08:02:08
问题 I am currently developing an android app. I have 4 layouts in my app(1 main layout and 3 sub layouts). In my main layout I am using three imagebuttons and if each button is clicked it starts an activity. i.e., when a button is clicked it transitions over to the next layout. I used the onClicklistener() method to handle the event when the button is clicked. The problem is that when the first button is clicked it changes to the next layout successfully but when the other two buttons are clicked

Android refresh Adapter with BaseAdapter

老子叫甜甜 提交于 2019-12-13 08:01:31
问题 in this code after insterting new items to adapert my list could not refresh and update with notifyDataSetChanged() for example for this line my adapter could set without any problem. adapter = new ReceivedAdapter(context, items); getRequestFromServer(0, 10); after that i have 10 item in list and adapter . private String getRequestFromServer(long lastID, int count) { String received = ""; try { received = new JsonService(config_username, config_password, lastID, count, G.F_RECEIVE_SMS)

Reading files from a custom function is FC the app

牧云@^-^@ 提交于 2019-12-13 07:39:20
问题 I have the following code: final RelativeLayout mFrame3 = (RelativeLayout) inflater.inflate( R.layout.ptrip, container, false ); folder = new File(Environment.getExternalStorageDirectory() + "/tc/"); FilesInFolder = GetFilesData(folder.getAbsolutePath()); FileSize = GetFileSize(folder.getAbsolutePath()); for (Map.Entry<String, String> current_file:FilesInFolder.entrySet()) { rowsArray.add(new SetRows(R.drawable.ic_launcher, current_file.getKey().toString(), current_file.getValue().toString())

Error android: Your content must have a ListView whose id attribute is android.R.id.list

孤街醉人 提交于 2019-12-13 07:36:15
问题 Hi everybody i need some help with my problem. I want to show all data in database . But when i try to show, i got an error in log Cat like this: Your content must have a ListView whose id attribute is android.R.id.list This is my query in DBHelper.java public Cursor getAll() { SQLiteDatabase db = getReadableDatabase(); Cursor cur = db.query(TableName, new String[]{ID, LATITUDE, LONGITUDE, RADIUS, ALAMAT, KONTEKS_TUGAS}, null, null, null, null, null); db.close(); return cur; } My code in view

Change ListView divider length based on longest Text in List

一曲冷凌霜 提交于 2019-12-13 07:35:56
问题 I've been looking at things on Stackoverflow and cannot find out how to do this. What I want is something like this: xxxxxxxx -------- xxxx -------- xx Instead of the usual xxxxxxxx ----------------------------------- (until end of screen) xxxx ----------------------------------- xx I wonder if there is an really easy way to do it. I figure it involves changing the right margin but that's about as far as I got. I am creating my ListViews at run-time by the way. 回答1: You should do something

null pointer exception on set on click listener in list view on android

核能气质少年 提交于 2019-12-13 07:29:00
问题 i have a list view in my app with image buttons and i write action for each image button. but i get null pointer exception when touch the image buttons. i do not know the reason. please help me. my code: public class InventoryListActivity extends ListActivity { private InventoryAdapter adapter; private InventoryObserver inventoryObserver; ListView listview; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.inventory_list);

Drag and Drop with cwac-touchlist

血红的双手。 提交于 2019-12-13 07:15:42
问题 I have two questions. 1. How to make app remember new order in ListView what I made with drag and drop. Like now I can reorder items but every time I open app, I have to reorder items again. 2. My app should open different webpage from each item. But when I reorder items then web links doesn't reorder. They stick on same. Like example: I have items Google and Yahoo! so links are "http://google.com" and "http://yahoo.com". Then I reorder item: Google was top but I drag Yahoo to top. After that

ListView within a listview

对着背影说爱祢 提交于 2019-12-13 07:05:58
问题 I have a parent ListView shown with items based on a custom layout. When a user clicks on any item then I need to add a child ListView to that item and should display the overall item of the parent ListView with expanding animation. [All data need to be added dynamically] Any suggestions.... 回答1: Simple you can add your item in a layout (via xml or code) and show(hide) with animation. Here is example from Udinic. It had listview item expand with animation and require API level only 4+. This

Searchview that filters a listview, with custom listview_items

别说谁变了你拦得住时间么 提交于 2019-12-13 07:00:52
问题 My app has got a custom ListView-Adapter that inflates a listview_item, which has multiple TextViews into a ListView. I have added a SearchView to the layout but I want have it so that it can search the ListView and filter it by looking if the data typed in the SearchView is the same as any of the data in the TextViews from the listview_items. 回答1: Override OnQueryTextListener in your acitivity class like : @Override public boolean onQueryTextChange(String newText) { mAdapter.getFilter()