android - I'd like to select multiple items in my listView, and send them to another listView in another activity with the click of a button -


I would like to select multiple items in my list, and send them to another list button. I provide some code, but I am not very clean right now and I can not find the answer anywhere. When I run my application I, then everything looks fine goes as UI id = "@ + id / beerProduct" Android: layout_width = "wrap_content" Android: layout_height =; ListView Android

  & lt:  

The file with the list view inside .xml "0 DP" Android: layout_weight = "0.28" & gt; & Lt; / ListView & gt; & Lt; Button Android "Android: attr / borderlessButtonStyle" id = "@ + id / addtolist" style = Android: Layout_width = "Match_parent" Android: Layout_height = "Wrap_content" Android: MinHeight = "75dp" android: onClick = "SendMessage" Android : Text = "@ string / addtolist" Android: textSize = "26sp" /> & Lt; / LinearLayout & gt;

.java is calling list view: package com. Misconduct Malpractice 1;

  Import android.os.Bundle; Import android.support.v7.app.ActionBarActivity; Import android.view.Menu; Import android.view.MenuItem; Import android.widget.ArrayAdapter; Import android.widget.ListView; // Option Array - & gt; Array adapter - & gt; List View Public Square Beer & lt; Object & gt; ActionBarActivity {@Override extends the creation (bundled saved instenestate) on protected void {super.ncreat (saved instancestate); SetContentView (R.layout.activity_beer); PopulateListView (); } String to create a list of private void populateListView () {// Objects [] beerItems = { "Miller Chill," "Miller's Fortune", "Miller Genuine Draft", "Miller High Life", "Miller High Life Light" "Miller Light "," Miller 64 "," Milwaukee's Best Ice "," Milwaukee's Best Lighting "," Milwaukee's Best Premium "}; // Build Adapter Ultimate Array Adapter & lt; String & gt; Adapter = new array adapter & lt; String & gt; (This, R. Late. Beer_items, beer etimes); // ListView Last ListView List Configured = (ListView) findViewById (R.id.beerProduct); List.setAdapter (adapter); } @ Override Public Boolean On Crate Option Menu (Menu Menu) {// Enhancing Menu; It adds the item to the Action Bar if it exists GetMenuInflater (). Flowers (R. menu. Beer, menu); Back true; } @ Override Public Boolean On Option Itam Select (menu item) {// Handle action bar item here clicks the action bar will automatically manage clicks on the home / up button, so long as // You specify a parental activity in AndroidManifest.xml. Int id = item.getItemId (); If (id == R.id.action_settings) {return true; } Return Super.Options item selected (item); }}  

.xml list containing properties?

  & lt; XML version = "1.0" encoding = "utf-8" & gt; & Lt; TextView xmlns: android = "http://schemas.android.com/apk/res/android" Android: layout_width = "match_parent" Android: layout_height = "match_parent" Android: minHeight = "75dp" Android: textSize = "26 clear" & Gt; & Lt; / TextView & gt;  

Thanks!
Reagan

You have to apply

Interface This interface allows you to send holes between activities. I think the object you want to send is ArrayAdapter. You can find many tutorials on the Internet to better understand the system. Some terms you'll need:

  1. Apply Parslebl interface class describes the items that you want to send
  2. A bundle from class Make it portable in it and send hole bundle as additional information before transition

      bundle new bundle = new bundle (); MBundle.putParcelable (A_KEY, YourObjectThatYouWantToSend); / / Key is the identifier for the parcel that is worthy newIntent.putExtras (newBundle); StartActivity (newIntent);  
  3. Get object activity receiver

      (YourObjectThatYouWantToSend) getIntent (). GetParcelableExtra (A_KEY);  

Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -