Error not Found? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Error not Found?

Hello Programmers, I am creating an app which have a list view but when i click that it does not follow the instructions. Main Activity Code :- ListView listView; Button btn_start; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); listView = (ListView) findViewById(R.id.list); custom_adapter adapter = new custom_adapter(this); listView.setAdapter(adapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Intent intent = new Intent(getApplicationContext(), workout_detail.class); intent.putExtra("Position", position); startActivity(intent); } }); Custom Adapter code :- public class custom_adapter extends BaseAdapter { Context context; String [] Heading= {"Triceps"}; String [] Subheading= {"Triceps the essintial part of an exercise it will increase you muscle power..."}; int [] gif= {R.drawable.triceps}; public custom_adapter(Context ctx) { this.context=ctx; } @Override public int getCount() {return Heading.length;} @Override public Object getItem(int position) {return Heading[position];} @Override public long getItemId(int position) {return position;} @Override public View getView(int position, View view, ViewGroup parent) { if(view==null){LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); view=inflater.inflate(R.layout.customlayout,null); } ImageView imageView=(ImageView) view.findViewById(R.id.imgId); TextView view1=(TextView) view.findViewById(R.id.Heading); TextView view2=(TextView) view.findViewById(R.id.Subheading); imageView.setImageResource(gi

17th Apr 2020, 4:37 PM
Rahul sharma
Rahul sharma - avatar
2 Answers
+ 1
Thesmallest yeah my application is showing up, but the item isn't shown in the next activity.
4th Aug 2020, 12:11 PM
Rahul sharma
Rahul sharma - avatar
0
Thesmallest hello i would like to run this listview where it automatically pick an item and show it on next activitiy
4th Aug 2020, 3:01 AM
Rahul sharma
Rahul sharma - avatar