arraylist

ArrayAdapter and ListView display only specific items

寵の児 提交于 2020-01-06 19:42:22
问题 I am trying to impement a school planner app. There is a timetable overview implemented as a ListView for each day wrapped into a Tab Layout. So the user can switch between days Monday to Friday and gets his timetable for the specific day. public class TimetableAdapter extends ArrayAdapter<Lesson> { private List<Lesson> lessonList; // The model ... public View getView(int position, View convertView, ViewGroup parent) { View view = null; ... view = inflater.inflate(R.layout.timetable_row, null

ArrayAdapter and ListView display only specific items

左心房为你撑大大i 提交于 2020-01-06 19:42:11
问题 I am trying to impement a school planner app. There is a timetable overview implemented as a ListView for each day wrapped into a Tab Layout. So the user can switch between days Monday to Friday and gets his timetable for the specific day. public class TimetableAdapter extends ArrayAdapter<Lesson> { private List<Lesson> lessonList; // The model ... public View getView(int position, View convertView, ViewGroup parent) { View view = null; ... view = inflater.inflate(R.layout.timetable_row, null

Cannot resolve constructor for ArrayList [closed]

天大地大妈咪最大 提交于 2020-01-06 18:13:38
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I created a new class and a constructor like this: public class Person { String firstName; String lastName; String pass; public Person(){} public Person(String f,String l,String p){ firstName=f; lastName=l; pass=p; } } Then I created an object in MainActivity: protected void onCreate(Bundle savedInstanceState) {

Add Multidimensinal array to an array list using Java

情到浓时终转凉″ 提交于 2020-01-06 18:04:54
问题 I am having a method(function) that is supposed to add a (8*6)Array to an Array list. Function is called several times. int [][] KeySelection = new int [8][7]; for(int i=0;i<KeySelection.length;i++){ for(int j=0;j<KeySelection[0].length;j++){ KeySelection[i][j] = (int) (Math.random () * 2); } } Each time this function is called a totally new KeySelection Array is done. What i need now is to declare an array list so that it could store all the KeySelection Arrays in that list. So that when i

How to pass an arrayList between two intent in Android

蹲街弑〆低调 提交于 2020-01-06 17:57:45
问题 I am new in Android and I have a question regarding intent. I want to pass an String ArrayList between two activities by using intent. I have tried this: ` ArrayList<String> playerName = new ArrayList<>(); Intent intent = new Intent(this,Game.class); intent.putStringArrayListExtra("Player",playerName); startActivity(intent);` Then I tried to receive my intent like that: ` ArrayList<String> playerNameList= new ArrayList<>(); playerNameList = getIntent().getStringArrayListExtra("Player"); int

How to show result in JFrame Form if data source is a XML file?

99封情书 提交于 2020-01-06 17:28:32
问题 Here is the codes: I write XML file to a comment under this post. Developer: public class Developer { private String id; private String name; private String surname; private int age; public Developer(String id, String name, String surname, int age) { this.id = id; this.name = name; this.surname = surname; this.age = age; } public String getId() { return id; } public String getName() { return name; } public String getSurname() { return surname; } public int getAge() { return age; } } The

How to show result in JFrame Form if data source is a XML file?

一世执手 提交于 2020-01-06 17:28:07
问题 Here is the codes: I write XML file to a comment under this post. Developer: public class Developer { private String id; private String name; private String surname; private int age; public Developer(String id, String name, String surname, int age) { this.id = id; this.name = name; this.surname = surname; this.age = age; } public String getId() { return id; } public String getName() { return name; } public String getSurname() { return surname; } public int getAge() { return age; } } The

java.util.ConcurrentModificationException in ArrayList processing

99封情书 提交于 2020-01-06 15:14:24
问题 java.util.ConcurrentModificationException at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372) at java.util.AbstractList$Itr.next(AbstractList.java:343) at com.alpha.beta.purchasing.item.VendorItemList.loadItems(VendorItemList.java:51) at com.alpha.beta.purchasing.Shipment.loadItems(Shipment.java:1006) at com.alpha.beta.purchasing.Shipment.loadItems(Shipment.java:953) at com.alpha.beta.purchasing.Shipment.getItemTotal(Shipment.java:1503) at com.alpha.beta.purchasing

Creating a Matrix with ArrayLists

可紊 提交于 2020-01-06 15:06:28
问题 I want to create an ArrayList-matrix with n-rows and m-columns, for example 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 I've already written a code for creating such a matrix but my code doesn't display the values when I clear the list containing the column-data. Here is my package testproject; import java.util.ArrayList; public class TestProject { public static void main(String[] args) { ArrayList<Integer> intList = new ArrayList<>(); ArrayList<ArrayList<Integer>> mainList = new

How to properly add data to ArrayList - Android

谁都会走 提交于 2020-01-06 14:47:22
问题 I have a class the extends arrayAdapter. I am trying to add variables to the list but I am not sure exactly how to do so. Here is my current ArrayAdapter class. class Item { String username; String number; String content; } class ListAdapter extends ArrayAdapter<Item> { public ListAdapter(Context context, int textViewResourceId) { super(context, textViewResourceId); // TODO Auto-generated constructor stub } private List<Item> items; public ListAdapter(Context context, int resource, List<Item>