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
Contextual code suggestions in your IDE  Get Codota for Java
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
Contextual code suggestions in your IDE  Get Codota for Java
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
Contextual code suggestions in your IDE  Get Codota for Java
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
Contextual code suggestions in your IDE  Get Codota for Java
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
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: initLoader
    public RosterDialogsAdapter(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, "(CASE WHEN " + GlobalProvider.ROSTER_BUDDY_STATUS + "=" + StatusUtil.STATUS_OFFLINE 
                + " THEN 0 ELSE 1 END" + ") DESC," + GlobalProvider.ROSTER_BUDDY_NICK + " ASC"); 
    } 
 
    @Override 
    public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) {
        // Detecting columns. 
        COLUMN_ROSTER_BUDDY_ID = cursor.getColumnIndex(GlobalProvider.ROSTER_BUDDY_ID);
Full Snippet Info
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: getLoader
        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
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: restartLoader
        spinnerFuel = (Spinner) findViewById(R.id.inputTreibstoff);
        spinnerFuel.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override 
            public void onItemSelected(final AdapterView<?> parent, final View view, final int position, final long id) {
                selectedFuelID = id;
                getLoaderManager().restartLoader(SELECTED_FUEL_LOADER, null, CarEditActivity.this);
            } 
 
            @Override 
            public void onNothingSelected(final AdapterView<?> parent) {
            } 
        }); 
    } 
 
    @Override 
    protected void onResume() { 
        super.onResume(); 
        fuelCA = new SimpleCursorAdapter(
                this,
                android.R.layout.simple_spinner_item,
Full Snippet Info
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: restartLoader
 
    @Override 
    public void onCameraChange(CameraPosition cameraPosition) {
        map.clear();
        this.visibleRegion = map.getProjection().getVisibleRegion();
        context.getLoaderManager().restartLoader(loaderId, null, this);
    } 
 
    public GoogleMap getMap() {
        return map;
    } 
 
    public int getLoaderId() { 
        return loaderId;
    } 
 
    public Activity getContext() {
        return context;
    } 
 
Full Snippet Info
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: restartLoader
	public void loadPrev() { 
		Log.i("Expandable", "daniel loadPrev()");
		 
		Bundle dataBundle = new Bundle();
		dataBundle.putInt(KEY_LOADING_TYPE, 1);
		mLoaderManager.restartLoader(0, dataBundle, this);
	} 
	 
	public void loadNext() { 
		Log.i("Expandable", "daniel loadNext()");
 
		Bundle dataBundle = new Bundle();
		dataBundle.putInt(KEY_LOADING_TYPE, 0);
		mLoaderManager.restartLoader(0, dataBundle, this);
	} 
 
	@Override 
	public Loader<ArrayList<ArrayList<String>>> onCreateLoader(int id, Bundle bundle) {
		Log.i("Expandable", "daniel " + Thread.currentThread().toString() + " onCreateLoader() " + bundle.getInt(KEY_LOADING_TYPE));
		mLoaderUICallback.onBeforeLoadStart();
Full Snippet Info
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related Android LoaderManager Questions & Answers:

See Code Examples for Android LoaderManager Methods: