i face problem cannot access directory variable main method in eclipse. here snippet of code:
public class mainscreen extends activity { public void main(string [] args) { button import = (button)findviewbyid(r.id.importcontactbutton); uri sdlocation = uri.parse(environment.getexternalstoragedirectory().getabsolutepath()); string path = "/scanner/data/"; file directory = new file(sdlocation + path); } protected void cameraactivity() { uri outputfileuri = uri.fromfile(directory); intent intent = new intent(android.provider.mediastore.action_image_capture ); intent.putextra( mediastore.extra_output, outputfileuri ); startactivityforresult( intent, 0 ); } } i'm not sure wether because i'm using wrong access modifiers on classes, or right access control modifiers on classes. tried many methods access variable none working, doing wrong??? appreciated.
thank :)
you out of scope, directory valid until end of method 'main'. should make class variable.
also, main method on android project pretty useless (unless test purposes). code not run application, , can run on console java application.
Comments
Post a Comment