Hi all, I am a beginner in Android Developing. Can any1 please guide me how to call a Method of a class kept under other package.
Like class A in Package 1 calls a method in Class B of Package 2 which returns An array or object.
Do i have to create an Intent for that?? actually i have to gather all information in 1 class from different classes kept under different packages.
Thanks in advance. package com.xyz.Master;
import android.app.Activity; import android.content.Context; import android.os.Build; import android.telephony.CellLocation; import android.telephony.TelephonyManager; import android.telephony.gsm.GsmCellLocation;
public class PhoneInfo extends Activity {
TelephonyManager tm = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
GsmCellLocation location = (GsmCellLocation) tm.getCellLocation();
public int cellID, lac,mcc,mnc;
public String imei,manufacturer,model,product;
String[] phoneInfo;
int[] phoneLocationInfo;
public String[] getHandsetInfo()
{
manufacturer = Build.MANUFACTURER;
model = Build.MODEL;
product = Build.PRODUCT;
imei=tm.getDeviceId();
String softwareVersion = tm.getDeviceSoftwareVersion();
phoneInfo = new String[5];
phoneInfo[0]=imei;
phoneInfo[1]=product;
phoneInfo[2]=model;
phoneInfo[3]=manufacturer;
phoneInfo[4]=softwareVersion;
return phoneInfo;
}
public int[] getHandsetLocationInfo()
{
phoneLocationInfo= new int[4];
String networkOperator = tm.getNetworkOperator();
if (networkOperator != null) {
mcc = Integer.parseInt(networkOperator.substring(0, 3));
mnc = Integer.parseInt(networkOperator.substring(3));
}
CellLocation.requestLocationUpdate();
cellID = location.getCid();
lac = location.getLac();
phoneLocationInfo[0]=cellID;
phoneLocationInfo[1]=lac;
phoneLocationInfo[2]=mcc;
phoneLocationInfo[3]=mnc;
return phoneLocationInfo;
}
}
I want to call above methods from other class and get these arrays. How to do that, is there any error in above code??