Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: java TextView Color
    primarykey
    data
    text
    <p>I need a little help. I need change the color of a text view with java code.. I tried different way but it always gives me an error:</p> <pre><code>java.lang.NullPointerException </code></pre> <p>I tried:</p> <pre><code>TextView sts; sts = (TextView) findViewById(R.id.stato); sts.setTextColor(Color.rgb(12,255,0)); </code></pre> <p>or..</p> <pre><code>sts.setTextColor(android.graphics.Color.GREEN); </code></pre> <p>but both ways give me the same error on start.. My Class extends ListActivity</p> <p>how do I? thanks in advance</p> <p>FULL CODE:</p> <pre><code>public class ProvaDatabase extends ListActivity{ TextView sts; private DatabaseHelper databaseHelper; @Override public void onCreate(Bundle savedInstanceState) { sts = (TextView) findViewById(R.id.stato); sts.setTextColor(android.graphics.Color.GREEN); //sts.setTextColor(Color.rgb(12,255,0)); super.onCreate(savedInstanceState); databaseHelper = new DatabaseHelper(this); SQLiteDatabase db = databaseHelper.getWritableDatabase(); databaseHelper.insertdb(db, "sta", "25/11/2016", "SUCCESS", null, null, null); databaseHelper.insertdb(db, "ssis", "25/11/2016", "WAITING", null, null, null); databaseHelper.insertdb(db, "AAAAAAAA", "25/11/2016", "FAILED", null, null, null); databaseHelper.insertdb(db, "BBBB", "bBBBBBB", "SUCCESS", null, null, null); Cursor c = databaseHelper.getDB(); startManagingCursor(c); setListAdapter(new SimpleCursorAdapter(this, R.layout.registryvista, c, new String[] { TabellaRegistry.TYPE, TabellaRegistry.DATE, TabellaRegistry.STATUS }, new int[] { R.id.tipo, R.id.data, R.id.stato })); setContentView(R.layout.main2); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload