text
stringlengths 0
1.05M
|
---|
HTC's Vive Pro headset is available to pre-order for $799 |
We've seen plenty of Beats-focused KIRFs in our time, some better than others. Few, however, play quite so directly on the name as OrigAudio's Beets. For $25, adopters get a set of headphones that bear little direct resemblance to Dr. Dre's audio gear of choice, but are no doubt bound to impress friends -- at least, up until they see a root vegetable logo instead of a lower-case B. Thankfully, there's more to it than just amusing and confusing peers. Every purchase will lead to a donation of canned beets (what else?) to the Second Harvest Food Bank of Orange County. For us, that's reason enough to hope that Beats doesn't put the kibosh on OrigAudio's effort. Besides, we could use some accompaniment for our BeetBox. |
Q: |
NullPointerException in getview of custom adapter |
I'm getting image from bitmap method and trying to populate the listview. But when i call the bitmap function inside getview the nullpointerException error occurs. please help me... |
here is my view Activity class: |
public class Viewactivity extends Activity{ |
TextView tv; |
ImageView im; |
@Override |
protected void onCreate(Bundle savedInstanceState) { |
super.onCreate(savedInstanceState); |
setContentView(R.layout.views); |
ListView mListView = (ListView)findViewById(R.id.listView); |
//array houlds all images |
int Images[] = new int[]{ |
R.drawable.confidential, |
... |
}; |
//array holds all strings to be drawn in the image |
CustomList adaptor = new CustomList(this , Images); |
mListView.setAdapter(adaptor); |
} |
public Bitmap ProcessingBitmap(int image) { |
// TODO Auto-generated method stub |
Bitmap bm1 = null; |
Bitmap newBitmap = null; |
final String data =getIntent().getExtras().getString("keys"); |
bm1 = ((BitmapDrawable) Viewactivity.this.getResources() |
.getDrawable(image)).getBitmap(); |
Config config = bm1.getConfig(); |
if(config == null){ |
config = Bitmap.Config.ARGB_8888; |
} |
newBitmap = Bitmap.createBitmap(bm1.getWidth(), bm1.getHeight(),config); |
Canvas newCanvas = new Canvas(newBitmap); |
newCanvas.drawBitmap(bm1, 0, 0, null); |
if(data != null){ |
Paint paintText = new Paint(Paint.ANTI_ALIAS_FLAG); |
paintText.setColor(Color.RED); |
paintText.setTextSize(300); |
// paintText.setTextAlign(Align.CENTER); |
paintText.setStyle(Style.FILL); |
paintText.setShadowLayer(10f, 10f, 10f, Color.BLACK); |
Rect rectText = new Rect(); |
paintText.getTextBounds(data, 0, data.length(), rectText); |
paintText.setTextScaleX(1.f); |
newCanvas.drawText(data, |
0, rectText.height(), paintText); |
Toast.makeText(getApplicationContext(), |
"drawText: " + data, Toast.LENGTH_LONG).show(); |
}else{ |
Toast.makeText(getApplicationContext(), |
"caption empty!", Toast.LENGTH_LONG).show(); |
} |
return newBitmap; |
} |
} |
this is my adapter class: |
public class CustomList extends BaseAdapter{ |
Viewactivity act; |
int[] IMAGES; |
LayoutInflater inflator; |
Context sContext; |
//private String[] TEXTS; |
public CustomList(Context context, int[] images){ |
this.IMAGES = images; |
//this.TEXTS = texts; |
this.sContext = context; |
inflator = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); |
} |
@Override |
public int getCount() { |
// TODO Auto-generated method stub |
return IMAGES.length; |
} |
@Override |
End of preview. Expand
in Dataset Viewer.
No dataset card yet
- Downloads last month
- 2