Android : Split the string in java

on Saturday, January 31, 2015



String items={shoporder=shop1,shopname=abc,place=mmm};


I want to split the items as like (shop1).And assign to another string



String1=shop1
string2=abc
string3=mmm


// Get User records from SQLite DB
ArrayList<HashMap<String, String>> userList = controller.getAllUsers();
// If users exists in SQLite DB
if (userList.size() != 0) {
// Set the User Array list in ListView
final ListAdapter adapter = new SimpleAdapter(second.this, userList, R.layout.view_user_entry, new String[] {
"shopId", "shopOrder","date","todayTarget","targetCompleted","shopHandled_person","shopName","salesmanName" }, new int[]
{ R.id.shopId,R.id.shopOrder,R.id.date,R.id.todayTarget,R.id.targetCompleted,R.id.shopHandled_person,R.id.shopName,R.id.salesmanName});
final ListView myList = (ListView) findViewById(android.R.id.list);
myList.setAdapter(adapter);
myList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override

public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

String items=myList.getItemAtPosition(position).toString();
}


The string items contains all the list values.So i want to split the values and passed in to second activity.


0 comments:

Post a Comment