Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to call a Method of a class kept under other package
    primarykey
    data
    text
    <p>I am a beginner in Android Developing. Can any1 please guide me how to call a Method of a class kept under other package.</p> <p>Like class A in Package 1 calls a method in Class B of Package 2 which returns An array or object.</p> <p>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.</p> <p>Thanks in advance.</p> <pre><code>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; } } </code></pre> <p>I want to call above methods from other class and get these arrays. How to do that, is there any error in above code??</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload