Temp Conversion - Android Software/Hacking General [Developers Only]

// This method is called at button click because we assigned the name to the
// "On Click property" of the button
public void myClickHandler(View view) {
switch (view.getId()) {
case R.id.button1:
RadioButton celsiusButton = (RadioButton) findViewById(R.id.radio0);
RadioButton fahrenheitButton = (RadioButton) findViewById(R.id.radio1);
RadioButton KelvinButton = (RadioButton) findViewById(R.id.radio2);
if (text.getText().length() == 0) {
Toast.makeText(this, "Please enter a valid number",
Toast.LENGTH_LONG).show();
return;
}
float inputValue = Float.parseFloat(text.getText().toString());
if (celsiusButton.isChecked()) {
text.setText(String
.valueOf(convertFahrenheitToCelsius(inputValue)));
celsiusButton.setChecked(false);
fahrenheitButton.setChecked(true);
} else {
text.setText(String
.valueOf(convertCelsiusToFahrenheit(inputValue)));
fahrenheitButton.setChecked(false);
celsiusButton.setChecked(false);
text.setText(String
.valueOf(convertCelsiusToKelvin(inputValue)));
KelvinButton.setChecked(true);
celsiusButton.setChecked(false);
Can anyone assist me with this? The error message I keep getting is "kelvinbutton is not resolved" and the second I need to have another else if statement but where do i put that at.
Thanks.

Related

[Q][VB.NET] Access remote XML services

EDIT: Development continued Working hard
Hello everyone
I'm trying to port my WIP Infosode from Android (Adobe AIR) to Windows Phone 7, and I have some big problems figuring out how to access a remote XML service, in this case http://services.tvrage.com/
I've used Visual Basic .NET for both desktop and Windows Mobile applications and now for WP7, so I got some VB.NET experience.
Any help is appreciated and will be noted in the finished application.
Regards
//
IzaacJ
Here is one somewhat dirty way.
Download your data (xml) into the isolated storage. After that process the xml file stored.
Code:
WebClient client = new WebClient();
client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(client_DownloadStringCompleted);
client.DownloadStringAsync(new Uri("http://path.to/the/" + item + ".xml/"));
static void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
// If we have results
if (!string.IsNullOrEmpty(e.Result))
{
#region Save to Isolated Storage
try
{
// Isolated Storage Directory
string xmlStorageDirectory = "Profiles";
using (IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication())
{
// File Path
string filePath = Path.Combine(xmlStorageDirectory, String.Format("{0}.xml", ActiveID));
// Check if the Directory exists. If not create it
if (!store.DirectoryExists(xmlStorageDirectory))
{
store.CreateDirectory(xmlStorageDirectory);
}
// Use Isolated Storeage to write the file
using (IsolatedStorageFileStream fileStream = new IsolatedStorageFileStream(filePath, FileMode.Create, store))
{
// Use the stream to write the file
using (StreamWriter stream = new StreamWriter(fileStream))
{
stream.Write(e.Result.Replace(" & ", " & "));
}
}
}
}
// OMG EXCEPTIONS :(
catch (IsolatedStorageException exception)
{
throw exception;
}
#endregion
#region Reading
using (var appStorage = IsolatedStorageFile.GetUserStoreForApplication())
{
using (var file = appStorage.OpenFile("Profiles/" + ActiveID + ".xml", FileMode.Open))
{
XmlReader reader = XmlReader.Create(file);
CharacterDataModel profile = new CharacterDataModel();
List<PlayerTraitsModel> traits = new List<PlayerTraitsModel>();
PlayerTraitsModel trait = new PlayerTraitsModel();
bool isCdata = false;
bool isPdata = false;
// While we read the data
while (reader.Read())
{
#region Character
if (reader.Name == "cdata") isCdata = true;
if (isCdata)
{
if (reader.NodeType == XmlNodeType.Element)
{
#region Check for the following values and shallow copy that to the model
//string item = reader.ReadElementContentAsString();
switch (reader.Name)
{
case "id":
profile.id = reader.ReadElementContentAsString();
break;
}
#endregion
}
}
if (reader.NodeType == XmlNodeType.EndElement && reader.Name.Contains("cdata"))
isCdata = false;
#endregion
}
}
}
#endregion
}
}
Thanks for that
Will try to adopt it to VB.NET and see if it will work
At least it's something that I could use until I find a better way.
Regards
Hi,
Use the OpenReadCompleted event of the WebClient, and then put the result into an XDocument by using an XmlReader; from there it's easy to process it (using LINQ to XML) without having to store the XML anywhere first (i.e. do it all in memory). Here's kind of how I do it C#.
Code:
WebClient client = new WebClient();
// Set up the 'completed' event before loading anything
client.OpenReadCompleted += (sender, e) =>
{
if (e.Error != null)
{
if (e.Error is WebException)
{
... Either a connection error, or an invalid status code has been returned. You can determine which using code.
}
else
... // some other exception
return;
}
// Turn the result into an XDocument and parse using LINQ
try
{
Stream aStream = e.Result;
XmlReader anXmlStream = XmlReader.Create(aStream);
XDocument ourXDocument = XDocument.Load(anXmlStream);
// Parse the XML here - best to use 'Linq to XML' to do it
List<TvShow> TVShows = from aShow in ourXDocument.Descendants("show")
select new TvShow() {
ShowName = aShow.Element("name").Value,
Link = aShow.Element("link").Value
};
//////////////////
str.Close();
// if here it all went to plan
}
catch (XmlException xe)
{
...
}
catch (Exception ge)
{
...
}
};
// Here's the bit that actually sets it going
try
{
client.OpenReadAsync(new Uri(URL, UriKind.Absolute));
}
catch (OutOfMemoryException)
{
... Handle the exception
}
catch (StackOverflowException)
{
... Handle the exception
}
catch (Exception ge)
{
... Handle the exception
}
If you're doing this kind of thing a lot it's good to set it up as reusable class that either has it's own events (e.g. ItemsLoaded, ErrorOccured, and ProcessItems) that can be subscribed to, or if you prefer you can have them as methods to override so that you can use it as a web service loading base class from which you can inherit.
Hope that helps. Good luck with it
Ian
otherworld said:
Hi,
Use the OpenReadCompleted event of the WebClient, and then put the result into an XDocument by using an XmlReader; from there it's easy to process it (using LINQ to XML) without having to store the XML anywhere first (i.e. do it all in memory). Here's kind of how I do it C#.
Code:
WebClient client = new WebClient();
// Set up the 'completed' event before loading anything
client.OpenReadCompleted += (sender, e) =>
{
if (e.Error != null)
{
if (e.Error is WebException)
{
... Either a connection error, or an invalid status code has been returned. You can determine which using code.
}
else
... // some other exception
return;
}
// Turn the result into an XDocument and parse using LINQ
try
{
Stream aStream = e.Result;
XmlReader anXmlStream = XmlReader.Create(aStream);
XDocument ourXDocument = XDocument.Load(anXmlStream);
// Parse the XML here - best to use 'Linq to XML' to do it
List<TvShow> TVShows = from aShow in ourXDocument.Descendants("show")
select new TvShow() {
ShowName = aShow.Element("name").Value,
Link = aShow.Element("link").Value
};
//////////////////
str.Close();
// if here it all went to plan
}
catch (XmlException xe)
{
...
}
catch (Exception ge)
{
...
}
};
// Here's the bit that actually sets it going
try
{
client.OpenReadAsync(new Uri(URL, UriKind.Absolute));
}
catch (OutOfMemoryException)
{
... Handle the exception
}
catch (StackOverflowException)
{
... Handle the exception
}
catch (Exception ge)
{
... Handle the exception
}
If you're doing this kind of thing a lot it's good to set it up as reusable class that either has it's own events (e.g. ItemsLoaded, ErrorOccured, and ProcessItems) that can be subscribed to, or if you prefer you can have them as methods to override so that you can use it as a web service loading base class from which you can inherit.
Hope that helps. Good luck with it
Ian
Click to expand...
Click to collapse
Thanks
I'm building a class with functions for fetching and storing the returned XML requests.
It's smart to store it in the IsoStorage so that the data is available offline as well and it will only download the new XML's if it's updated on the server
I think it will make the application a bit more useful.
Regards
EDIT: I've tried to port the first example from MJCS to VB.Net without success. The app closes itself when it's supposed to search and get results from the server. The URL to the generated XML (including parameters) is http://services.tvrage.com/feeds/search.php?key=[MY_API_KEY]&show=[SHOW_NAME]
The code as for now is this:
Code:
Public Function Search(ByVal SearchString As String) As String
Dim Url As New Uri(XMLUrl & "feeds/search.php?key=" & APIKey & "&show=" & SearchString)
'XMLUrl = http://services.tvrage.com/
'APIKey = My API key from TVRage.com
'SearchString = The showname to be searched for in the database
XML.DownloadStringAsync(Url)
Return 0
End Function
Any ideas?
Regards

[Q] Alawyas report network not available when using NewtorkInfo program

0 down vote favorite
share [g+] share [fb] share [tw]
I have wrote a program to check if the network is available or not. Here is my simple code:
Code:
public boolean isNetworkAvailable() {
Context context = getApplicationContext();
ConnectivityManager connectivity=ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
if (connectivity == null) {
boitealerte(this.getString(R.string.alert),"getSystemService rend null");
} else {
NetworkInfo[] info = connectivity.getAllNetworkInfo();
if (info != null) {
for (int i = 0; i < info.length; i++) {
if (info[i].getState() == NetworkInfo.State.CONNECTED) {
return true;
}
}
}
}
return false;
}
I run it on my Android phone, it always returns false but the network is available and I can make calls. Any suggestions>.

Samsung Galaxy S4 Secret Codes,New Galaxy S4 Hidden Code

How to access the internal function of Galaxy S4 for testing the various hardware parts of your phone if it is working properly or not with the help of this secret code you can test lcd, vibration, camera, sensor (accelerometer sensor, proximity sensor, magnetic sensor), touch screen, speaker, sub key, etc... if you have any hardware problem with your Galaxy S4 you can identify with this code if it is working or not to do this follow the steps below.
First of all open your keypad
Then dial the secret code *#0*#. Now you get a screen with title LCD TEST and below that you have lots of option to test various hardware parts of your phone such as speaker, sensor, lcd, etc
To go back use right physical button
while testing the touch, TSP Hovering you have to touch and mark all the squares back button does not work
Other use full secret codes for android phone tested on Galaxy S4
* #1234# to check software version of phone.
*#12580*369# to check software and hardware information.
*#0228# Battery status (ADC, RSSI reading)
*#0011# Service Menu
Do you have the code for turning on the other frequencies on international versions swe we can get them to more effectively work on ATT?
On the phone Dial Pad you run *#0011# , will get band info and Service Menu
Does anyone now the code to get into Diag mode?
Thanks for this (Y)
Sent from my GT-I9500 using xda premium
Thanks!!! Really helpful thread.
*#0*# Diagmode
Sent from my GT-I9500 using Tapatalk 2
Hey guys.
I had found on AndroidPit the following secret codes.
Insofar as I know they had work by my GT-I9505.
Just try it out
*#0011# service mode
*#0228# batteriestatus
*#0283# looback test
*#06# imei
*#03# nandflashheaderread
*#0808# usb service
*#9090# service mode
*#7284# FactoryKeystring
*#1234# Version
*#34971539#camera firmware standard
*#1111# servicemode
*#0*# Testmodus
On the Verizon version of the Galaxy S4, these codes do not work because the hidden menus are disabled by default. To enable the hidden menus on the Verizon version of the Samsung Galaxy S4 go here:
http://forum.xda-developers.com/showthread.php?t=2303905
recalibrated battery?
i just tried the code for battery status and my current batery status is 33% then was curious what function is "quick start" press it and the phone screen was turned of for 2-3 seconds and my battery went to 13% does that function calibrate battery status?
Very useful.
Thank you!
Hjogi
It amazes me the amount of carrier specific restrictions in this file! In fact, the contents of the file below is what was necessary to enable the S4 hidden menus on the VZW Galaxy S4 variant. It should work on other GS4 variants that have the hidden menus disabled.
I got the source below by using the dex2jar tool on HiddenMenu.apk, and then used jad & jd-gui to decompile the class files into Java source code. See here for steps to enable the hidden menus.
qualified class name is: com.android.hiddenmenu.HiddenmenuBroadcastReceiver
Code:
package com.android.hiddenmenu;
// <snip imports>
public class HiddenmenuBroadcastReceiver extends BroadcastReceiver
{
public static final boolean IS_DEBUG;
private static String checkMsl;
private static final String cpuCode;
private static final String cpuPreCode;
private static final String gsmsimcode;
private static final String mSalesCode = SystemProperties.get("ro.csc.sales_code", "NONE").trim().toUpperCase();
private static final String model;
private final String DIAG_FLAG = "0";
private String HIDDENMENU_ENABLE_PATH = "/efs/carrier/HiddenMenu";
private final String HIDDEN_MENU_OFF = "OFF";
private final String HIDDEN_MENU_ON = "ON";
private final int HIDDEN_MSL_CODE = 0;
private final int HIDDEN_OTHERS_CODE = 2;
private final int HIDDEN_OTKSL_CODE = 1;
static
{
if (SystemProperties.get("ro.product_ship", "FALSE").trim().toUpperCase().equalsIgnoreCase("TRUE"));
for (boolean bool = false; ; bool = true)
{
IS_DEBUG = bool;
cpuCode = SystemProperties.get("ro.baseband", "NONE").trim().toUpperCase();
cpuPreCode = SystemProperties.get("ro.product.board", "NONE").trim().toUpperCase();
model = SystemProperties.get("ro.product.model", "NONE").trim().toUpperCase();
gsmsimcode = SystemProperties.get("gsm.sim.operator.alpha", "NONE").trim().toUpperCase();
checkMsl = "";
return;
}
}
private boolean checkHiddenMenuEnable()
{
if (new File(this.HIDDENMENU_ENABLE_PATH).exists())
try
{
String str = read(this.HIDDENMENU_ENABLE_PATH);
if (str.equals("ON"))
return true;
boolean bool = str.equals("OFF");
if (bool)
return false;
}
catch (Exception localException)
{
Log.i("HiddenMenu", "Exception in reading file");
}
return false;
}
private static boolean isJigOn()
{
if (new File("/sys/class/sec/switch/adc").exists())
{
String str = readOneLine("/sys/class/sec/switch/adc");
if (IS_DEBUG)
Log.d("HiddenMenu", "JIG: 28");
if (IS_DEBUG)
Log.d("HiddenMenu", "JIG value: " + str);
try
{
if (Integer.parseInt(str, 16) == 28)
{
if (!IS_DEBUG)
break label160;
Log.d("HiddenMenu", "JIG ON");
break label160;
}
boolean bool4 = IS_DEBUG;
bool2 = false;
if (!bool4)
break label162;
Log.d("HiddenMenu", "Wrong value");
return false;
}
catch (Exception localException)
{
boolean bool3 = IS_DEBUG;
bool2 = false;
if (!bool3)
break label162;
}
Log.d("HiddenMenu", "value has unknown");
return false;
}
else
{
boolean bool1 = IS_DEBUG;
bool2 = false;
if (!bool1)
break label162;
Log.d("HiddenMenu", "File Does not Exist!");
return false;
}
label160: boolean bool2 = true;
label162: return bool2;
}
// ERROR //
public static String read(String paramString)
{
// <snip byte code>
// Exception table:
// from to target type
// 67 71 100 java/io/IOException
// 27 43 118 java/lang/Exception
// 140 144 150 java/io/IOException
// 27 43 171 finally
// 120 133 171 finally
// 177 181 184 java/io/IOException
// 50 59 202 finally
// 50 59 209 java/lang/Exception
}
// ERROR //
private static String readOneLine(String paramString)
{
// <snip byte code>
// Exception table:
// from to target type
// 51 56 73 java/io/IOException
// 61 66 73 java/io/IOException
// 7 17 91 java/io/FileNotFoundException
// 110 114 125 java/io/IOException
// 118 122 125 java/io/IOException
// 7 17 143 java/io/IOException
// 162 166 177 java/io/IOException
// 170 174 177 java/io/IOException
// 7 17 195 finally
// 93 106 195 finally
// 145 158 195 finally
// 201 205 216 java/io/IOException
// 209 213 216 java/io/IOException
// 17 31 239 finally
// 36 43 249 finally
// 17 31 260 java/io/IOException
// 36 43 270 java/io/IOException
// 17 31 281 java/io/FileNotFoundException
// 36 43 291 java/io/FileNotFoundException
}
public void onReceive(Context paramContext, Intent paramIntent)
{
Log.i("HiddenMenu", "intent " + paramIntent);
UsbManager localUsbManager = (UsbManager)paramContext.getSystemService("usb");
label162: if (paramIntent.getAction().equals("com.samsung.sec.android.application.csc.chameleon_diag"))
{
String str6 = paramIntent.getStringExtra("String");
Log.i("HiddenMenu", "value is " + str6);
SharedPreferences.Editor localEditor = paramContext.getSharedPreferences("hidden.diagMSLReq.preferences_name", 0).edit();
localEditor.putString("HIDDEN_DIAGMSLREQ", str6);
localEditor.commit();
SharedPreferences localSharedPreferences = paramContext.getSharedPreferences("hidden.diagMSLReq.preferences_name", 0);
Log.i("HiddenMenu", " Hidden menu diagMSLReq - " + localSharedPreferences.getString("HIDDEN_DIAGMSLREQ", "none"));
break label162;
}
Intent localIntent1;
String str1;
String str2;
label309: int i;
while (true)
{
return;
if (paramIntent.getAction().equals("android.provider.Telephony.SECRET_CODE"))
{
localIntent1 = new Intent("android.intent.action.MAIN");
localIntent1.putExtra(CheckHiddenMenu.permissionKey, CheckHiddenMenu.permission);
str1 = paramIntent.getStringExtra("String");
str2 = paramIntent.getData().getHost();
Log.i("HiddenMenu", "intenton " + paramIntent);
Log.i("HiddenMenu", "host is " + str2);
boolean bool4;
label401: int k;
if ("VZW".equalsIgnoreCase(mSalesCode))
{
bool4 = checkHiddenMenuEnable();
if ("DMMODE".equals(str2))
localIntent1.setClass(paramContext, DmMode.class);
}
else
{
if (((mSalesCode.equals("VZW")) || (mSalesCode.equals("USC")) || (mSalesCode.equals("MTR")) || (mSalesCode.equals("XAR"))) && (SystemProperties.get("ro.build.type", "user").trim().equals("user")))
{
if (!"VZW".equals(mSalesCode))
break label725;
if (str2.equals("HIDDENMENUENABLE"))
break;
}
if (str2.equals("4433366335623"))
k = Settings.System.getInt(paramContext.getContentResolver(), "wifi_offload_monitoring", 0);
}
try
{
ContentResolver localContentResolver = paramContext.getContentResolver();
if (k == 0);
for (int m = 1; ; m = 0)
{
Settings.System.putInt(localContentResolver, "wifi_offload_monitoring", m);
if (!str2.equals("DATA"))
break label805;
localIntent1.setClass(paramContext, hdata_options.class);
i = 1;
label474: if (i == 1)
{
localIntent1.setFlags(268435456);
paramContext.startActivity(localIntent1);
}
if (!str2.equals("MSL_OTKSL"))
break;
if ((!str1.equals("433346")) || (!mSalesCode.equalsIgnoreCase("VZW")))
break label3043;
Log.i("HiddenMenu", "enter MSK_OTKSL iot" + str1);
localIntent1.setFlags(268435456);
localIntent1.setClass(paramContext, IOTHiddenMenu.class);
paramContext.startActivity(localIntent1);
return;
if ("setDMMODEMADB".equals(str2))
{
Log.i("HiddenMenu", "Change USB Setting to DM + MODEM + ADB");
localUsbManager.setCurrentFunction("diag,acm,adb", true);
return;
}
if ("setMASSSTORAGE".equals(str2))
{
Log.i("HiddenMenu", "Change USB Setting to setMASSSTORAGE");
localUsbManager.setCurrentFunction("mass_storage", true);
return;
}
if ((!SystemProperties.get("ro.build.type", "user").trim().equals("user")) || (bool4) || ((isJigOn()) && ((str2.equals("TESTMODE")) || (str2.equals("RTN")))))
break label309;
Log.i("HiddenMenu", "is Jig On " + isJigOn());
return;
label725: if (str2.equals("HIDDENMENUENABLE"))
{
localIntent1.setClass(paramContext, HiddenMenuEnable.class);
break label401;
}
if (SystemProperties.get("sys.hiddenmenu.enable", "0").equals("1"))
break label401;
return;
}
}
catch (Exception localException)
{
while (true)
{
Log.e("HiddenMenu", "Error setWifioffloadDebugMode " + localException);
continue;
label805: if (str2.equals("PROGRAM"))
{
localIntent1.setClass(paramContext, ProgramMenu.class);
i = 1;
}
else if (str2.equals("MEID"))
{
String str5 = paramContext.getSharedPreferences("hidden.diagMSLReq.preferences_name", 0).getString("HIDDEN_DIAGMSLREQ", "none");
Log.i("HiddenMenu", "MEID diag Falg" + str5);
i = 0;
if (str5 != null)
{
boolean bool3 = "none".equalsIgnoreCase(str5);
i = 0;
if (!bool3)
{
Intent localIntent2 = new Intent("android.intent.action.MAIN");
localIntent2.setFlags(268435456);
localIntent2.setClass(paramContext, MEIDInfo.class).putExtra(CheckHiddenMenu.permissionKey, CheckHiddenMenu.permission);
paramContext.startActivity(localIntent2);
i = 0;
}
}
}
else if (str2.equals("RTN"))
{
String str4 = paramContext.getSharedPreferences("hidden.diagMSLReq.preferences_name", 0).getString("HIDDEN_DIAGMSLREQ", "none");
localIntent1.setClass(paramContext, RTN.class).putExtra("DIAGFLAG", str4);
i = 1;
}
else if ((str2.equals("CTN")) && ("SCH-I925U".equalsIgnoreCase(model)))
{
localIntent1.setClass(paramContext, CTN.class).putExtra("keyString", str2);
i = 1;
}
else if (str2.equals("LOG"))
{
localIntent1.setClassName("com.sec.android.app.servicemodeapp", "com.sec.android.app.servicemodeapp.SysDump");
i = 1;
}
else if (str2.equals("DEBUG"))
{
if ("SCH-S960L".equalsIgnoreCase(model))
{
localIntent1.setClass(paramContext, MSL_Checker.class).putExtra("keyString", str2);
i = 1;
}
else if (!mSalesCode.equalsIgnoreCase("VZW"))
{
localIntent1.setClass(paramContext, DebugMenu_Check.class).putExtra("keyString", str2);
i = 1;
}
else
{
localIntent1.setClass(paramContext, DEBUGMENU.class);
i = 1;
}
}
else if (str2.equals("PROG"))
{
localIntent1.setClass(paramContext, TelesPree_Option.class);
i = 1;
}
else if (str2.equals("IOTHIDDENMENU"))
{
localIntent1.setClass(paramContext, IOTHiddenMenu.class);
i = 1;
}
else if (str2.equals("TESTMODE"))
{
Log.i("HiddenMenu", "gsm sim code is" + gsmsimcode + "#" + gsmsimcode.trim() + "#");
if (((mSalesCode.equals("SPR")) || (mSalesCode.equals("VMU"))) && ((gsmsimcode.replaceAll(" ", "").equalsIgnoreCase("BOOSTMOBILE")) || (gsmsimcode.equalsIgnoreCase("VIRGIN"))))
{
localIntent1.setClass(paramContext, MSL_Checker.class).putExtra("keyString", str2);
i = 1;
}
else if (cpuPreCode.equalsIgnoreCase("MSM7630_SURF"))
{
localIntent1.setClass(paramContext, MSL_Checker.class).putExtra("keyString", "TESTMODE");
i = 1;
}
else if ((cpuCode.equals("MSM")) || (cpuCode.equalsIgnoreCase("mdm")))
{
Log.i("HiddenMenu", str2);
localIntent1.setClass(paramContext, ServiceModeApp.class).putExtra("keyString", "TESTMODE");
i = 1;
}
else
{
localIntent1.setClass(paramContext, TerminalMode.class).putExtra("keyString", "TESTMODE");
i = 1;
}
}
else if (str2.equals("NAMBASIC"))
{
localIntent1.setClass(paramContext, MSL_option.class);
i = 1;
}
else if (str2.equals("GPSCLRX"))
{
localIntent1.setClass(paramContext, MSL_Checker.class).putExtra("keyString", str2);
i = 1;
}
else if (str2.equals("SCRTN"))
{
localIntent1.setClass(paramContext, SCRTN.class);
i = 1;
}
else
{
if (!str2.equals("TTY"))
break;
localIntent1.setClass(paramContext, TTY.class);
i = 1;
}
}
if (!str2.equals("PUTIL"))
break label2374;
}
}
}
if (!PhoneUtilSupport.canLaunchUsb());
for (int j = 0; ; j = 1)
{
String str3 = paramContext.getSharedPreferences("hidden.diagMSLReq.preferences_name", 0).getString("HIDDEN_DIAGMSLREQ", "none");
if ("SPH-L720".equalsIgnoreCase(model))
if ("0".equals(str3))
localIntent1.setClass(paramContext, PhoneUtil_Jspr.class);
while (true)
{
i = j;
break;
localIntent1.setClass(paramContext, MSL_Checker.class).putExtra("keyString", "PhoneUtil_JSPR");
continue;
if ((("BST".equalsIgnoreCase(mSalesCode)) || ("XAS".equalsIgnoreCase(mSalesCode)) || ("mdm".equalsIgnoreCase(cpuCode))) && (!"SPH-D710BST".equalsIgnoreCase(model)))
{
Log.i("HiddenMenu", "For prevail 2 code");
Log.i("HiddenMenu", "diagReq : " + str3);
if ("XAS".equalsIgnoreCase(mSalesCode))
{
if (("SPH-L900".equalsIgnoreCase(model)) || ("SPH-P600".equalsIgnoreCase(model)))
localIntent1.setClass(paramContext, MSL_Checker.class).putExtra("keyString", "PhoneUtil_Prevail2SPR");
else if ("SPH-L300".equalsIgnoreCase(model))
localIntent1.setClass(paramContext, MSL_Checker.class).putExtra("keyString", "PhoneUtil_VMU");
else if (("SPH-L500".equalsIgnoreCase(model)) || ("SPH-L720".equalsIgnoreCase(model)))
localIntent1.setClass(paramContext, MSL_Checker.class).putExtra("keyString", "PhoneUtil_VMU");
else if ((str3.equals("0")) || (str3.equals("none")))
localIntent1.setClass(paramContext, PhoneUtil_Prevail2SPR.class);
else
localIntent1.setClass(paramContext, MSL_Checker.class).putExtra("keyString", "PhoneUtil_Prevail2SPR");
}
else if ("mdm".equalsIgnoreCase(cpuCode))
{
if ((str3.equals("0")) || (str3.equals("none")))
localIntent1.setClass(paramContext, PhoneUtil.class);
else
localIntent1.setClass(paramContext, MSL_Checker.class).putExtra("keyString", "PhoneUtil");
}
else
localIntent1.setClass(paramContext, MSL_Checker.class).putExtra("keyString", "PhoneUtil_Prevail2SPR");
}
else if ("SCH-S960L".equalsIgnoreCase(model))
{
localIntent1.setClass(paramContext, MSL_Checker.class).putExtra("keyString", str2);
}
else if (("SPH-D710".equalsIgnoreCase(model)) || ("SPH-D710VMUB".equalsIgnoreCase(model)) || ("SPH-D710BST".equalsIgnoreCase(model)) || ("SCH-R760U".equalsIgnoreCase(model)))
{
if (("SPH-D710BST".equalsIgnoreCase(model)) || ("SPH-D710VMUB".equalsIgnoreCase(model)))
localIntent1.setClass(paramContext, MSL_Checker.class).putExtra("keyString", str2).putExtra("keyString", str2);
else
localIntent1.setClass(paramContext, PhoneUtil_Gaudi.class);
}
else if ("VMU".equalsIgnoreCase(mSalesCode))
{
localIntent1.setClass(paramContext, MSL_Checker.class).putExtra("keyString", str2).putExtra("keyString", "PhoneUtil_VMU");
}
else if ((cpuCode.equalsIgnoreCase("MSM")) || ("SPR".equalsIgnoreCase(mSalesCode)))
{
if ("SPH-L500".equalsIgnoreCase(model))
localIntent1.setClass(paramContext, MSL_Checker.class).putExtra("keyString", str2).putExtra("keyString", "PhoneUtil_VMU");
else
localIntent1.setClass(paramContext, PhoneUtil.class);
}
else
{
localIntent1.setClass(paramContext, PhoneUtil_C1vzw.class);
}
}
label2374: if (str2.equals("AKEY"))
{
if ((cpuCode.equals("MSM")) || (cpuCode.equalsIgnoreCase("mdm")))
{
localIntent1.setClass(paramContext, AKEY2.class);
i = 1;
break label474;
}
localIntent1.setClass(paramContext, AKEY2_via.class);
i = 1;
break label474;
}
if (str2.equals("DNSSET"))
{
localIntent1.setClass(paramContext, DNS_Set.class);
i = 1;
break label474;
}
if (str2.equals("DSA"))
{
localIntent1.setClass(paramContext, DSA_Edit.class);
i = 1;
break label474;
}
if (str2.equals("OTATEST"))
{
localIntent1.setClass(paramContext, OTATest.class);
i = 1;
break label474;
}
if (str2.equals("LTEMODE"))
{
localIntent1.setClass(paramContext, LTEMode.class);
i = 1;
break label474;
}
if (str2.equals("CLEAR"))
{
if (("SPR".equalsIgnoreCase(mSalesCode)) || ("SPH-L300".equalsIgnoreCase(model)))
break;
if (!mSalesCode.equalsIgnoreCase("VZW"))
{
localIntent1.setClass(paramContext, DebugMenu_Check.class).putExtra("keyString", str2);
i = 1;
break label474;
}
localIntent1.setClass(paramContext, CLEAR_Reset.class);
i = 1;
break label474;
}
if (str2.equals("setMTP"))
{
Log.i("HiddenMenu", "Change USB Setting to MTP");
localUsbManager.setCurrentFunction("mtp", true);
return;
}
if (str2.equals("setMTPADB"))
{
Log.i("HiddenMenu", "Change USB Setting to MTP + ADB");
localUsbManager.setCurrentFunction("mtp,adb", true);
return;
}
if (str2.equals("setPTP"))
{
Log.i("HiddenMenu", "Change USB Setting to PTP");
localUsbManager.setCurrentFunction("ptp", false);
return;
}
if (str2.equals("setPTPADB"))
{
Log.i("HiddenMenu", "Change USB Setting to RNDIS + ADB");
localUsbManager.setCurrentFunction("ptp,adb", false);
return;
}
if (str2.equals("setRNDISDMMODEM"))
{
Log.i("HiddenMenu", "Change USB Setting to RNDIS + DM + MODEM");
localUsbManager.setCurrentFunction("rndis,acm,diag", true);
return;
}
if (str2.equals("setMASSSTORAGEADB"))
{
Log.i("HiddenMenu", "Change USB Setting to setMASSSTORAGEADB");
localUsbManager.setCurrentFunction("mass_storage,adb", true);
return;
}
if (str2.equals("setMASSSTORAGE"))
{
Log.i("HiddenMenu", "Change USB Setting to setMASSSTORAGE");
localUsbManager.setCurrentFunction("mass_storage", true);
return;
}
if (str2.equals("setRMNETDMMODEM"))
{
Log.i("HiddenMenu", "Change USB Setting to RMNET + DM + MODEM");
localUsbManager.setCurrentFunction("rmnet,acm,diag", true);
return;
}
if (str2.equals("setDMMODEMADB"))
{
Log.i("HiddenMenu", "Change USB Setting to DM + MODEM + ADB");
localUsbManager.setCurrentFunction("diag,acm,adb", true);
return;
}
if ((str2.equals("HIDDENMENUENABLE")) && (SystemProperties.get("ro.build.type", "user").trim().equals("user")))
{
if ("SCH-S960L".equalsIgnoreCase(model))
{
localIntent1.setClass(paramContext, MSL_Checker.class).putExtra("keyString", str2);
i = 1;
break label474;
}
localIntent1.setClass(paramContext, HiddenMenuEnable.class);
i = 1;
break label474;
}
boolean bool1 = str2.equals("DMMODE");
i = 0;
if (!bool1)
break label474;
boolean bool2 = mSalesCode.equals("VZW");
i = 0;
if (!bool2)
break label474;
localIntent1.setClass(paramContext, DmMode.class);
i = 1;
break label474;
label3043: Log.i("HiddenMenu", "enter MSK_OTKSL " + str1);
localIntent1.setClass(paramContext, MSL_Service.class).putExtra("String", str1);
Log.i("HiddenMenu", "set intent : " + localIntent1);
paramContext.startService(localIntent1);
return;
}
}
}
Unfortunately there doesn't seem to be an entry for adjusting the sound. The 9505 still misses the function
Sent from my GT-I9505
Is there anyway of checking if your phone is simlocked? On the gs2 you could dial *#SIMLOCK# and if would display [Off] beside a list of text.
Sent from my GT-I9505 using xda app-developers app
@nanoy009 I had this problem too. The easiest you can make (and what I have also done) is pull the battery out and wait a few seconds. And then turn your device on and your battery is okay and shows you the current status.
Sent from my SGH-M919 (in reality an I9505 ) using xda app-developers app
any code to update camera firmware:thumbup:
Sent from my GT-I9505 using xda premium
Here's a list that I've compiled so far, I don't test ones that say clear on them though so I could of missed a few.
*#06# IMEI
*#0*# LCD Test?
*#1234# Version
*#12580*369# Main Version
*#0228# BatteryStatus
*#0011# ServiceMode
*#0283# Loobback Test
*#03# NandFlashHeaderRead
*#0808# USBSettings
*#9090# ServiceMode
*#7284# FactoryKeystring
*#34971539# CameraFirmware Standard
*#1111# ServiceMode
*#9900# SysDump
*#7353# Quick Test Menu?
I'm looking for Engineering Mode...
That's the one I want, it doesn't matter to me if there is no code for it or not, I'm rooted and have a terminal installed, whatever needs to be done...
NEOAethyr said:
Here's a list that I've compiled so far, I don't test ones that say clear on them though so I could of missed a few.
*#06# IMEI
*#0*# LCD Test?
*#1234# Version
*#12580*369# Main Version
*#0228# BatteryStatus
*#0011# ServiceMode
*#0283# Loobback Test
*#03# NandFlashHeaderRead
*#0808# USBSettings
*#9090# ServiceMode
*#7284# FactoryKeystring
*#34971539# CameraFirmware Standard
*#1111# ServiceMode
*#9900# SysDump
*#7353# Quick Test Menu?
I'm looking for Engineering Mode...
That's the one I want, it doesn't matter to me if there is no code for it or not, I'm rooted and have a terminal installed, whatever needs to be done...
Click to expand...
Click to collapse
:good:
Thanks guys
Sent from my GT-I9505 using xda premium
is there any secret code that I can enter to choose what LTE band I wanted to connect only? e.h 1800 or 2600

[Completed] Android Studio Listview Needs To Be Visible

Hi guys I am new to developing i need help with some codes. Hope you guys can help.
I am using Sqlite database i need to create a list view that display the word from database so hope you guys can help me. here is my code above. ty
//Code
public class Ortho extends ActionBarActivity {
private final String TAG = "Ortho";
DatabaseHelper dbhelper;
TextView word;
TextView mean;
AutoCompleteTextView actv;
Cursor cursor;
Button search;
int flag = 0;
ListView ls;
ArrayList<String> dataword;
@override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.ortho);
ls = (ListView) findViewById(R.id.mainlist);
ls.setVisibility(View.VISIBLE);
//need code here
dbhelper = new DatabaseHelper(this);
try {
dbhelper.createDataBase();
} catch (IOException e) {
Log.e(TAG, "can't read/write file ");
Toast.makeText(this, "error loading data", Toast.LENGTH_SHORT).show();
}
dbhelper.openDataBase();
word = (TextView) findViewById(R.id.word);
mean = (TextView) findViewById(R.id.meaning);
String[] from = {"english_word"};
int[] to = {R.id.text};
actv = (AutoCompleteTextView) findViewById(R.id.autoCompleteTextView);
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, R.layout.singalline, null, from, to);
// This will provide the labels for the choices to be displayed in the AutoCompleteTextView
adapter.setCursorToStringConverter(new SimpleCursorAdapter.CursorToStringConverter() {
@override
public CharSequence convertToString(Cursor cursor) {
return cursor.getString(1);
}
});
adapter.setFilterQueryProvider(new FilterQueryProvider() {
@override
public Cursor runQuery(CharSequence constraint) {
cursor = null;
int count = constraint.length();
if (count >= 1) {
String constrains = constraint.toString();
cursor = dbhelper.queryr(constrains);
}
return cursor;
}
});
briza-jann23 said:
Hi guys I am new to developing i need help with some codes. Hope you guys can help.
I am using Sqlite database i need to create a list view that display the word from database so hope you guys can help me. here is my code above. ty
//Code
public class Ortho extends ActionBarActivity {
private final String TAG = "Ortho";
DatabaseHelper dbhelper;
TextView word;
TextView mean;
AutoCompleteTextView actv;
Cursor cursor;
Button search;
int flag = 0;
ListView ls;
ArrayList<String> dataword;
@override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.ortho);
ls = (ListView) findViewById(R.id.mainlist);
ls.setVisibility(View.VISIBLE);
//need code here
dbhelper = new DatabaseHelper(this);
try {
dbhelper.createDataBase();
} catch (IOException e) {
Log.e(TAG, "can't read/write file ");
Toast.makeText(this, "error loading data", Toast.LENGTH_SHORT).show();
}
dbhelper.openDataBase();
word = (TextView) findViewById(R.id.word);
mean = (TextView) findViewById(R.id.meaning);
String[] from = {"english_word"};
int[] to = {R.id.text};
actv = (AutoCompleteTextView) findViewById(R.id.autoCompleteTextView);
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, R.layout.singalline, null, from, to);
// This will provide the labels for the choices to be displayed in the AutoCompleteTextView
adapter.setCursorToStringConverter(new SimpleCursorAdapter.CursorToStringConverter() {
@override
public CharSequence convertToString(Cursor cursor) {
return cursor.getString(1);
}
});
adapter.setFilterQueryProvider(new FilterQueryProvider() {
@override
public Cursor runQuery(CharSequence constraint) {
cursor = null;
int count = constraint.length();
if (count >= 1) {
String constrains = constraint.toString();
cursor = dbhelper.queryr(constrains);
}
return cursor;
}
});
Click to expand...
Click to collapse
Hi, thank you for using XDA assist.
There is a general forum for android here http://forum.xda-developers.com/android/help where you can get better help and support if you try to ask over there.
Good luck.
You can also ask here http://forum.xda-developers.com/coding/java-android

How to prevent opening status bar menu in android on Api 31

I could prevent opening the status bar in < API 31 , but in API 31 doesn't work
some codes are deprecated in this version like :
Code:
val closeIntent = Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)
I used this code to prevent opening the status bar drawer :
JavaScript:
// To keep track of activity's window focus
var currentFocus = false
// To keep track of activity's foreground/background status
var isPaused = false
lateinit var collapseNotificationHandler: Handler
fun collapseNow() {
collapseNotificationHandler = Handler()
if (!currentFocus && !isPaused) {
collapseNotificationHandler.postDelayed(object : Runnable {
override fun run() {
// Use reflection to trigger a method from 'StatusBarManager'
val statusBarService = getSystemService("statusbar")
var statusBarManager: Class<*>? = null
try {
statusBarManager = Class.forName("android.app.StatusBarManager")
} catch (e: ClassNotFoundException) {
e.printStackTrace()
}
var collapseStatusBar: Method? = null
try {
// Prior to API 17, the method to call is 'collapse()'
// API 17 onwards, the method to call is `collapsePanels()`
collapseStatusBar = if (Build.VERSION.SDK_INT > 16) {
statusBarManager!!.getMethod("collapsePanels")
} else {
statusBarManager!!.getMethod("collapse")
}
} catch (e: NoSuchMethodException) {
e.printStackTrace()
}
if (collapseStatusBar != null) {
collapseStatusBar.setAccessible(true)
}
try {
if (collapseStatusBar != null) {
collapseStatusBar.invoke(statusBarService)
}
} catch (e: IllegalArgumentException) {
e.printStackTrace()
} catch (e: IllegalAccessException) {
e.printStackTrace()
} catch (e: InvocationTargetException) {
e.printStackTrace()
}
// Check if the window focus has been returned
// If it hasn't been returned, post this Runnable again
// Currently, the delay is 100 ms. You can change this
// value to suit your needs.
if (!currentFocus && !isPaused) {
collapseNotificationHandler.postDelayed(this, 100L)
}
}
}, 300L)
}
}
override fun onWindowFocusChanged(hasFocus: Boolean) {
super.onWindowFocusChanged(hasFocus)
currentFocus = hasFocus;
if (!hasFocus) {
collapseNow()
}
}
I review all of google developers docs for this problem but unfortunately google codes are deprecated and don't have a clear document for that
HI, i have the same issue, you found anything to solve this problem?
danielsantb said:
HI, i have the same issue, you found anything to solve this problem?
Click to expand...
Click to collapse
I used Device Manager for controlling status Bar but it's not true way, but I solved my problem with this method

Categories

Resources