Android LoaderManager - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android LoaderManager class.

This code example shows how to use the following methods: initLoader
		m_ctx       = ctx;
        m_objectId  = objectId;
        m_cursor    = null;
 
        LoaderManager lm = m_ctx.getLoaderManager();
        lm.initLoader(loaderId, null, this);
	} 
 
	 
	@Override 
	public int getCount() { 
		return m_cursor != null ? m_cursor.getCount() : 0;
	} 
 
	@Override 
	public JSONObject getItem(int idx) {
		Log.v(TAG, "getItem(" + idx + ")");
        try { 
            m_cursor.moveToPosition(idx);
            return new JSONObject(m_cursor.getString(0));
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: destroyLoader
        return mDelegate.restartLoader(id, args, callback);
    } 
 
    @Override 
    public void destroyLoader(int id) {
        mDelegate.destroyLoader(id);
    } 
 
    @Override 
    public <D> Loader<D> getLoader(int id) {
        return mDelegate.getLoader(id);
    } 
 
    @Override 
    public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {
        mDelegate.dump(prefix, fd, writer, args);
    } 
} 
Full Snippet Info
3
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: initLoader
    public ChatDialogsAdapter(Activity context, LoaderManager loaderManager) {
        super(context, null, 0x00);
        this.context = context;
        this.inflater = context.getLayoutInflater();
        // Initialize loader for dialogs Id. 
        loaderManager.initLoader(ADAPTER_DIALOGS_ID, null, this);
    } 
 
    @Override 
    public Loader<Cursor> onCreateLoader(int id, Bundle bundle) {
        return new CursorLoader(context,
                Settings.BUDDY_RESOLVER_URI, null, GlobalProvider.ROSTER_BUDDY_DIALOG + "='" + 1 + "'", 
                null, GlobalProvider.ROSTER_BUDDY_NICK + " ASC"); 
    } 
 
    @Override 
    public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) {
        // Detecting columns. 
        COLUMN_ROSTER_BUDDY_DB_ID = cursor.getColumnIndex(GlobalProvider.ROW_AUTO_ID);
        COLUMN_ROSTER_BUDDY_ID = cursor.getColumnIndex(GlobalProvider.ROSTER_BUDDY_ID);
Full Snippet Info
4
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: initLoader
    public AccountsAdapter(Context context, LoaderManager loaderManager) {
        super(context, null, 0x00);
        this.context = context;
        inflater = ((Activity) context).getLayoutInflater();
        // Initialize loader for adapter Id. 
        loaderManager.initLoader(ADAPTER_ID, null, this);
    } 
 
    @Override 
    public View getView(int position, View convertView, ViewGroup parent) {
        View view;
        try { 
            Cursor cursor = getCursor();
            if (cursor == null || !cursor.moveToPosition(position)) {
                throw new IllegalStateException("this should only be called when the cursor is valid");
            } 
            if (convertView == null) {
                view = newView(context, cursor, parent);
            } else { 
                view = convertView;
Full Snippet Info
4
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: initLoader
    super.onResume(); 
    // call initLoader on Resume avoids a bug which calls onLoadFinished twice 
  Log.e("Recent","onResume");
    LoaderManager lm = getLoaderManager();
 
    lm.initLoader(RESTO_RECENT_LOADER, null, this);
    
} 
	 
	 
	public Loader<Cursor> onCreateLoader(int id, Bundle args) {
		  String[] projection = { RestoDatabase.ID, RestoDatabase.COL_ETAB, RestoDatabase.COL_DATE_JUGE, RestoDatabase.COL_MONTANT };
	    switch (id){
	    	case RESTO_RECENT_LOADER:
	    		Log.e("onCreateLoader", "recent loader");
        	    return new CursorLoader(getActivity(),
	    	            RestoProvider.CONTENT_URI, projection, null, null, "date_jugement DESC");
	default: return null; 
	    	 
	     
Full Snippet Info
4
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android LoaderManager Questions & Answers:

See Code Examples for Android LoaderManager Methods: