[Q] Android Studio - Extract String Resource - Replace all occurrences? - Android Software Development

In Eclipse, when creating a new String resource, there was an option to replace all occurrences of the hardcoded string (throughout the project) with references to the new String resource. Is this option available in Android Studio?

Related

Copying files out of ROM

Does anyone have or know of a utility for copying files out of ROM on the PocketPC so that I can look at them on my desktop? I know that the Grundle File Explorer utility can do this but I don't want to have to buy a copy when I'll probably only ever do this once.
If not, does anyone know of a utility to do a symbol-dump on an in-ROM file on the PPC? I just want to see what the full list of functions in the ccoreutl.dll library is, and it's not documented anywhere that I can find.
thanks,
nick.
all grundle file explorer allows you to do is filter the directory listing
to only display rom-files.
Since the Files in ROM are speparated into parts (data sections, code sections, etc) they don't exist like on a normal file system. The splitting of the files is done for "XIP" (execute in place). Whenever you "launch" an executable or load a library only the "data sections" will be "copied" into RAM (each process will have it's own data section). The code sections will remain in ROM and executed there (so there is no RAM usage for ROM code).
If you wan't to copy files out of ROM you have to assemble the files back (first all code sections of all files are sotred in ROM and then all data sections will be stored compressed). Unfortunately there is no complete documentation of the ROM filesystem (it seems it's a kind of Object Store). So even you dump the ROM content (something like VirtualMem.... will do it) you will not be able to extract complete files.
UnKnOwN
here is microsoft's description of XIP
http://msdn.microsoft.com/library/d.../en-us/dncenet/html/systemmemorymgmtwince.asp
and this (winceemul41.exe )
http://www.microsoft.com/downloads/...b0-c2fe-4647-833a-8831c5fccd56&DisplayLang=en
contains most (if not all) of the source code to the wince.net kernel.
WINCE410\PUBLIC\COMMON\OAK\INC\romldr.h
contains definitions of all structures related to the rom-filesystem,
WINCE410\PRIVATE\WINCEOS\COREOS\NK\KERNEL
has files like 'loader.c' and 'resource.c' which show how the kernel
handles them.
...
I think these files should contain enough information to write a tool
to extract the files.
And I think the wince.Net code is quite similar to how it works
in wince.300 ( the interesting header files for
wince300 are not publicly available, but are in the
wince-platformbuilder)
tool in progress
XDA developer Itsme said:
I think these files should contain enough information to write a tool
to extract the files.
And I think the wince.Net code is quite similar to how it works
in wince.300 ( the interesting header files for
wince300 are not publicly available, but are in the
wince-platformbuilder)
Click to expand...
Click to collapse
Actually I'm working on such a tool. It is about 50% done. I can currently extract most sections per file of all files from a ROM image file. I'm not sure if it is possible to recreate executables and dll's such that they function normally. But it should be fine to create definition files for DLL's and such. Also for reverse engineering it should be fine. Current problem I ran into is that I do not have public source for the compression used in PocketPC to compress data sections in the ROM.
Not sure but it looks like a simple LZSS compression
UnKnOwN
UnKnOwN said:
Not sure but it looks like a simple LZSS compression
UnKnOwN
Click to expand...
Click to collapse
I thought it might be called LZX, but I'm not much of a compression guru. I did find an open source cab-extractor that implements LZX and I could try that, but haven't gotten to it yet. Another option is to extract the binary code from the emulator and use that, but I find that that is getting messy.
Just found something interesting in
WINCE410\PRIVATE\WINCEOS\COREOS\NK\KERNEL\compr2.c
WINCE provides two different functions to the KERNEL (binary and string (de)compression).
They both use the buildin CECompress() / CEDecompress() functions...
UnKnOwN
OK, I thought CECompress/CEDecompress are available but...
so I post some details here now :twisted:
in coredll.dll there are four functions:
StringCompress, StringDecompress, BinaryCompress, BinaryDecompress
You can use them via GetProcAddress( hCoreDLL, TEXT("BinaryDecompress") );
Here are some function headers and defines for you:
#define CECOMPRESS_ALLZEROS 0
#define CECOMPRESS_FAILED 0xffffffffUL
#define CEDECOMPRESS_FAILED 0xffffffffUL
DWORD StringCompress( LPBYTE bufin, DWORD lenin, LPBYTE bufout, DWORD lenout );
DWORD StringDecompress( LPBYTE bufin, DWORD lenin, LPBYTE bufout, DWORD lenout );
DWORD BinaryCompress( LPBYTE bufin, DWORD lenin, LPBYTE bufout, DWORD lenout );
DWORD BinaryDecompress( LPBYTE bufin, DWORD lenin, LPBYTE bufout, DWORD lenout, DWORD skip );
The return value is the number of bytes written to the output buffer or one of the three defines.
UnKnOwN
compress functions
The compress functions are the ones I was talking about getting out of the emulator code. Another options is to use a pocketpc application to copy the rom images out. The source code of the compression functions is not available, not even in the source code that M$ made available of the private wince parts.
CECompress and CEDecompress are in nkcompr.lib
which can be found in the (not so publicly available) platformbuilder,
and also in the (more available) wince41 developer kit.
in PUBLIC/COMMON/OAK/LIB/X86/DEBUG/nkcompr.lib
the wince41 kit only has the x86 version, a sa1100 version
is in the ce-platformbuilder.
Could your provide the tool to copy rom sections? I would try to add file assembling to it...
John
hmmm
Tried Binwalk? Send me a copy and i can have a crack at it.

compiled jar library project

Hi all.
I need to do a close source library for my work.
I figured I could create a library project and then export all of its code into a compiled jar archive.
Then, when I need to use that library, I use the empty android library project for its resources and I import the jar file in the build path.
So far, it works when the main project that uses the library doesn't have its own resources.
But as soon as I add a resource (like icon.png) into the main project, the application fails to launch a library activity and I get this error : Unable to start activity ComponentInfo{...}: android.content.res.Resources$NotFoundException: File res/drawable/icon.png from xml type layout resource ID #0x7f020000
I really don't get it. What's the problem ?
Thank you for your help.

Need help with simple string

Hi @all,
is it possible to use a string from android/frameworks/base/core/res/res/values in systemui app ?
How do i import the Resources?
a import call to
Code:
import android.core.R;
doesnt work
many thanks for help
In XML files it's usually referenced as "@android/string/whatever"
Well, first I suggest you to use an xml file called strings.xml in the folder ...\MyApp\res\values
Your strings.xml should contain the strings you need, in this format:
<string name="app_name">MyApp</string>
Then, you could refer to the string "app_name" from the main app class or from the xml layout.
From the xml layout, I suppose you have a textView or a Button or whatever. In the declaration you should use:
android:text="@string/app_name"
In the main app class (or other class) you should refer to your layout oblect (a button or whatever) and then access to the string value:
myButton.setText(mContext.getResources().getText(R.string.app_name));
I hope it helps

[Q] Write a string on smartphone and read it into sqlite file on my notebook

I would like to create a new application on Android with one EditText and a button. I would like to write a string into EditText, to press button and to read into my notebook a new sqlite database with my string. I am not so expert with java Android and English but I would like to try reading a code example to do this programme. Could you help me? I use Eclipse with sdk.

[Library] DBXDroid - Simple ORM Library for Android SQLite Database

