last day (15 days later) » 

6:36 PM
0
A: Can't seem to fix this, need checkbox to get check on list item click?

kaushikYou should use CheckedTextView instead of TextView and CheckBox. With this single widget you can get that effect. Implement custom multi select ListView with custom ArrayAdapter Tutorial 1 Tutorial 2 EDIT : code snippet of Activity public class MainActivity extends Activity { ListView ...

 
Will this have it already built in? Like when I click the text to check the checkbox?
 
yes see the 1st link and developer.android site
 
Okay, well in the tutorial it says post this in the xml file. Do I just post it in my row_layout.xml file instead of the individual textview and checkbox?
Okay i got it working in the app but got a few other problemd, how about we chat further?
 
@CristianoWilson: check the edit
 
Do I need to replace that completely with my own activity? I guess I could customize it later on no?
 
6:36 PM
yes can customize that
 
hi
Here's my Code
MyActivity3: public class MyActivity3 extends MyActivity {

ListView myListView;
Button getResult;

private ArrayList<String> dayOfWeekList = new ArrayList<String>();

private void initDayOfWeekList(){
dayOfWeekList.add("Sunday");
dayOfWeekList.add("Monday");
dayOfWeekList.add("Tuesday");
dayOfWeekList.add("Wednesday");
dayOfWeekList.add("Thursday");
dayOfWeekList.add("Friday");
dayOfWeekList.add("Saturday");

}

MyArrayAdapter myArrayAdapter;
private TextView tv;
@Override
public void onCreate(Bundle savedInstanceState) {
MyAdapter; public class MyAdapter extends ArrayAdapter<String> implements CompoundButton.OnCheckedChangeListener{

String[] values;
Boolean[] checkedStatus;

public MyAdapter(Context context, int resource, String[] values, Boolean[] checkedStatus) {
super(context, resource, values);

this.values = values;
this.checkedStatus = checkedStatus;
}

@Override
public int getCount() {
return values.length;
}

@Override
public String getItem(int position) {
return values[position];
}

@Override
public long getItemId(int position) {
but the app crashes
 
what is the error in log cat ??
R u sure about this MyActivity3 extends MyActivity
 
Yes, MyActivity has a button which i click to go to MyActivity3, which contains the listview
 
SharedPreferences sharedPreferences=getSharedPreferences("status", Context.MODE_PRIVATE);
SharedPreferences.Editor editor=sharedPreferences.edit();
editor.putBoolean(key,isChecked);
editor.commit();
add this in onitemclick instead of onCheckchange
 
Comit instead of apply?
 
6:47 PM
post log cat
then i can find what is the actual error
 
ok one sec
LogCat:
08-19 20:55:05.666 31285-31285/com.MR.brd E/Trace﹕ error opening trace file: No such file or directory (2)
08-19 20:55:05.685 31285-31285/com.MR.brd V/ActivityThread﹕ Class path: /data/app/com.MR.brd-1.apk, JNI path: /data/data/com.MR.brd/lib
08-19 20:55:05.753 31285-31285/com.MR.brd D/dalvikvm﹕ GC_FOR_ALLOC freed 46K, 4% free 8347K/8643K, paused 14ms, total 14ms
08-19 20:55:05.861 31285-31285/com.MR.brd I/dalvikvm-heap﹕ Grow heap (frag case) to 16.157MB for 8294416-byte allocation
08-19 20:55:05.897 31285-31296/com.MR.brd D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 2% free 16446K/16775K, paus
 
what is line no 70 in MyActivity3
 
getResult.setOnClickListener(new View.OnClickListener(){
 
you don't have any view named getResult thats why it is null
into ur layout activity_my3 or u forget to initialize it
 
7:03 PM
I don't know it is the code you gave me hehe
I could also give you my original working code, and then you could edit it to have a checkedtextview>
?
 
its the button get result in activity_main
 
Aha.. But wait
here's a screenshot of what I need to have
Forget the home button ontop
the Categories I already have
the rest is now in listview with each row containing a textview and checkbox
 
ok I m posting a screen shot in my answer
its middle of the night here bye good night tc.
 
chek the answer
 
7:12 PM
Yes
You see i basically only need the listview no other buttons but thanls
thanks
 

last day (15 days later) »