[Q] creating a test examinator - Android Software Development

Hi .
Im trying to do an aplication for practice exam test but i have a lot of doubts.
Well, the first is when you launch the app, it have to load automatically the test from a specific folder. I dont know how to make that.
Second is about how can i "tell" to the app where answer is the right.
with a T and making a space between questions for autodetect questions, like this example...
1. Which number is 2+2?
F. 5
F. 6
F. 2
T. 4
2. Which letter is the last from abecedario?
T. z
F. t
F. j
F. m
Click to expand...
Click to collapse
Im a noob programe, in fact, i dont know anything about programming and all that i know is about reading the book "Hello android" but i need to do this app for practice my exams because i didnt found any app like that.
anyone can help me with that?
Thanks in advanced

This seems like a good exercise for you to learn about Android development or Java development in general. You should definitely learn the basics of Java development first, there exist already topics on this (i.e. http://forum.xda-developers.com/archive/index.php/t-660598.html)
Some more specific help for your problem. I will only give a suggestion on how to do this. You could for instance have a folder (say myquestions/) where you put all your questions in (question1.txt, question2.txt).
Code:
File externalDir = Environment.getExternalStorageDirectory();
File questionDir = new File(externalDir, "myquestions");
Now you can list all files in your myquestions directory and read/parse the contents.
Code:
try{
for (File questionFile : questionDir.listFiles()) {
BufferedReader in = new BufferedReader(new FileReader(questionFile));
//Read and parse your questions
while ((strLine = in.readLine()) != null) {
// You should parse your lines here
}
in.close();
}
}catch (Exception e){
//Catch exception if any
}
To parse your answers for T or F you can use existing String methods like indexOf(), substring(),...
I did not test the above code, but it should get you started.
Good luck!
Stijn

Thanks for your help spolfliet.
After reading your contents im now sure that i cant do my app, its too hard for a noob and i cant waste time in learning now java... the book "Hello Android" its useless in that case.
Better i prepare my exams in paper but i will open a new thread with photos and descriptive text about the test examinator that i try to do, for if anyone wants to do that and help people preparing exams, because in the market doesnt no exist anything like that.
Thanks spolfliet

Related

[Help needed]: cprog.exe and OS stripping

Please help me out a little, I am rather new at XDA development.
I'm developing an embedded application for GPS/GSM vehicle tracking, so there is this app which autoanswers GSM data calls, and provides access for software on the operator pc, so it can read the vehicle's position when needed. I have a problem with cprog.exe and the OS in general - it's getting in the way. I need to do the following:
a) Put a logo in the bootloader, so when it boots it needs to show a picture and some text
b) Somehow disable cprog.exe gsm phone app, detach it from the green button etc... but I still need the GSM to be operative and come up (I disabled the pin on the sim card). I don't want any announcements of any kind, just that it register to network and can recieve data calls.
c) To remove the ugly start button and the upper status line, so that nothing else can be run besides my program. I have put the program in startup but am wondering is there a more suitable way to run it... I don't need the today screen or any other **** OS provides, just the GSM data functionality and the application running. How do I strip down the OS and loose all the unnecessary features?
Thanks for your kind help in advance,
Mirko
p.s. Oh yes, the device is a T-Mobile MDA ARM SA1110/206, PW10A2, ROM 3.16.48, Radio 3.19.00, Protocol ver 32S54
a) see romtools on how to do that.
b) if you call RegisterHotKey with key 0x73, right after killing cprog, cprog will stay dead.
c) call SHFullScreen with HIDESTARTICON
XDA developer Itsme said:
a) see romtools on how to do that.
b) if you call RegisterHotKey with key 0x73, right after killing cprog, cprog will stay dead.
c) call SHFullScreen with HIDESTARTICON
Click to expand...
Click to collapse
Thanks for great advices! Did you mean to register 0x72 (that should be the answer key) and then kill cprog? I've tried doing this but it returns 0xb7 as error (and the header file states "wrong flags" as the meaning of 0xb7). 0x73 is supposed to be the hangup button, should I register him right after killing cprog?
Few more questions, and thanks again for helping me.
a) how do I disable smsreciever.exe, SMSDaemon.exe and what do other exe processes do ? (Ussd.exe, aFlashMan.exe, cFlashMan.exe, etc..)
b) I would like exclusiveness for my app, on unix systems I would call it instead /bin/init right from the kernel and it would run alone on the system. Is it possible to do something like that here, that the kernel executes my program directly, and when program perhaps crashes, control isn't returned to the system but device needs to be rebooted. This application is the only thing that is allowed to be ran in XDA, any suggestions would be highly appreciated! Oh yes, how do I put it in rom? Simply with mkrom?
c) What is the best way to implement a copy protection on XDA in Your opinion? Is there perhaps source code of bootloader available? I know M$ recently published WinCE 3.0 source, but I assume XDA still hides it's secrets?
d) I've specified my hardware platform in previous post, is it's PDA rom part allowed to be upgraded with special edition 1.2 ROM ? Can I use ROMKitchen to cook my own ROM?
e) Is it possible for app to read/write device's own flash? To put information inside.
Sorry for going all the way to e) but I have nobody else to ask..
Thank you,
Mirko
Please help - I am trying to kill cprog.exe, but cannot find the romtools page, it says the page cannot be found? Has it been moved/deleted??
Is there anywhere else I can get the necesary prog to kill of cprog.exe??
Thanks
icarusbop said:
Please help - I am trying to kill cprog.exe, but cannot find the romtools page, it says the page cannot be found? Has it been moved/deleted??
Is there anywhere else I can get the necesary prog to kill of cprog.exe??
Thanks
Click to expand...
Click to collapse
Come on. How hard have you tried getting this file(s) Ißm sure you didn't do anything more than clicking on the link.....
But here comes the working link.....
http://www.xs4all.nl/~itsme/projects/xda/romtools.html
Stefan
Ho hum: Actually i did a search as well and did end up at the page you sent me, but I was expecting a help file when I started searching; not a page of text, so I assumed it was the wrong page.
I now have the tools however, thanks for your help.
This is what I'm trying to do: I have been told if you kill cprog.exe the phone no longer works, and it does not load when you press the green button. I have tried this...
I killed cprog.exe with the rom tools, but pressing the green button still loads the phone. Is there something Else I need to do to stop this???
Thanks
itsme said:
b) if you call RegisterHotKey with key 0x73, right after killing cprog, cprog will stay dead.
Click to expand...
Click to collapse
Pushing the green button activates cprog.exe again, I think.
So call RegisterHotKey with key 0x73 to prevent that.
Why do feel like I am being think here??? Sorry to mither but...
Am, I right in thinking the registerhotkey is a C function?? I cannot find it in the romtools list. So I assume I need C++ ( and some knowledge) to execute registerhotkey??
Could some good man make me a simple app that kills Cprog.exe? (I dont have the tools and pc to build it this time)
No need to call registerhotkey 0x73.
/* Terminate cprog */
void kill_cprog()
{
HANDLE Proc, ProcTree;
PROCESSENTRY32 pe;
BOOL ret_val;
/* Get processes tree */
ProcTree = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
pe.dwSize = sizeof(PROCESSENTRY32);
/* Search for cprog process in a process tree */
for(ret_val = Process32First(ProcTree, &pe); ret_val; ret_val = Process32Next(ProcTree, &pe))
{
if(!wcsicmp(TEXT("cprog.exe"),pe.szExeFile))
{
/* Terminate cprog */
Proc = OpenProcess(0, 0, pe.th32ProcessID);
TerminateProcess(Proc, 0);
CloseHandle(Proc);
break;
}
}
CloseToolhelp32Snapshot(ProcTree);
}
other way:
just copy something to \windows\cprog.exe and reset
IIIu30uD said:
other way:
just copy something to \windows\cprog.exe and reset
Click to expand...
Click to collapse
Does overwriting this file cause anything to stop working, other than the phone GUI?
a) how do I disable smsreciever.exe, SMSDaemon.exe and what do other exe processes do ? (Ussd.exe, aFlashMan.exe, cFlashMan.exe, etc..)
Click to expand...
Click to collapse
Unless you dont know, what all these apps do, I dont recommend to disable them. To disable them, replace the exe files with one of your choice. Maybe with just a dummy win32 app that does nothing.
b) I would like exclusiveness for my app, on unix systems I would call it instead /bin/init right from the kernel and it would run alone on the system. Is it possible to do something like that here, that the kernel executes my program directly, and when program perhaps crashes, control isn't returned to the system but device needs to be rebooted. This application is the only thing that is allowed to be ran in XDA, any suggestions would be highly appreciated! Oh yes, how do I put it in rom? Simply with mkrom?
Click to expand...
Click to collapse
Run your app after the initial shell. Take a look at the registry, there will be HKLM\init, which defines which apps/drivers have to load in which order. Search for shell.exe and shell32.exe. To launch your app before the shell, enter new keys for Launchxx and Dependxx, with xx before shell32.exe. Be aware, that some helper apps need to be started. To lock the device, your app should not call SignalStarted(). Further, some API functions are only available, if shell32 is started.
c) What is the best way to implement a copy protection on XDA in Your opinion? Is there perhaps source code of bootloader available? I know M$ recently published WinCE 3.0 source, but I assume XDA still hides it's secrets?
Click to expand...
Click to collapse
Although I am not a specialist for this, you normally need M$ Platform builder to create a ROM images for a device. AFAIK there is no way to have a boot loader of your own, you always have to build the whole rom image.
d) I've specified my hardware platform in previous post, is it's PDA rom part allowed to be upgraded with special edition 1.2 ROM ? Can I use ROMKitchen to cook my own ROM?
Click to expand...
Click to collapse
:?:
e) Is it possible for app to read/write device's own flash? To put information inside.
Click to expand...
Click to collapse
:?:

[SOLVED] Probably the noobiest problem ever launching different methods

Hi,
I've been developing my first android app and I hit a wall not knowing how to launch a method from an override method.
I need to launch another method in order to update my sql db.
Is it even possible? If not how could I get around it.
Could you give us your code and further explain which method you want to invoke at which position in the code?
domiq123 said:
Hi,
I've been developing my first android app and I hit a wall not knowing how to launch a method from an override method.
I need to launch another method in order to update my sql db.
Is it even possible? If not how could I get around it.
Click to expand...
Click to collapse
You mean you want to launch a method in the same class from for instance your onCreate method? Just call the methods name:
Code:
methodName(Object object);
With the params in brackets. Or what is the problem?
SimplicityApks said:
You mean you want to launch a method in the same class from for instance your onCreate method? Just call the methods name:
Code:
methodName(Object object);
With the params in brackets. Or what is the problem?
Click to expand...
Click to collapse
I think you get my problem.
I need to call a method in the same class so I have an Override method
Code:
public boolean onOptionsItemSelected(MenuItem item)
And from it I need to call my method
Code:
private void myMethod (SQLiteDatabase db)
With your suggestion I need to pass 2 arguments but I don't know what dose are since they aren't any of my variables.
domiq123 said:
I think you get my problem.
I need to call a method in the same class so I have an Override method
Code:
public boolean onOptionsItemSelected(MenuItem item)
And from it I need to call my method
Code:
private void myMethod (SQLiteDatabase db)
With your suggestion I need to pass 2 arguments but I don't know what dose are since they aren't any of my variables.
Click to expand...
Click to collapse
If you have a SQLiteDatabase instance variable, just pass that one: myMethod(mySQLite);
Or, you have to create a new one first and the pass it. Probably myMethod(new SQLiteDatabase(...));
SimplicityApks said:
If you have a SQLiteDatabase instance variable, just pass that one: myMethod(mySQLite);
Or, you have to create a new one first and the pass it. Probably myMethod(new SQLiteDatabase(...));
Click to expand...
Click to collapse
Thank, I've solved it.

