Android : How to save my screen as html for sharing

on Monday, July 7, 2014


I have an app that uses fragments.


Programmatically I fetch the DB and get some results. Then I format the results and add them programmatically to my layout.


At the end I have a report on screen with a couple of LinearLayout, ScrollView, TextView, CheckBox, and like. No images are added to the layout.


I need to be able to share my report as html. I do not want to take a screenshot of the screen and then share it becouse I have ScrollViews and therefore some data maybe absent from the current screen.


Part of the code that build my report



TextView textViewNomeJogador = new TextView(context);
textViewNomeJogador.setLayoutParams(params);
textViewNomeJogador.setTextAppearance(context, android.R.style.TextAppearance_Medium);
textViewNomeJogador.setText(obj.nome_jogador);
textViewNomeJogador.setTag(Integer.toString(id));


CheckBox cbIsVip = new CheckBox(context);
cbIsVip.setLayoutParams(params);
cbIsVip.setChecked(obj.is_vip);
cbIsVip.setText("Vip");
cbIsVip.setTag(Integer.toString(id));


CheckBox cbIsPlaying = new CheckBox(context);
cbIsPlaying.setLayoutParams(params);
cbIsPlaying.setChecked(obj.is_playing);
cbIsPlaying.setText("Presente");
cbIsPlaying.setTag(Integer.toString(id));



LinearLayout linearLayoutAtributosJogador = new LinearLayout(context);
linearLayoutAtributosJogador.setLayoutParams(params);
linearLayoutAtributosJogador.addView(textViewNomeJogador);
linearLayoutAtributosJogador.addView(cbIsVip);
linearLayoutAtributosJogador.addView(cbIsPlaying);



linearLayoutJogadores.addView(linearLayoutAtributosJogador);


And yhis is how it look like after completion:


http://i.stack.imgur.com/QKp4d.png


So, my question is: How do I convert and save a screen like that into html so I can share it, for example by e-mail?


Thanks!


0 comments:

Post a Comment