S
syntax Terror
Neues Mitglied
- 0
Soll mir fürs erste die CID der SD Card liefern ,
zuerst wird der CPU Typ bestimmt und dementsprechend dann die Abfrage gestartet
funktioniert einzeln auch schon aber alles zusammen da Bekomme ich nur einen Programmabsturz
Kann mir bette jemand bei meinen Vorhaben helfen ich habe arge Probleme mit den Java Klasssen
Optimieren lässt sich das ganze sicher auch noch
(der Code ist sonst eig besser Formatiert)
Abfrage
SdCard.java
SysUtils.java
zuerst wird der CPU Typ bestimmt und dementsprechend dann die Abfrage gestartet
funktioniert einzeln auch schon aber alles zusammen da Bekomme ich nur einen Programmabsturz
Kann mir bette jemand bei meinen Vorhaben helfen ich habe arge Probleme mit den Java Klasssen
Optimieren lässt sich das ganze sicher auch noch
(der Code ist sonst eig besser Formatiert)
Abfrage
Code:
class Main extends Activity {
// private SysUtils Syst;
private SdCard Sd;
@Override
publicvoid onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Syst = new SysUtils();
Sd = new SdCard();
findViewById(R.id.btnToast).setOnClickListener(new Button.OnClickListener(){
public void onClick(View v) {
try
{
Toast.makeText(getApplicationContext(),"SID of MMC = " + Sd.ReadsdCID(), Toast.LENGTH_LONG).show();
}
catch(IOException e)
{// TODO Auto-generated catch block
e.printStackTrace();
}
} }
);
}
}
SdCard.java
Code:
class SdCard {
private SysUtils Syst;
String Omap = ("/sys/devices/platform/mmci-omap-hs.0/mmc_host/mmc0/mmc0:aaaa/cid");
String MSM = ("/sys/devices/platform/msm_sdcc.1/mmc_host/mmc0/mmc0:****/cid");
public String ReadsdCID() throws IOException {
String sd_cid = "";
if (Syst.ifQualComm())
{
try
{
BufferedReader input = new BufferedReader(new FileReader(MSM));
sd_cid = input.readLine();}
catch (FileNotFoundException e)
{
// Toast.makeText(Con,e.getLocalizedMessage(), Toast.LENGTH_LONG).show();
}
}
if (Syst.ifOmap())
{
try
{
BufferedReader input = new BufferedReader(new FileReader(Omap));
sd_cid = input.readLine();}
catch (FileNotFoundException e)
{
// Toast.makeText(Con,e.getLocalizedMessage(), Toast.LENGTH_LONG).show();
}
}
return sd_cid;
}
}
SysUtils.java
Code:
[B][COLOR=#7f0055]public[/COLOR][/B][SIZE=2] Boolean ifQualComm() {[/SIZE]
[SIZE=2] File theDir = [/SIZE][B][SIZE=2][SIZE=2]new[/SIZE][/SIZE][/B][SIZE=2] File([/SIZE][SIZE=2][SIZE=2]"/sys/devices/platform/msm_sdcc.1"[/SIZE][/SIZE][SIZE=2]);[/SIZE]
[SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055][COLOR=#000000] [/COLOR][B]if[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (theDir.exists())[/SIZE]
[SIZE=2] {[/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055] return[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]true[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]; [/SIZE]
[SIZE=2] } [/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]return[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]false[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2];[/SIZE]
[SIZE=2] }[/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] Boolean ifOmap() {[/SIZE]
[SIZE=2] File theDir = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] File([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"/sys/devices/platform/mmci-omap-hs.0"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);[/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]if[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] (theDir.exists()){[/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]return[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]true[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]; [/SIZE]
[SIZE=2]} [/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]return[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]false[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2];[/SIZE]
[SIZE=2] }[/SIZE]
[SIZE=2]}[/SIZE]