DBXDroid​Simple ORM Library for Android SQLite Database​
Description
This is android library to simplify Android SQlite Database
It become very tedious to write large Android SQLite Open helper for simple database usage. So I developed this library to create android databases very easily using straight forward functions.
Github Project Link - DBXDroid-Github
Direct Download Link - DBXDroid-Sourceforge
Features
Create Android SQLite Database
Add Tables to database
Insert new entry to tables
Fetch entries from tables
Ability to interact with database directly using getDatabase() function.
Compatibility
DBXDroid library is compatible for Android 2.3+
Installation
To use DBXDroid ,
Download Library
Extract it to DBXDroid directory
Copy it to your Android Project Workspace
Add it as a project to your Android ADT
Edit properties of your project -> Android -> Library -> Add DBXDroid as Library
Library is now ready to use
Use
1. Define Database
Code:
DBXDatabase studentDatabase;
studentDatabase = new DBXDatabase("college.db", this);
2. Create ColumnList
Code:
DBXColumnList studentColumns = new DBXColumnList();
studentColumns.addColumn(new DBXColumn("student_id",DBXFieldType.INTEGER));
studentColumns.addColumn(new DBXColumn("student_name",DBXFieldType.TEXT));
studentColumns.addColumn(new DBXColumn("student_dept",DBXFieldType.VARCHAR));
3. Add new Table to Database
Code:
studentDatabase.addTable(new DBXTable("students", studentColumns));
4. Create Database
Code:
try {
studentDatabase.createDatabase();
} catch (Exception e) {
e.printStackTrace();
}
5. Open Database
Code:
try {
studentDatabase.openDatabase();
} catch (Exception e) {
e.printStackTrace();
}
6. Inserting new Entry to table
Code:
DBXFieldValuePairList studentFieldsList = new DBXFieldValuePairList();
studentFieldsList.addFieldValuePair(new DBXFieldValuePair("student_id", Integer.parseInt(studentID)));
studentFieldsList.addFieldValuePair(new DBXFieldValuePair("student_name", studentName));
studentFieldsList.addFieldValuePair(new DBXFieldValuePair("student_dept", studentDept));
try {
if (studentDatabase.insertEntry("students", studentFieldsList) != -1) {
Toast.makeText(this, "Added", Toast.LENGTH_SHORT).show();
}
} catch (Exception e) {
e.printStackTrace();
}
7. Fetching Entries
Code:
DBXResult dbxResult = studentDatabase.getEntries("students");
String[][] result = dbxResult.getResults();
8. Access Database Directly
Code:
public SQLiteDatabase getDatabase();
This method returns SQLiteDatabase object reference for your database, So you can interact normally and directly to database
9. Closing Database
Code:
try {
studentDatabase.closeDatabase();
} catch (Exception e) {
e.printStackTrace();
}
Refer DBXDroidDemo for Full Demo
License
DBXDroid is under the GNU General Public License v3.0 License.
sdk? or jdk
s.o.s so this is a java script object oriented based sql form relational database that has a sdk acting like the LRAD filtering data through normal forms?
If you decide to further inspect the contents of the p32m x 360f512 l.h file (it is a simple
text file that you can open with the MPLAB editor), you will see that it contains an
incredibly long list of definitions for all the names of the internal special-function
registers (often referred to in the documentation as the SFRs ) of the chosen PIC32 model.
If the include file is accurate, those names reflect exactly those being used in the device
datasheet and the PIC32 reference manual.
Here is a segment of the p32m x 360f512 l.h file in which the special-function register that
controls the watchdog module ( WDTCON ) and each of its individual bits are assigned their
conventional names:
...
extern volatile unsigned int WDTCON__attribute__
((section( " sfrs " )));
typedef union {
struct {
unsigned WDTCLR:1;
The Adventure Begins 7
unsigned WDTWEN:1;
unsigned SWDTPS0:1;
unsigned SWDTPS1:1;
unsigned SWDTPS2:1;
unsigned SWDTPS3:1;
unsigned SWDTPS4:1;
unsigned :7;
unsigned FRZ:1;
unsigned ON:1;
};
...
Back to our Hello.c source file; let ’ s add a couple more lines that will introduce you to
the main() function:
main()
{
}
What we have now is already a complete, although still empty and pretty useless, C
language program. In between those two curly brackets is where we will soon put the first
few instructions of our embedded-control application.
Independently of this function position in the file, whether in the first lines on top or
the last few lines in a million-lines file, the main() function is the place where the
microcontroller will go first at power-up or after each subsequent reset. This is actually an
oversimplification. After a reset or at power-up, but before entering the main() function,
the microcontroller will execute a short initialization code segment automatically
inserted by the MPLAB C32 linker. This is known as the Startup code or crt0 code (or
simply c0 in the traditional C language literature). The Startup code will perform basic
housekeeping chores, including the all important initialization of the stack, among many
other things.
aditya.kamble said:
DBXDroid​Simple ORM Library for Android SQLite Database​
Description
...
Click to expand...
Click to collapse
This is no ORM library. There is no mapping from or to objects in this code. Have a look at http://en.wikipedia.org/wiki/Object-relational_mapping for the differences. As examples for real ORM libraries for android, OrmLite or GreenDAO come to mind.
Furthermore, there are a lot of problems with this code.
Its ORM Like Library
onlyolli said:
This is no ORM library. There is no mapping from or to objects in this code. Have a look at http://en.wikipedia.org/wiki/Object-relational_mapping for the differences. As examples for real ORM libraries for android, OrmLite or GreenDAO come to mind.
Furthermore, there are a lot of problems with this code.
Click to expand...
Click to collapse
Yeah it is not fully ORM library but it is ORM like library which provides easier functions can be adopted fast by developer when they dont have time to learn proper ORM library
Nope, sorry, it is really not. All it is is a few functions to create a database schema programmatically and a few functions to do some conversion from and to strings. This is nothing anyone should touch if he/she wants to do proper android software development. If you dont have the time to learn some real ORM tool, then you're better of not developing at all. It takes just a few minutes to get started with something like SugarORM (have a look at http://satyan.github.io/sugar/getting-started.html to see what i mean) which provides a real benefit to your application.
JDXA ORM for Android
You may want to check out JDXA, a simple yet powerful, and flexible ORM solution for Android. JDXA easily supports inheritance, one-to-one, one-to-many, and many-to-many relationships and offers a POJO (Plain Old Java Objects) friendly non-intrusive programming model, which does not require you to change your Java classes in any way:
No need to subclass your domain classes from any base class
No need to clutter your source code with annotations
No need for DAO classes
No source code generation or pre-processing of your code
Automatic creation of database schema
Get more information including code snippets and a FREE trial download at softwaretree.com

Categories

Resources