2012-05-14 4 views
2

Google Nexus .....에서 rdf 파일에 액세스하려고합니다. (이제이 코드는 디스크에서 rdf 파일에 액세스 할 수 있습니다.) .... Google Nexus does not는 sdcard 슬롯을 가지고 있습니다. ..... 그래서 .... 문제가 RDF 파일이 검색됩니다 곳에서 경로를 정의하기 위해 사전에Google Nexus에서 파일 읽기

public class andro extends Activity implements View.OnClickListener{ 
    /** Called when the activity is first created. */ 

Graph graph; 
Load ld; 
Mappings map; 
QueryProcess exec; 
ResultFormat f; 
RDFFormat f3; 

Button runbtn; 
Button clearbtn; 
Button test; 
Button triple; 
EditText et1; 
TextView tv1; 

@Override 
    public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.query); 


    clearbtn = (Button) findViewById(R.id.clear) ; 
    runbtn = (Button) findViewById(R.id.run); 
    test = (Button) findViewById(R.id.test); 
    triple = (Button) findViewById(R.id.rdf); 

    tv1 = (TextView) findViewById(R.id.output); 
    et1 = (EditText) findViewById(R.id.input); 


    clearbtn.setOnClickListener(new OnClickListener(){ 
     public void onClick(View v){ 
      et1.setText(""); 
      tv1.setText(""); 


     } 
    }); 
     test.setOnClickListener(new OnClickListener(){ 
    //runbtn.setOnClickListener(new OnClickListener(){ 
     public void onClick(View v){ 

/*  String op = et1.getText().toString(); 
     tv1.setText(op); 
*/ 
    // graph = Graph.create();  
    graph = Graph.create(true); 

     ld = Load.create(graph); 
     ld.load("/user/roy/home/DownLoad/foaf.rdf"); 
    // ld.load("dataset.rdf"); 
    /* 
     try { 
     ld.loadWE("dataset.rdf"); 
    } catch (LoadException e1) { 
     // TODO Auto-generated catch block 
     e1.printStackTrace(); 
    } 
    */ 
    // String query = null; 
    // Mappings map = null; 


    // String query1 = "select * where {?x ?p ?y}"; 

    exec = QueryProcess.create(graph); 
    query1 = et1.getText().toString(); 
     try { 
      map = exec.query(query1); 
      } catch (EngineException e) { 
      // TODO Auto-generated catch block 
      e.printStackTrace(); 
     } 
     // f = ResultFormat.create(map); 
     // f3 = TripleFormat.create(map); 
     String f2 = ld.toString(); 
     tv1.setText(ld); 
     //System.out.println(f2);   

     } 
     }); 

    } 

@Override 
public void onClick(View v) { 
    // TODO Auto-generated method stub 

} 
} 

감사합니다 .... 나던 넥서스 동안

+1

외부 저장소를 확인하는 API는 "외부"저장소 실제로 "내부"저장 장치와 동일한 플래시 장치를 가상적으로 할당하거나 납땜합니다. –

+0

@ChrisStratton ..... 더 설명해 드릴 수 있습니까? –

+0

http://developer.android.com/reference/android/os/Environment.html –

답변

1

을 데 제거 가능한 sd 카드는 기본적으로 여전히 내부 카드를 가지고 있습니다. 따라서 외부 저장소를 사용하면 SD 카드를 제거 할 수있는 평상시와 같이 처리 할 수 ​​있습니다.

String SD_CARD = Environment.getExternalStorageDirectory() + "/my/path";