The line: EditText totalbox = (EditText) findViewById(R.id. Totalbox) Is not in the OnCreate method, so its trying to initialize the totalbox before the activity is created, probably causing the crash Try this instead: package com.mhe.test. Scan; import android.app.
Activity; import android.content. Intent; import android.os. Bundle; import android.view.
View; import android.widget. Button; import android.widget. EditText; public class main extends Activity { /** Called when the activity is first created.
*/ @Override public void onCreate(Bundle savedInstanceState) { super. OnCreate(savedInstanceState); setContentView(R.layout. Main); Button myScanButton = (Button) findViewById(R.id.
MyScanButton); // set the totalbox in the onCreate totalbox = (EditText) findViewById(R.id. Totalbox); myScanButton. SetOnClickListener(new Button.OnClickListener() { public void onClick(View v) { Intent intent = new Intent("com.google.zxing.client.android.
SCAN"); intent. PutExtra("SCAN_MODE", "PRODUCT_MODE"); startActivityForResult(intent, 0); } }); } public void onActivityResult(int requestCode, int resultCode, Intent intent) { if (requestCode == 0) { if (resultCode == RESULT_OK) { String contents = intent. GetStringExtra("SCAN_RESULT"); // Handle successful scan // check that it exists, just in case if ( totalbox!
= null ) totalbox. SetText(contents); } else if (resultCode == RESULT_CANCELED) { // Handle cancel // check that it exists, just in case if ( totalbox! = null ) totalbox.
SetText("@string/bummer"); } } } private EditText totalbox; }.
The line: EditText totalbox = (EditText) findViewById(R.id. Totalbox); Is not in the OnCreate method, so its trying to initialize the totalbox before the activity is created, probably causing the crash Try this instead: package com.mhe.test. Scan; import android.app.
Activity; import android.content. Intent; import android.os. Bundle; import android.view.
View; import android.widget. Button; import android.widget. EditText; public class main extends Activity { /** Called when the activity is first created.
*/ @Override public void onCreate(Bundle savedInstanceState) { super. OnCreate(savedInstanceState); setContentView(R.layout. Main); Button myScanButton = (Button) findViewById(R.id.
MyScanButton); // set the totalbox in the onCreate totalbox = (EditText) findViewById(R.id. Totalbox); myScanButton. SetOnClickListener(new Button.OnClickListener() { public void onClick(View v) { Intent intent = new Intent("com.google.zxing.client.android.
SCAN"); intent. PutExtra("SCAN_MODE", "PRODUCT_MODE"); startActivityForResult(intent, 0); } }); } public void onActivityResult(int requestCode, int resultCode, Intent intent) { if (requestCode == 0) { if (resultCode == RESULT_OK) { String contents = intent. GetStringExtra("SCAN_RESULT"); // Handle successful scan // check that it exists, just in case if ( totalbox!
= null ) totalbox. SetText(contents); } else if (resultCode == RESULT_CANCELED) { // Handle cancel // check that it exists, just in case if ( totalbox! = null ) totalbox.
SetText("@string/bummer"); } } } private EditText totalbox; }.
A question. Bare with me Im fairly new at all this android coding so I might be leading you down a rabbit hole. Are you testing on a phone with zxing on it?
I don't know if it will cause the program to force close if it is not there already before button push.
Rasmus, yes phone has zXing. Valid question I think :) – sgardeski Jun 30 '10 at 15:23.
Tips:Hold the Alt key down while pressing Print Screen to capture only the active window. Generally the GIF format works best when saving screen shots of application windows. The JPEG format usually makes screen shots (especially those with text) blurry, blotchy and discolored.
See related resources below for more screen shot tips and listings of screen capture software that offers many more options for capturing screens and portions of screens on Windows and Macintosh computers. The Windows "clipboard" is a term used to describe the temporary storage space in memory where an item is placed when you copy or cut. When you paste, the item is transferred to the program you're working in.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.