adapter

ListView and hidden Id. How it is possible?

限于喜欢 提交于 2019-12-03 16:35:25
I'm developing an application for android and now I have implemented a ListView that shows a list of courses, connected to a database. I would like to know how to include, with the name, an hidden id (that come from the db) so that once the user click on the elements the app goes to the relative view of the selected courses. And how can I maintain the id during the navigation inside the course-view? At the moment my code just load the name of the courses from the db and set in the list view: ArrayAdapter<String> result = new ArrayAdapter<String>(CourseActivity.this, android.R.layout.simple

set list view adapter in a fragment in android

倾然丶 夕夏残阳落幕 提交于 2019-12-03 16:24:42
问题 I want a custom row, so I am using a List View in an xml and inflating into a fragment. I am very confused of how to set the adapter for the list View. I created a new adapter which extends Base Adapter. In the getView method, I really don't know what context to pass while inflating the row.xml layout. How do I set the adapter for the list view and where? public class ResultsFragment extends Fragment{ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle

example using rhino's JavaAdapter

空扰寡人 提交于 2019-12-03 16:14:05
Can someone provide me an example on how to extend a java class in java script using Rhino's java adapter ? For anyone else who might come across this, there's a decent example here (the author uses it to extend awt.Canvas ). var smileyCanvas = new JavaAdapter(awt.Canvas, { paint: function (g) { var size = this.getSize(); var d = Math.min(size.width, size.height); var ed = d / 20; var x = (size.width - d) / 2; var y = (size.height - d) / 2; // draw head (color already set to foreground) g.fillOval(x, y, d, d); g.setColor(awt.Color.black); g.drawOval(x, y, d, d); // draw eyes g.fillOval(x+d/3-

Populating a GridView with ImageViews dynamically/programmatically using a ImageAdapter

半城伤御伤魂 提交于 2019-12-03 15:28:32
I try to develop an Android App which allows the user to fetch data from flickr and show it in a GridView (with some nice 3D-Animation). After some adventures i got it almost running, but now I'm stuck. Here's the problem: I got a UI Thread "LoadPhotosTask" which gets the pictures from flickr, just like the open source application photostream . In the method onProgressUpdate(LoadedPhoto... value) of that subclass I call addPhoto() . Until now everythings fine - I got some nice Bitmap and Flickr.photo data with all the information I need. @Override public void onProgressUpdate(LoadedPhoto...

导出文档设置exportDocument

孤街浪徒 提交于 2019-12-03 14:34:29
<?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.4"?> <plugin> <extension point="org.eclipse.ui.actionSets"> <actionSet id="com.neusoft.unieap.workshop.exportDocument.actionSet1" label="UniEAP Function Area" visible="true"> <action class="com.neusoft.unieap.workshop.exportdocument.action.ExportDesignDocumentAction" icon="icons/doc_ex.png" id="com.neusoft.unieap.workshop.exportDocument.action1" label="%PLUGIN1" style="push" toolbarPath="Normal/UniEAP" tooltip="%PLUGIN1"> </action> </actionSet> </extension> <extension point="org.eclipse.core.runtime.adapters"> <factory adaptableType=

Custom SimpleCursorAdapter, database query and NullPointerException

被刻印的时光 ゝ 提交于 2019-12-03 14:02:29
问题 I'm trying to make ListView populated from database, and spice each row with fancy delete button. So I made list Activity and custom SimpleCursorAdapter. This is main ListView activity: public class EditEntries extends ListActivity { Cursor cursor; DBAdapter db = new DBAdapter(this); private static String[] FROM = { _ID, SCORE_COLUMN, "date(time, 'localtime')", }; private static int[] TO = { R.id.rowid, R.id.title, R.id.time, }; public void onCreate(Bundle savedInstanceState) { super.onCreate

NullPointerException: Attempt to invoke virtual method 'int java.util.ArrayList.size()' on a null object reference

寵の児 提交于 2019-12-03 13:33:44
问题 I'm a newbie to Fragments and custom ListView adapters. Can anyone give me a hand please? I've got my Fragment where I have my ListView public class RecordingListFragment extends Fragment implements OnItemClickListener { ListView mListView; TextView emptyView; Button options, delete,edit; ArrayList<String> recordings = null; RecordingsListAdapter mAdapter; public RecordingListFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle

Is it possible to load ListPreference items from an adapter?

对着背影说爱祢 提交于 2019-12-03 13:08:09
I'm setting out to create a settings activity for my app. I've defined a PreferenceActivity with a nice layout including a ListPreference object for the user to select a bluetooth device. I'm having trouble dynamically populating the list . I would like to populate ListPreference with values from an array adapter (which I'll create and populate with relevant bluetooth device names). If this were a spinner View, I could just call setAdapter() . However with the ListPreference object I can't figure out how to attach an adapter ( findviewByID won't cast from View To ListPreference , so I can't

Android Adapter multiple getView

狂风中的少年 提交于 2019-12-03 12:48:01
i have read about the issue of getView called multiple times and all the answers. However, i don't find a solution for my problem. I have a list where rows have two states: read or not. Well, i want to the items seen for first time have a different color and when i scroll the list, they change their color to "read state". In order to do this, in the method getView of my adapter i set a field isRead when the row for that item is painted. But the problem is the following: since the method getView is called multiple times the field is marked as read and when the list is shown in the screen it

Make last Item / ViewHolder in RecyclerView fill rest of the screen or have a min height

你。 提交于 2019-12-03 11:41:58
I'm struggeling with the RecyclerView. I use a recycler view to display the details of my model class. //My model class MyModel { String name; Double latitude; Double longitude; Boolean isOnline; ... } Since some of the values might not be present, I use the RecyclerView with custom view types (one representing each value of my model). //Inside my custom adapter public void setModel(T model) { //Reset values itemCount = 0; deviceOfflineViewPosition = -1; mapViewPosition = -1; //If device is offline, add device offline item if (device.isOnline() == null || !device.isOnline()) {