all Im getting the error java.lang.outofmemoryerror BitmapFactory
error and I need some help on fixing it and this is the best option I have, i know that you can scale the images to stop them from using too much memory but not quite sure how to go about it with the code I have.
public class MainActivity extends Activity {
ListView list;
String[] web = {
//77 Images
} ;
Integer[] imageId = {
//77 Images
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
PositionList adapter = new
PositionList(MainActivity.this, web, imageId);
list=(ListView)findViewById(R.id.list);
list.setAdapter(adapter);
list.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
if(position == 0) {
//code specific to first list item
Intent myIntent = new Intent(view.getContext(), Position0.class);
startActivityForResult(myIntent, 0);
}
-------------------Repeats--------------------------
if(position == 77) {
//code specific to first list item
Intent myIntent = new Intent(view.getContext(), Position77.class);
startActivityForResult(myIntent, 0);
}
I tried using the examples from here but no luck implementing them - ImageAdapter and ListView (java.lang.OutOfMemoryError: bitmap size exceeds VM budget)
0 comments:
Post a Comment