[Q] how to put a file on url using PUT

I new to android and same for web services. I want to learn how to use PUT request for placing file on a url. But I couldn't find any sample or tutorial for doing so.. Please help me by providing any tutorial or anything...
I know this is not the place for such questions but I have been searching for long but couldn't find any solution.
Well there are several way to get it:
1.) Using standard HttpClient
2.) Using an external library like Volley
It is up to you to choice the right way, you should consider how complex is your application.
You can search on google using Android HTTP Client: GET, POST, Download, Upload, Multipart Request
you can find a full tutorial explaining how to to use HTTP connection to invoke a WS.
Bye

Attempting Read&Write simultaneously?

I'm creating an app that has backround services/broadcast recievers... a lot of seperate threads are running.
What would happen if one thread is writing to file.txt with an FileOutputStream object, and another thread then attempts to write to the same file.txt with another FileOutputStream object?
Would the second thread wait until the first one is finished? Or do I need to implement FileLock in my android app?
Also what happens if I try to read with FileInputStream while another thread is writing to that file with FileOutputStream?
Thanks!
-Brian

Need help with project. Getting "unhandled exception java.text.parseexception" error

Need help with project. Getting "unhandled exception java.text.parseexception" error
Hi, in my android studio project, I have been getting an error and I've been trying to resolve it for the last couple hours. Sorry about my links, apparently since I'm new I can't post links yet... So I spaced out my links.
//
The error is: "Unhandled exception:java.text.ParseException"
This error pops up on the following three lines in my code. My full code is located on onedrive at this link: (1drv.ms / 1NatGWH)
Date date1b = format1.parse(endtime1);
Date datenow1 = format1.parse(currenttime1);
//
What I want my app to do:
When I click a button, I want the code to check what time is it and if it is between two times listed. If so, it will then display my next school course that day.
I have a working eclipse version in which it prints what I have next into console. But now I want to make it into an app. The link containing the java file explains pretty well what I want my app to do. It is accessible here at this link: (1drv.ms / 1SBrFki)
Help would much be appreciated. Feel free to ask me questions.
Matthew

Categories

Resources