Skip to main content

Posts

Diving into Kotlin Multiplatform: A Developer's First Look

  Hey fellow coders! Let's talk about a problem we've all faced. You're building an app for both Android and iOS . You write your networking layer, your data models, and all your business logic in Kotlin for Android. Then, you switch over to Xcode and... write the exact same networking layer, the exact same data models, and the exact same business logic in Swift . It's tedious. It's a maintenance nightmare. And it feels... wrong. What if you could write all that core logic just once ? Enter Kotlin Multiplatform (KMP) . So, what exactly IS KMP? In the simplest terms, KMP is a technology from JetBrains that lets you share code between different platforms—like Android, iOS, Web , and Desktop . But here's the most important part to understand right away: KMP is for sharing logic, not the UI . Think of it like this: your app has a "brain" (the business logic, data handling, and network calls) and a "face" (the user interface). KMP lets you bui...
Recent posts

How to set image button click effect ?

I have one simple solution: using that, you can set the default press effect to the button. // Create button and add event Button addImageView = (Button) bottomView.findViewById(R.id. addImage ); addImageView.setOnClickListener( new OnClickListener () { @Override public void onClick(View v) { // click event } }); //Using this code set touch listener addImageView.setOnTouchListener( touchEffect ); //touch listner OnTouchListener touchEffect = new OnTouchListener() {         public boolean onTouch(View v, MotionEvent event) {             switch (event.getAction()) {                 case MotionEvent. ACTION_DOWN : {                     v.getBackground().setColorFilter(0xe0f47521,PorterDuff.Mode. SRC_ATOP );                     v....

Date compare in java android

private boolean checkDateLimit() { long CurrentDateInMilisecond = System.currentTimeMillis(); // Date 1 long Date1InMilisecond = Date1.getTimeInMillis(); //Date2 if (CurrentDateInMilisecond <= Date1InMilisecond) { return true; } else { return false; } } /* Date1 and Date2 convert into milisecond check its value. /*

Date picker android

Button toDate = (Button) findViewById(R.id.doc_dateto); toDate.setOnClickListener(new OnClickListener() { private int month; private int year; private int day; @Override public void onClick(View v) { OnDateSetListener datePickerListener = null; datePickerListener = new DatePickerDialog.OnDateSetListener() { public void onDateSet(DatePicker view, int selectedYear, int selectedMonth, int selectedDay) { year = selectedYear; month = selectedMonth; day = selectedDay; Calendar c = Calendar.getInstance(); c.set(year, month, day); toDate.setText(c.getTime().toGMTString()); } }; final Calendar c = Calendar.getInstance(); year = c.get(Calendar.YEAR); month = c.get(Calendar.MONTH); day = c.get(Calendar.DAY_OF_MONTH); DatePickerDialog datePicker = new DatePickerDialog( SUP101SampleActivity.this, datePickerListener, year, mo...

Simple and sort Listview example (Android)

private View getChapterLayout() { ListView listView = new ListView(this); listView.setAdapter(new BaseAdapter() { public int getCount() { return chapterdata.size(); } public Object getItem(int position) { return chapterdata.get(position); } public long getItemId(int addressList) { return 0; } public View getView(int position, View convertView, ViewGroup parent) { inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.button_chapter, null); TextView textview = (TextView) convertView .findViewById(R.id.button); textview.setText(chapterdata.get(position).getName()); return convertView; } }); return listView; } // chapterdata is an arrayList // Add Event to each Row  listView.setOnItemClickListener(new OnItemClickListener() { public void onItemClic...