android - TextView with a long text -


i trying make simple activity contains textview long text. have used scrollview same. gives nullpointerexception error.

here xml

<scrollview android:id="@+id/scroller_id" android:layout_width="fill_parent" android:layout_height="wrap_content" android:scrollbars="vertical" android:fillviewport="true">    <textview     android:id="@+id/textview1"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_centerhorizontal="true"     android:text="@string/about"     android:textappearance="?android:attr/textappearancelarge" />  </scrollview> 

here code:

public class extends activity {  private textview tv; @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_about);      tv.findviewbyid(r.id.textview1); }  } 

here @string/about:

vision 

india fourth largest energy consumer in world, yet, 83% of demand in crude oil met imports rather domestic production. inflation due prices of imported oil has put pressure on government engage in desperate search energy sources , security. have far been unable bridge gap between demand , supply in crucial sector. lynchpin of stability , growth achieve energy security 2030 lies reducing dependence on overseas energy, , india still far laudable , ambitious goal.

petrofiesta 2013 first – of – – kind petroleum oriented fest educational institute in country, organized society of petroleum engineers (spe) iit kharagpur chapter. fest aims annual platform veterans in oil & gas industry share knowledge , expertise academia , young minds across nations. initiative dedicated students of iit kharagpur aims @ exploring ideas smart technologies innovation across upstream, midstream , downstream sectors in oil , gas industry.

petrofiesta 2013 envisions tap knowledge pool of students premier institutions worldwide , develop insight in integrated manner explore areas of growth in exploration, drilling, production , processing, refining, pipeline, transportation, petrochemicals, economics, research , development, information technology , environment management. calls need increase domestic production through sustainability , development of smart technologies, unconventional sources, has lately been issue of interest energy stakeholders worldwide.

with events petrobotics, petroentrepreneur, petrodebate , industrial design problems , set of guest lectures, hope provide real time solutions real time problems faced in petroleum industry.

as rightly quoted un secretary general ban – ki – moon:

“we need stakeholders in sustainable future."

below line causing problem you

tv.findviewbyid(r.id.textview1);//here tv null 

change line

tv = (textview) findviewbyid(r.id.textview1); 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -