[question]how to use sin2img???? - XPERIA X10 Q&A, Help & Troubleshooting

i try to convert file .sin using tool sin2img but in the case if i trying to uses the system say Unhandled Exception: System.IO.FileNotFoundException: Could not find file 'C:\SI
N2IMG\[system.sin]'.
File name: 'C:\SIN2IMG\[system.sin]'
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, I
nt32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions o
ptions, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
at SIN2IMG.Program.ExtractImage(String infile, String outfile)
at SIN2IMG.Program.Main(String[] args)
can somebody help me????i'm just newbie....

usage: system.sin system.img ::: by ex aZuZu
so without >> []
sin2img system.sin system.img >>> correct..
sin2img [system.sin] [system.img] >>> incorrect..

Related

[HELP] Passing a String to getString

hello everybody!
i'm making a program that needs to set to a textview the content of a string stored in resource/string file
in my program i generate a string and i need to set the text using that string like a resource id. the problem is that the resouurce ids are integers.
something like:
test = (TextView) findViewById(R.id.tvMyTV);
mystring = "test_a";
test.setText(Html.fromHtml(getString(R.string.mystring)));
-----------
i obviously can't use R.string.mystring, i should use
test.setText(Html.fromHtml(getString(R.string.test_a)));
somebody have a solution to this problem?
thank you all and sorry for my bad english. i'm italian
Hi!
Why are you using HTML.fromHTML? You don't need to use that to set a string from your resource.
This is how it works. Your resource ids are ints. you pass this int to some methods which get you the respective resource. The getString method similarly takes an int resource id for your string and returns you a string which you just set to a textview
Code:
String myString = getString(R.string.mystring);
test.setText(myString);
or simply
Code:
test.setText(getString(R.string.mystring));
Thats all there is to it
thank you for the fast answer but it doesnt work
i'm using Html.fromHtml because the string is html-formatted (inside have <b>...</b> , <br/>)
Code:
String myString = getString(R.string.mystring);
R.string.mystring doesnt exist besause mystring dont exist as a resource string (which have an associated Int id). mystring is a variable.
i have to write something like
Code:
String myString = getString(R.string.[the content of mysting]);
i tried to write
Code:
test.setText(pleaseGiveMeMyString(mystring));
where
Code:
public String pleaseGiveMeMyString(String inputstring) {
// TODO Auto-generated method stub
String outputString = "R.string." + inputstring;
return outputString;
}
but in the textView i read R.string.test_a not the content of the string test_a
like i wrote
Code:
test.setText("R.string.test_a");
There is a lot that is wrong with what you are trying to do. You are trying to set the output of an HTML code to a TextView. It won't work.
If you want to display the output of an HTML code you should use a WebView.
I am afraid I am having a hard time understanding what exactly you are trying to do with the string resources but I'm going to try to explain this to you again.
This is how you set a string in strings.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="test_string">This is my string</string>
</resources>
Then in your java program you get the string like this
Code:
String mystring = getString(R.string.test_string);
the contents of mystring are "This is my string"
Besides I am not sure if it is a wise thing to store HTML code as part of your strings.xml file. Because of the similarities in HTML and XML tag formats.
You'd be better off making a .html file in notepad or something and then just put this .html file in the raw folder of your project. Then you just load this file using getResources().openRawResources(). Then use the InputStream object this method ouputs to create a BufferedReader and read in the HTML as a String.
Pass this string to a WebView to display your HTML in a renderered form.

Android File object mkdirs with accents

Hi,
I'm using the Java File object to create diretories, however a folder containing an accent won't be created, for example
File f = new File ("/sdcard/sécurité/");
f.mkdirs();
the folder sécurité won't be created and no error will be raisen
however
File f = new File ("/sdcard/securite/");
f.mkdirs();
does work
Any idea ?
Thank you !

[Q] How to override an XML resource in an app?

I am attempting to replace the data an app* stores in an XML resource, and I can't figure out how to make it work. I followed the tutorial, but it only covers things like "drawable" (and the simple types like string and integer)
I have tried various combinations of compiled or textual XML, with the file in res/xml or res/raw, and so far have not found anything that had any effect on the app, while my module never reports any errors! (at least not in any log I've found)
*The app is Swype, I'm attempting to replace one of the English keyboard layouts (qwerty, azerty, or qwertz) with a completely new one I saw that's actually good for the sliding entry method instead of a slide left on the top row being at least 14 different possible words (Seriously, I made a list) including some very commonly needed ones like it, or, out, and our. The layouts are** stored in xml files such as res/xml/kbd_azerty_panlatin.xml but even attempting a single letter swap hasn't done anything yet.
So, what do I need to do to make a line like
Code:
resParam.res.setReplacement(resParam.packageName, "xml", "kbd_azerty_panlatin", xrf);
actually work? (xrf is from
Code:
XResForwarder xrf = modRes.fwd(R.raw.kbd_azerty_panlatin);
as of my last attempt. modRes is as per the tutorial) and that file is in the last attempt compiled by creating a new Swype apk with the modification via apktool then just grabbing it from there.)
**Note that actually attempting to run recompiled Swype APKs -- modded or not -- fails with a crash when the keyboard would appear, so I can't actually confirm that I'm right about the location of the layouts I need to change, but it seems to be reasonable that they are where I think. I also have No idea how to link them to the language options, so I can't see a way to create a new one instead of replacing an existing.
bump, I'm curious too
edit: if you scroll down on the tutroial page, it covers modifying xml layouts
ssojyeti2 said:
... if you scroll down on the tutroial page, it covers modifying xml layouts
Click to expand...
Click to collapse
It doesn't give much detail and since layouts are a separate type, it might not apply anyway.
I really hope it's not right about me needing to include All the xml files in the app just to make one work. I suppose I should try it anyway.
ok i was able to successfully replace an xml file in snapchat using xposed, although it caused snapchat to fc, but i think thats on the app itself. i basically copied the code on the tutorial word for word lol
Code:
package com.joss.geofilter;
import android.content.res.XModuleResources;
import de.robv.android.xposed.IXposedHookInitPackageResources;
import de.robv.android.xposed.IXposedHookZygoteInit;
import de.robv.android.xposed.callbacks.XC_InitPackageResources.InitPackageResourcesParam;
public class GeoResize implements IXposedHookZygoteInit, IXposedHookInitPackageResources {
private static String MODULE_PATH = null;
@Override
public void initZygote(StartupParam startupParam) throws Throwable {
MODULE_PATH = startupParam.modulePath;
}
@Override
public void handleInitPackageResources(InitPackageResourcesParam resparam) throws Throwable {
if (!resparam.packageName.equals("com.snapchat.android"))
return;
XModuleResources modRes = XModuleResources.createInstance(MODULE_PATH, resparam.res);
resparam.res.setReplacement("com.snapchat.android", "layout", "battery_view", modRes.fwd(R.raw.battery_view));
}
}
because i put it in /raw, i had to compile the xml first using apktool and swap it into the xposed module using 7zip afterwards
I'm late, but i think you've misunderstand some things. For example, you can't mod Swype, not like you do here.
I give you an example. I've this xml file:
Code:
<resources>
<color name="white">#ff000000</color>
<color name="common_signin_btn_default_background">#ff000000</color>
</resources>
(taken from Twitter app)
I want to change that values. You can't replace the entire xml, but you can create an xml, name it like you want (xda.xml will work) and put in it:
Code:
<resources>
<color name="white">THE COLOR YOU WANT</color>
<color name="common_signin_btn_default_background">THE OTHER COLOR YOU WANT</color>
</resources>
and you put that file into res/values of your Xposed app. You've not to write all entries, you write only those you want to change. Now, you have to write the code that does the magic:
Code:
import android.content.res.XModuleResources;
import de.robv.android.xposed.IXposedHookInitPackageResources;
import de.robv.android.xposed.IXposedHookZygoteInit;
import de.robv.android.xposed.callbacks.XC_InitPackageResources.InitPackageResourcesParam;
public class Main implements IXposedHookZygoteInit, IXposedHookInitPackageResources {
private static String MODULE_PATH = null;
@Override
public void initZygote(StartupParam startupParam) throws Throwable {
MODULE_PATH = startupParam.modulePath;
}
@Override
public void handleInitPackageResources(InitPackageResourcesParam resparam) throws Throwable {
if (!resparam.packageName.equals("com.twitter.android"))
return;
XModuleResources modRes = XModuleResources.createInstance(MODULE_PATH, resparam.res);
resparam.res.setReplacement("com.twitter.android", "color", "white", modRes.fwd(R.color.white));
resparam.res.setReplacement("com.twitter.android", "color", "faint_transparent_white", modRes.fwd(R.color.faint_transparent_white));
}
}
So, into 'resparam.res.setReplacement' you don't put the xml name, but you put the resource name. In this case, the color's name. So, if in your xml you have:
Code:
<resources>
<color name="forum">THE COLOR YOU WANT</color>
</resources>
you will use:
Code:
resparam.res.setReplacement("com.twitter.android", "color", "white", modRes.fwd(R.color.forum));
And that changes the color 'white' of Twitter app, into the color 'forum', that you've defined into your xlm xda.xml ('THE COLOR YOU WANT' here).
For layout, that is a bit different...
Ok sorry, my last post here is not totally correct. The way used in the first post should work, but it doesn't. Has someone find a solution?
P.S. The example of snapchat is a bit different, probably, because it uses 'layout'.
P.S.2 This thread should be moved in the 'Xposed' section...
robertogl said:
I'm late, but i think you've misunderstand some things. For example, you can't mod Swype, not like you do here.
I give you an example. I've this xml file:
Code:
<resources>
<color name="white">#ff000000</color>
<color name="common_signin_btn_default_background">#ff000000</color>
</resources>
(taken from Twitter app)
I want to change that values. You can't replace the entire xml, but you can create an xml, name it like you want (xda.xml will work) and put in it:
Code:
<resources>
<color name="white">THE COLOR YOU WANT</color>
<color name="common_signin_btn_default_background">THE OTHER COLOR YOU WANT</color>
</resources>
and you put that file into res/values of your Xposed app. You've not to write all entries, you write only those you want to change. Now, you have to write the code that does the magic:
Code:
import android.content.res.XModuleResources;
import de.robv.android.xposed.IXposedHookInitPackageResources;
import de.robv.android.xposed.IXposedHookZygoteInit;
import de.robv.android.xposed.callbacks.XC_InitPackageResources.InitPackageResourcesParam;
public class Main implements IXposedHookZygoteInit, IXposedHookInitPackageResources {
private static String MODULE_PATH = null;
@Override
public void initZygote(StartupParam startupParam) throws Throwable {
MODULE_PATH = startupParam.modulePath;
}
@Override
public void handleInitPackageResources(InitPackageResourcesParam resparam) throws Throwable {
if (!resparam.packageName.equals("com.twitter.android"))
return;
XModuleResources modRes = XModuleResources.createInstance(MODULE_PATH, resparam.res);
resparam.res.setReplacement("com.twitter.android", "color", "white", modRes.fwd(R.color.white));
resparam.res.setReplacement("com.twitter.android", "color", "faint_transparent_white", modRes.fwd(R.color.faint_transparent_white));
}
}
So, into 'resparam.res.setReplacement' you don't put the xml name, but you put the resource name. In this case, the color's name. So, if in your xml you have:
Code:
<resources>
<color name="forum">THE COLOR YOU WANT</color>
</resources>
you will use:
Code:
resparam.res.setReplacement("com.twitter.android", "color", "white", modRes.fwd(R.color.forum));
And that changes the color 'white' of Twitter app, into the color 'forum', that you've defined into your xlm xda.xml ('THE COLOR YOU WANT' here).
For layout, that is a bit different...
Click to expand...
Click to collapse
what about editing strings? in an apps xml?
devzeus_ke said:
what about editing strings? in an apps xml?
Click to expand...
Click to collapse
Too many years have passed to remember that
robertogl said:
Too many years have passed to remember that
Click to expand...
Click to collapse
Oww. I am actually getting started with android development and i am also learning how the system itself works. However i haven't found an example to edit a string resource in an app. I only find examples on how to edit systemui resources. Any help with finding that?
devzeus_ke said:
Oww. I am actually getting started with android development and i am also learning how the system itself works. However i haven't found an example to edit a string resource in an app. I only find examples on how to edit systemui resources. Any help with finding that?
Click to expand...
Click to collapse
Note that this 'replacement' only works with the Xposed framework.
robertogl said:
Note that this 'replacement' only works with the Xposed framework.
Click to expand...
Click to collapse
actually i meant over writing. Like changing string values

[GUIDE] VIPER4Android FX for Android 11 based Custom ROM

Hi Guys,
Here I will share with you a guide to install Viper4Android on Android 11 based ROM.
In this guide my devices is Mi 9T Pro running Havoc-OS 4.5 AOSP ROM.
I just migrated from xiaomi.eu Weekly ROM 21.6.2 and I also successfully installed it on that ROM using this method.
I read on the other thread that wifi might be broken after installing Viper4Android and you need to flash custom kernel to fix the issue.
Rest assured I have tested this method and the wifi is working fine, no need to flash any custom kernel.
This guide might also worked for other devices as reported by other users.
I'm running Havoc-OS 4.6 and Magisk 23.0 at the moment.
AOSP Based ROM (Havoc-OS 4.5 tested) :
1. Download and Install from TWRP rootless Viper4android FX here.
2. Open file browser that can access root folder. In this case I use Root Explorer
3. Go to /data/adb/modules/ViPER4AndroidFX/ , find file post-fs-data.sh. If the file not exist make new file and name it post-fs-data.sh .
4. Edit the file, copy and add this text at the end of row.
Code:
magiskpolicy --live 'allow audioserver audioserver_tmpfs file { read write execute }'
magiskpolicy --live 'allow audioserver system_file file { execmod }'
magiskpolicy --live 'allow mediaserver mediaserver_tmpfs file { read write execute }'
magiskpolicy --live 'allow mediaserver system_file file { execmod }'
magiskpolicy --live 'allow audioserver unlabeled file { read write execute open getattr }'
magiskpolicy --live 'allow hal_audio_default hal_audio_default process { execmem }'
magiskpolicy --live 'allow hal_audio_default hal_audio_default_tmpfs file { execute }'
magiskpolicy --live 'allow hal_audio_default audio_data_file dir { search }'
magiskpolicy --live 'allow app app_data_file file { execute_no_trans }'
magiskpolicy --live 'allow mtk_hal_audio mtk_hal_audio_tmpfs file { execute }'
5. Save the file.
6. If you create a new file during step 3, don't forget to add permission on to the file, tick every checkboxes available.
(though its not necessary to tick all of it but I don't understand so I just tick all of it).
7. Reboot your phone, go to Viper4Android - Settings and choose Legacy Mode.
8. Now the Viper4Android should be run successfully.
For MIUI 12 guide to install you can follow the original guide in this link below :
https://forum.xda-developers.com/t/mod-viper4android-miui-12-magisk-21-1.4203489/
Hope this thread will help you installing the Viper4Android
Credits to @_mysiak_ and reference thread here.
Buddy you're life saver... I'm using your method on Oxygen OS 11.1.1.3 on OnePlus Nord and everything working very smooth.

how can i write to a file and read from it in android studio?

hi always use c and c++ but now i'm trying to create a game application with ndk
but it needs some java codes and i dont know java at all!!
i want to create a file
write a string in that file
then read that string again from that file?
can you help me? or show me a way to do that?!
mjs2001227 said:
write a string in that file
then read that string again from that file?
Click to expand...
Click to collapse
Write String to File in Java - TutorialKart
To write String to File in Java, there are many processes we can follow. Some of them are using FileUtils class of apache's commons.io library, Input Streams, etc.
www.tutorialkart.com
good luck!

Categories

Resources