Android AppWidgetHostView - 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 AppWidgetHostView class.

This code example shows how to use the following methods:getHeight, getWidth, invalidate, draw
        } 
        return new File(path, name + "_ori_" + orientation + ".png");
    } 
 
    public Bitmap getPreviewBitmap() {
        mAppWidgetView.invalidate();
        Bitmap bmp = Bitmap.createBitmap(
                mAppWidgetView.getWidth(), mAppWidgetView.getHeight(), Config.ARGB_8888);
        Canvas c = new Canvas(bmp);
        mAppWidgetView.draw(c);
        return bmp;
    } 
 
    private boolean saveImage(Bitmap bmp, String name) {
        File pic = buildFile(mAppWidgetName);
        if (pic == null) {
            Log.d(LOG_TAG, "External storage not present");
            return false; 
        } 
 
7
CodeRank
This code example shows how to use the following methods:setAppWidget, setClickable, setPadding
This code example shows how to use the following methods:setId, setLayoutParams, setPadding
            } 
            //adding to same row just be on the right of previous widget and bottom edge aligned to it's bottom edge 
              
             
             
            widget.setLayoutParams(params); 
            //if (!shouldFill) widget.setPadding(0, 0, 0, 0); else 
            widget.setPadding(0, 0, 0, 0);
              
             
             
            widget.setId(100+widgCount);
            return widget; 
            } 
 
        private void RepopulateWidgetView(int Id) {
        	//places one widget based on the manager ID we are passing 
        	//we use this to put in a previously chosen widget. it will be done in onCreate 
        	//this allows us to just iterate this passing each ID in order 
        	 
5
CodeRank
This code example shows how to use the following methods:setId, setLayoutParams, setPadding
    } 
    //adding to same row just be on the right of previous widget and bottom edge aligned to it's bottom edge 
      
     
     
    widget.setLayoutParams(params); 
    //if (!shouldFill) widget.setPadding(0, 0, 0, 0); else 
    widget.setPadding(0, 0, 0, 0);
      
    widths[widgCount] = w;
     
    widget.setId(100+widgCount);
    return widget; 
    } 
 
private void RepopulateWidgetView(int Id) {
	//places one widget based on the manager ID we are passing 
	//we use this to put in a previously chosen widget. it will be done in onCreate 
	//this allows us to just iterate this passing each ID in order 
	 
5
CodeRank
This code example shows how to use the following methods:setId, setLayoutParams, setPadding
    } 
    //adding to same row just be on the right of previous widget and bottom edge aligned to it's bottom edge 
      
     
     
    widget.setLayoutParams(params); 
    //if (!shouldFill) widget.setPadding(0, 0, 0, 0); else 
    widget.setPadding(0, 0, 0, 0);
      
     
     
    widget.setId(100+widgCount);
    return widget; 
    } 
 
private void RepopulateWidgetView(int Id) {
	//places one widget based on the manager ID we are passing 
	//we use this to put in a previously chosen widget. it will be done in onCreate 
	//this allows us to just iterate this passing each ID in order 
	 
5
CodeRank
This code example shows how to use the following methods:setId, setLayoutParams, setPadding
      } 
      //adding to same row just be on the right of previous widget and bottom edge aligned to it's bottom edge 
        
       
       
      widget.setLayoutParams(params); 
      //if (!shouldFill) widget.setPadding(0, 0, 0, 0); else 
      widget.setPadding(0, 0, 0, 0);
        
       
       
      widget.setId(100+widgCount);
      return widget; 
      } 
 
  private void RepopulateWidgetView(int Id) {
  	//places one widget based on the manager ID we are passing 
  	//we use this to put in a previously chosen widget. it will be done in onCreate 
  	//this allows us to just iterate this passing each ID in order 
  	 
4
CodeRank
This code example shows how to use the following methods:onTouchEvent
			updateMinizone(); 
			mov=true;
		} 
	} 
	public void setWidgetTouch(MotionEvent ev){
		if(wv!=null)wv.onTouchEvent(ev);
	} 
	public void setEnabled(boolean e){
		enabled=e;
	} 
	public void setClicked(boolean cl){
		if(enabled){
			clicked=cl;
//			txt.setUnderlineText(cl); 
			if(icp!=null&&txt!=null){
		    	if(cl){
		    		icp.setAlpha(128);
		    		txt.setAlpha(128);
		    	}else{ 
		    		icp.setAlpha(255);
4
CodeRank
This code example shows how to use the following methods:removeAllViews
    void unbind() { 
    	Log.d("LauncherAppWidgetInfo","unbind");
        super.unbind();         
        if(null != hostView){
        	try{ 
        		hostView.removeAllViews();        
        		hostView = null;
        	}catch(Exception ex){
        		Log.d("LauncherAppWidgetInfo","LauncherAppWidgetInfo unbind=========");
        	} 
        } 
         
        Log.d("LauncherAppWidgetInfo", "unbind="+appWidgetId);
    } 
} 
4
CodeRank
This code example shows how to use the following methods:removeAllViews
    void unbind() { 
    	Log.d("LauncherAppWidgetInfo","unbind");
        super.unbind();         
        if(null != hostView){
        	try{ 
        		hostView.removeAllViews();        
        		hostView = null;
        	}catch(Exception ex){
        		Log.d("LauncherAppWidgetInfo","LauncherAppWidgetInfo unbind=========");
        	} 
        } 
         
        Log.d("LauncherAppWidgetInfo", "unbind="+appWidgetId);
    } 
} 
4
CodeRank
This code example shows how to use the following methods:removeAllViews
    void unbind() { 
    	Log.d("LauncherAppWidgetInfo","unbind");
        super.unbind();         
        if(null != hostView){
        	try{ 
        		hostView.removeAllViews();        
        		hostView = null;
        	}catch(Exception ex){
        		Log.d("LauncherAppWidgetInfo","LauncherAppWidgetInfo unbind=========");
        	} 
        } 
         
        Log.d("LauncherAppWidgetInfo", "unbind="+appWidgetId);
    } 
} 
4
CodeRank

Related Android AppWidgetHostView Questions & Answers:

See Code Examples for Android AppWidgetHostView Methods: