一个arraylist到另一个arraylist?(one arraylist to another arraylist?)
我是android新手..
我正在将一个String arraylist值复制到另一个String arraylist,我希望复制没有重复。 请任何人帮助我......
非常感谢..
public class Videoplayer extends Activity { private GridView girGridView; public static String hs = ""; public static ArrayList<String> Array = new ArrayList<String>(); public static ArrayList<String> resim_list=new ArrayList<String>(); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_videoplayer); Bundle bundle = getIntent().getExtras(); ArrayList<String> Array = bundle.getStringArrayList("string-array"); GridViewConfig.addImageUrls(); System.out.println("String Video"+ Array); girGridView=(GridView) findViewById(R.id.gridView1_bir); girGridView.setAdapter(new ImageAdapter(this)); girGridView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View view, int position,long arg3) { Toast.makeText(getApplicationContext(), GridViewConfig.getResim_list().get(position), Toast.LENGTH_SHORT).show(); } }); } public static class GridViewConfig { public static ArrayList<String> resim_list=new ArrayList<String>(); public static ArrayList<String> getResim_list() { return resim_list; } public void setResim_list(ArrayList<String> resim_list) { GridViewConfig.resim_list = resim_list; } public static void addImageUrls() { Set<String> hs = new LinkedHashSet<String>(Array);// set of unique elments // LinkedHashSet maintains insertion order resim_list.addAll(hs); System.out.println("NEW RESIM_LIST" + resim_list);
这个怎么做???
I'm new to android..
I am coping one String arraylist values to another String arraylist, i want copy with out duplicates. please any one help me...
Thanks a lot..
public class Videoplayer extends Activity { private GridView girGridView; public static String hs = ""; public static ArrayList<String> Array = new ArrayList<String>(); public static ArrayList<String> resim_list=new ArrayList<String>(); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_videoplayer); Bundle bundle = getIntent().getExtras(); ArrayList<String> Array = bundle.getStringArrayList("string-array"); GridViewConfig.addImageUrls(); System.out.println("String Video"+ Array); girGridView=(GridView) findViewById(R.id.gridView1_bir); girGridView.setAdapter(new ImageAdapter(this)); girGridView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View view, int position,long arg3) { Toast.makeText(getApplicationContext(), GridViewConfig.getResim_list().get(position), Toast.LENGTH_SHORT).show(); } }); } public static class GridViewConfig { public static ArrayList<String> resim_list=new ArrayList<String>(); public static ArrayList<String> getResim_list() { return resim_list; } public void setResim_list(ArrayList<String> resim_list) { GridViewConfig.resim_list = resim_list; } public static void addImageUrls() { Set<String> hs = new LinkedHashSet<String>(Array);// set of unique elments // LinkedHashSet maintains insertion order resim_list.addAll(hs); System.out.println("NEW RESIM_LIST" + resim_list);
How to do this???
原文:https://stackoverflow.com/questions/16413360
最满意答案
如果您从XML设置此值,则必须将枚举值“restart”或“reverse”置于其中。
此外,动画不会一个接一个地运行,因为您似乎在考虑动画XML。 如果您希望其他动画在第一个动画之后启动,请同时设置“startOffset”属性(如android:startOffset =“1000”)。
You have to put the enum value of "restart" or "reverse" there if you're settings this values from XML.
Besides, animations don't run one after the other as you seem to think given your animation XML. If you want the other animation to start afther the first one, set the "startOffset" attribute as well (like android:startOffset="1000").
相关问答
更多-
该方法需要LoaderCallbacks作为参数。 你的Activity需要实现LoaderCallbacks接口 。 或者你提供一个匿名的接口实现,如: LoaderManager.LoaderCallbacks callbacks = new LoaderManager.LoaderCallbacks() { @Override public Loader onCreateLoader(int id, Bundle args) { retu ...
-
我认为你要问的是: 隐式和显式的转换对int和decimal是如何工作的? 你在问隐式转换,它会自动将一个对象转换为另一个已定义的类型。 对于int和decimal你将无法做到这一点,因为它们已经在框架中定义了,并且无法通过将其转换为int来减小decimal的范围。 但是,如果您使用它作为您创建的实际对象的示例,则可以使用上面的隐式链接来了解更多关于它如何工作以及如何实现的信息。 但是你总是可以使用convert方法将它们转换为正确的类型; public int MyProperty { get; set ...
-
WCF将不接受具有日期时间属性的对象(400错误请求)(WCF will not accept an object with a datetime property (400 bad request))[2022-04-29]
好的,我经过几周的搜索后终于找到了这个问题的答案。 我遇到的问题在下面链接的帖子中进行了充分解释,对于我所提供的问题的解决方案非常合适。 这里是解决我的问题的帖子 。 Ok I finally found the answer to this question after weeks of searching. The problem I was experiencing is explained fully in the post linked to below, and the solution to ... -
如何接受3个参数作为int(How to accept 3 arguments as int)[2019-10-13]
您可以使用scanf读取多个数字 int a, b, c; scanf("%d %d %d", &a, &b, &c); You can read in multiple numbers with scanf int a, b, c; scanf("%d %d %d", &a, &b, &c); -
带有一组有限键的Hashmap,每个键只接受一种类型的值?(An Hashmap with a finite set of keys that each accept only one type of value?)[2022-06-07]
你为什么要使用hashmap? 如果您已经知道“密钥”,只需使用这些成员创建一个类,然后您可以根据需要键入它们。 如果由于某种原因你真的必须使用hashmap,你可以扩展它并覆盖put()方法以检查你的魔术值。 但我强烈建议不要这样做,这是糟糕的设计。 Why are you using a hashmap for this? If you have known "keys", just make a class with those members and then you can type them h ... -
请尝试以下方法 RadioButton radioButton1, radioButton2, radioButton3; Button setColorButton, cancelButton; TextView textwju; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.radiobu ...
-
动画
属性android:repeatMode不接受int(Animation [2023-12-12]property android:repeatMode will not accept an int) 如果您从XML设置此值,则必须将枚举值“restart”或“reverse”置于其中。 此外,动画不会一个接一个地运行,因为您似乎在考虑动画XML。 如果您希望其他动画在第一个动画之后启动,请同时设置“startOffset”属性(如android:startOffset =“1000”)。 You have to put the enum value of "restart" or "reverse" there if you're settings this values from XML. Besid ... -
ListView适配器: Animation scaleUp; public MyAdapter(...) { //... scaleUp = AnimationUtils.loadAnimation(activity, R.anim.scale_up_fast); } public View getView(final int position, View convertView, ViewGroup parent) { CardView cv; ...
-
您可以使用反射来设置属性,而无需在编译时知道确切的类型。 像这样的事情会做: public void SetReportObject( object obj ) { if(obj == null) throw new ArgumentNullException("obj"); PropertyInfo textProperty = obj.GetType().GetProperty("Text"); if(textProperty == null) throw new Invali ...