Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Advanced listview(want to get data from multiple list to childlist)
icon10.gif  Advanced listview [message #1094879] Mon, 26 August 2013 10:28 Go to next message
Pierre Goude is currently offline Pierre GoudeFriend
Messages: 1
Registered: August 2013
Junior Member
Hi I am having a problem. i have created a listview with chemicals and also made it seracheble, when i press for example lol in list a new page opens thats reply with lol.
now my problem is i whant to get info from a 3.d list. so when i press lol in list a new page opens that replyes with lol and text: lought out lout mean very funny





.
in my main java i have:
package com.example.chemicals;

import java.util.ArrayList;
import java.util.List;

import android.R.string;
import android.os.Bundle;
import android.provider.ContactsContract.Data;
import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.Menu;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.Toast;


public class MainActivity extends ListActivity {

EditText filterText;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);


final ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, android.R.id.text1,
getMode1());

final ArrayAdapter<String> adapter1 = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_2, android.R.id.text2,
getMode2());

setListAdapter(adapter);
filterText = (EditText) findViewById(R.id.filterText);
filterText.addTextChangedListener(new TextWatcher() {

@Override
public void onTextChanged(CharSequence s, int start, int before,
int count) {
adapter.getFilter().filter(s. toString());

}

@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
// TODO Auto-generated method stub

}



@Override
public void afterTextChanged(Editable s) {
// TODO Auto-generated method stub




}

});

}

private List<String> getMode1() {
List<String> list = new ArrayList<String>();
list.add("Aabiton");
list.add("Aagrano");
list.add("Aanectra");
list.add("Aaventa");
list.add("Abavit");
list.add("Abietinsyra");
list.add("Absorptionsmedel");
list.add("Acenaften");
list.add("Acetal");
list.add("Acetaldehyd");
list.add("Acetaldehyddietylacetal");
list.add("Acetaldehydoxim");
list.add("Acetamid");

return list;

}
private List<String> getMode2() {
List<String> datan = new ArrayList<String>();
datan.add("response 1");
datan.add("response 2");
datan.add("blaha");
datan.add("blaha");
datan.add("dsfg");
datan.add("Abietinsyra");
datan.add("Absorptionsmedel");
datan.add("Acenaften");
datan.add("Acetal");
datan.add("Acetaldehyd");
datan.add("Acetaldehyddietylacetal");
datan.add("Acetaldehydoxim");
datan.add("Acetamid");

return datan;

}


@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
// Get the item that was clicked
Object o = this.getListAdapter().getItem(position);
String keyword = o.toString();



// Launching new Activity on selecting single List Item
Intent ii=new Intent(MainActivity.this, SingleListItem.class);
ii.putExtra("list", keyword);

startActivity(ii);

}

}




// Launching new Activity on selecting single List Item
Intent ii=new Intent(MainActivity.this, SingleListItem.class);
ii.putExtra("list", keyword);

startActivity(ii);

}

}


and in my second java page i have
TextView txtProduct = (TextView) findViewById(R.id.product_label);

Intent i = getIntent();
// getting attached intent data
String keyword = i.getStringExtra("list");
// displaying selected product name
txtProduct.setText(keyword);

}


}
}


how do i get data from a 3:d list in here?
Re: Advanced listview [message #1095419 is a reply to message #1094879] Tue, 27 August 2013 03:13 Go to previous message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 3989
Registered: July 2009
Senior Member

You'll want a forum for Android questions rather than Eclipse questions: http://www.eclipse.org/forums/index.php/t/225513/

Nitin Dahyabhai
Eclipse Web Tools Platform
Previous Topic:OSX 10.8.3 - Eclipse 4.4.0 Menu's Disabled?
Next Topic:Programatically select System Editor in Open With Menu
Goto Forum:
  


Current Time: Thu Feb 25 16:41:07 GMT 2021

Powered by FUDForum. Page generated in 0.03264 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top