java - Calling class on ButtonClick (Android) -


i new android developer. have 2 different class (mainactivity.java & upload.java)
have problem call upload.java main.activity.
when click button, app crashing.
there have done wrong?

mainactivity.java

button upload = (button)findviewbyid(r.id.upload_btn);    upload.setonclicklistener(new view.onclicklistener()  {      @override      public void onclick(view v)       {          update_table dbclient = new  update_table();            try {              dbclient.dynamodbclient();          } catch (ioexception e) {              // todo auto-generated catch block              log.i("sys", "success");          }      }  }

upload.java

public class update_table  {      private string tablename = "test";      private amazondynamodbclient client =null;  	      public void dynamodbclient() throws ioexception      {          awscredentials cred = new propertiescredentials(update_table.class  				.getresourceasstream("awscredentials.properties"));  		          client = new amazondynamodbclient(cred);      }  }

logcat: logcat

change line in method below:-

 public class update_table     {         private string tablename = "test";         private amazondynamodbclient client =null;          public void dynamodbclient() throws ioexception         {         //changed below line              awscredentials cred = new propertiescredentials(classloader.getresourceasstream("src/com.afdal.ftsmetheses/awscredentials.properties"));  //or try  awscredentials cred = new propertiescredentials(classloader.getresourceasstream("com.afdal.ftsmetheses/awscredentials.properties"));              client = new amazondynamodbclient(cred);          }       } 

Comments