我无法input存储在android studio资产文件夹中的excel文件中的数据

在下面的代码中,我试图从assets文件夹中读取一个xls文件,并尝试通过JXL API将数据input到该表中,但无法执行它。

import android.content.res.AssetManager; import android.net.Uri; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.EditText; import android.widget.Toast; import com.google.android.gms.appindexing.Action; import com.google.android.gms.appindexing.AppIndex; import com.google.android.gms.common.api.GoogleApiClient; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import jxl.Cell; import jxl.Sheet; import jxl.Workbook; import jxl.write.Label; public class Event extends AppCompatActivity { private GoogleApiClient client; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_event); // ATTENTION: This was auto-generated to implement the App Indexing API. // See https://g.co/AppIndexing/AndroidStudio for more information. client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build(); } public void saveevent(View view) throws Exception { AssetManager am=getAssets(); EditText evt = (EditText) findViewById(R.id.editText); EditText pth = (EditText) findViewById(R.id.editText2); try { String eventname = evt.getText().toString(); String eventpath = pth.getText().toString(); 

在这里我试图通过给它的path添加find文件。

  File f=new File("D:\\DPSRLIVE\\app\\src\\main\\assets\\events.xls"); InputStream os = new FileInputStream(f); Workbook ww= Workbook.getWorkbook(os); Sheet ws= ww.getSheet(0); /*Label l1= new Label(0,0,eventname); Label l2= new Label(0,1,eventpath);*/ Cell c= ws.getCell(0,0); c.equals(eventname); /* not able to insert data*/ ww.close(); } catch (NullPointerException n) { Toast.makeText(Event.this, "Sorry!! Invalid User name or Password", Toast.LENGTH_SHORT).show(); } } @Override public void onStart() { super.onStart(); // ATTENTION: This was auto-generated to implement the App Indexing API. // See https://g.co/AppIndexing/AndroidStudio for more information. client.connect(); Action viewAction = Action.newAction( Action.TYPE_VIEW, // TODO: choose an action type. "Event Page", // TODO: Define a title for the content shown. // TODO: If you have web page content that matches this app activity's content, // make sure this auto-generated web page URL is correct. // Otherwise, set the URL to null. Uri.parse("http://host/path"), // TODO: Make sure this auto-generated app URL is correct. Uri.parse("android-app://dpsranipur.dpsrlive/http/host/path") ); AppIndex.AppIndexApi.start(client, viewAction); } @Override public void onStop() { super.onStop(); // ATTENTION: This was auto-generated to implement the App Indexing API. // See https://g.co/AppIndexing/AndroidStudio for more information. Action viewAction = Action.newAction( Action.TYPE_VIEW, // TODO: choose an action type. "Event Page", // TODO: Define a title for the content shown. // TODO: If you have web page content that matches this app activity's content, // make sure this auto-generated web page URL is correct. // Otherwise, set the URL to null. Uri.parse("http://host/path"), // TODO: Make sure this auto-generated app URL is correct. Uri.parse("android-app://dpsranipur.dpsrlive/http/host/path") ); AppIndex.AppIndexApi.end(client, viewAction); client.disconnect(); } } 

任何想法如何解决这个问题?

谢谢!