the code:
Using java Syntax Highlighting
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- final GridView gridview = (GridView) findViewById(R.id.gridview);
- try
- {
- gridview.setAdapter(new ImageAdapter(this));
- gridview.setOnItemClickListener(new OnItemClickListener()
- {
- @Override
- public void onItemClick(AdapterView parent,View v,int pos,long id){
- Intent intent = new Intent(HelloGridView.this, ViewOneImage.class);
- //Uri u = Uri.parse(gridview.getSelectedItemId() + "");
- //i.setData(u);
- HelloGridView.this.startActivityForResult(intent, REQUEST_TYPE_A);
- finish();
- }
- });
- }
- catch(Exception ex)
- {
- Log.i("err", ex.getMessage());
- }
- }
Parsed in 0.034 seconds, using GeSHi 1.0.8.4
the code of the new activity which I want to show the picture.
Using java Syntax Highlighting
- public class ViewOneImage extends Activity{
- LinearLayout mLinearLayout;
- private Intent _intent;
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- setTitle(R.string.View_image); // I just doubt if the code cause the error, so I replaced them to this. but it doesn't work!
- }
- }
Parsed in 0.033 seconds, using GeSHi 1.0.8.4
thanks for your answer!


