App Widget issue while showing list of images

前端 未结 1 1667
梦毁少年i
梦毁少年i 2021-01-27 00:44

I go through the following android documentation: "App Widgets with Collections" to create a widget that shows a list of text. Everything works fine and it works just

相关标签:
1条回答
  • 2021-01-27 00:51

    I am used this way and work well.

    Change textview to imageview in row.xml

    public WidgetDisplay(Context ctxt, Intent intent) 
        {
            this.ctxt=ctxt;
            appWidgetId=intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,
                    AppWidgetManager.INVALID_APPWIDGET_ID);
                    setImageinView(this.ctxt);
        }
    
    private void setImageinView(Context context) {
    //read sd card and store bitmap in  arrayListBitmap;
    }
    
    @Override
    public RemoteViews getViewAt(int position) {
    remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.row);
        remoteView.setImageViewBitmap(R.id.image_photo1,arrayListBitmap.get(i));
    }
    

    simple you have to read sd card store data in to arraylist.

    set size to getCount().

    now set image in your imageview.

    If any query then welcome.

    0 讨论(0)
提交回复
热议问题