Skip to main content

Posts

Showing posts from 2015
Global AsynTask class to do background process and get the response within in activity. PostAsynTas.java <pre  style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnbDC7MPHHW8IIEJH1g2jNx4ZMNB1xp3_cx-AyaviwgTjGErFi-96LEGgoAwnnAj8v-cDufG1SyDvnY0ht7EzlIHvq_U1erBJo3n5OA5rx3fvOOJqAw_kc4yh1RIMow1SH-fLlaEcN9tvP/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;"><code style="color:#000000;word-wrap:normal;"> public abstract class PostAsynTask extends AsyncTask&lt;Void, Void, String&gt; {     private List&lt;NameValuePair&gt; paramValues;      Context ctx;      HttpManager http;      String _StrResult = "", _StrApiKey = "", _StrUrl = "", _StrUserId,          _StrToken, _StrImagePath;     ...
Update Progress in notification: public class NetworkService extends IntentService {     public static final String FILE_PATH = "file_path";     public static final String _FILE_PATH = "_path";     public static final String PERCENT_EXTRA = "percent";     public static final String FILE_NAME_EXTRA = "FileName";     public static final String STATE_EXTRA = "state";     public static final String IS_ALBUM_UPLAODING = "IsAlbumUplaoding";     public static final String XML = "xml";     public static final String TOKEN = "token";     public static final String MESSAGE = "mesasge";     public static final String POST_DATE = "postdate";     public static final String USERID = "userid";     public static final String GROUPID = "groupid";     public static final String PATH = "path"; ...
Parse XML using XmlPullParser. Ksoap library essentially required to parse XML, which will be in libs folder of project. Initially we have to create parser Handler class based on xml response from server. AllHuudleHandler .java public class AllHuudleHandler extends DefaultHandler { private List<AllHuudleModel> huudleList;    private String text;     private AllHuudleModel huudle;     private StringBuffer stringBuffer=null;     public AllHuudleHandler() {         huudleList = new ArrayList<AllHuudleModel>();         stringBuffer = new StringBuffer();     }     public List<AllHuudleModel> getHuudleList() {         return huudleList;     }      // Event Handlers     public void startElement(String uri, String localName, ...
Copy database from assets folder. Keep database in your assets folder with predefine tables and with the help below class you can copy database into your app database folder from assets folder. databaseHelper.java public class databasehelper extends SQLiteOpenHelper {     private static String DATABASE_NAME = "databasename.sqlite";     public static SQLiteDatabase myDataBase;     private Context myContext;     private String path = "/data/data/packagename/databases/";     private static CategoryWiseQandA item;     public databasehelper(Context context) {   super(context, DATABASE_NAME, null, 1);         this.myContext = context;         try {             createDataBase();             openDataBase();       ...