मैं कोई Android एप्लिकेशन बना रहा हूँ और यह GoogleMaps उपयोग करता है। तो जब मैं बटन पर क्लिक करता हूं, तो मैं एक रजिस्ट्रोसिज़िओनएक्टिविटी लोड करता हूं जो Google मानचित्र दिखाता है। तो मैंने ध्यान दिया है कि इस गतिविधि की लोडिंग गति धीमी है। क्या इस गतिविधि को लोड करने की गति बढ़ाने के लिए कोई तरीका है?गतिविधि को लोड करने के लिए गति को कैसे बढ़ाया जाए?
protected void onCreate(Bundle savedInstanceState) {
try{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_recordposition);
locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_FINE);
provider = locationManager.getBestProvider(criteria, false);
locationManager.requestLocationUpdates(provider, 1000, 0, this);
settaMappa();
if(myPosition==null){
pDialog = ProgressDialog.show(this, "Attendere ...", "Localizzazione in corso ...", true);
pDialog.setCancelable(false);
}
}catch(Exception e){
Log.e("Errore onCreate:",e.getMessage());
Utility.generateNoteOnSD(fileName,e.getMessage());
}
}
public void settaMappa(){
mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map2)).getMap();
mMap.setMapType(GoogleMap.MAP_TYPE_TERRAIN);
mMap.setMyLocationEnabled(true);
}
यह activity_recordposition.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
android:orientation="vertical"
tools:context=".registraPosizioneActivity"
android:gravity="center">
<fragment
android:name="com.google.android.gms.maps.SupportMapFragment"
android:id="@+id/map2"
android:layout_height="0dp"
android:layout_weight="10"
android:layout_width="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"
/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal" >
<Button
android:id="@+id/buttonR"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="0.20"
android:layout_margin="20dp"
android:background="#0080c2"
android:textColor="#FFF"
android:textSize="20sp"
android:onClick="registraPunto"
android:text="@string/registraPunto" />
<Button
android:id="@+id/buttonSava"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="0.20"
android:layout_margin="20dp"
android:background="#0080c2"
android:textColor="#FFF"
android:textSize="20sp"
android:onClick="savaAreaTracciata"
android:text="@string/terminaRegistrazione" />
</LinearLayout>
शुरू आप वास्तव में जांच की है मुख्य जीवन चक्र विधियों के लिए गतिविधि कितनी देर तक लेती है? –
मैं onCreate विधि पर सभी कोड टिप्पणी है, लेकिन गति मेरी गतिविधि लोड करने के लिए कम है। – bircastri