Skip to main content

Posts

Showing posts from September, 2013

Android: Share Intent for Text,Image & URL

import java.io.File ; import android.net.Uri ; import android.os.Bundle ; import android.os.Environment ; import android.view.View ; import android.app.Activity ; import android.content.Intent ; public class MainActivity extends Activity { @Override public void onCreate ( Bundle savedInstanceState ) { super . onCreate(savedInstanceState); setContentView( R . layout . activity_main); View . OnClickListener handler = new View . OnClickListener () { public void onClick ( View v ) { switch (v . getId()) { case R . id . buttonShareTextUrl : shareTextUrl(); break ; case R . id . buttonShareImage : shareImage(); break ; } } }; findViewById( R . id . buttonShareTextUrl) . setOnClickListener(handler); findViewById( R . id . buttonShareIma

[Solved Issue] : Multiple Selection ListView

ListView with CheckBox Today I am going to show how to deal with Custom ListView having Chekbox. Many developers are facing the issue of Checkbox item getting uncheck or check while scrolling the ListView. So, I will make it clear to developers how to deal with ListView having Checkbox. The issue with CheckBox inside ListView is that the view gets recycled due to recycling of ListView and the value of Checkbox(check or uncheck) is not maintained. To, maintain the state to CheckBox there has to be something that can store the state of Checkbox. So, we have a Model class that will have name and selected property of ListView row having TextView and CheckBox. Model.java public class Model {          private String name;     private boolean selected;          public Model(String name) {         this.name = name;     }          public String getName() {         return name;     }          public boolean isSelected() {         return selected;     }          public void setSelected(bool