Click here to Skip to main content
15,890,690 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
This code working well. Can I divide the listview to two column? Thanks a lot for helping..

Java
public class ListCls extends Activity {

   ListView listview;
   ArrayAdapter<String> adapter;
   ArrayList<HashMap<String, String>> word_list;
   String word_wrt[],yt;
   int word_ids[];


private static final String TABLE_NAME = "tuncTAB";


   protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.activity_main);

       ActionBar actionBar = getActionBar();
       actionBar.setDisplayHomeAsUpEnabled(false);


   }
  public void onResume() {
       super.onResume();
       Database db = new Database(getApplicationContext());
       word_list = db.records();//kitap listesini aliyoruz
       if (word_list.size() == 0) {//kitap listesi bossa
           Toast.makeText(getApplicationContext(), "Empty", Toast.LENGTH_LONG).show();
       } else {
           word_wrt = new String[word_list.size()];
           word_ids = new int[word_list.size()];
           for (int i = 0; i < word_list.size(); i++) {
               word_wrt[i] = word_list.get(i).get("word");

               word_ids[i] = Integer.parseInt(word_list.get(i).get("id"));
           }
           listview = (ListView) findViewById(R.id.list_view);

           adapter = new ArrayAdapter<String>(this, R.layout.list_item, R.id.record_name, word_wrt);
           listview.setAdapter(adapter);

       }
   }


What I have tried:

I try use the two adapter. But unfortunately it didnt work.
Posted
Updated 21-Jun-16 10:23am

1 solution

 
Share this answer
 
Comments
bugsoul 22-Jun-16 4:54am    
Thanks. But I didn't. To complex, I'm tring to figure it out.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900