android - using of intent for linking activities -


i want link 2 activites clicking on button have written following code

public class ihbcaptureactivity extends activity implements onclicklistener {     /** called when activity first created. */     imageview iv;     textview tx;     button b1;      @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.main);         iv=(imageview)findviewbyid(r.id.imageview1);         tx=(textview)findviewbyid(r.id.textview1);        b1 = (button) findviewbyid(r.id.button1);        b1.setonclicklistener(this);     }      @override     public void onclick(view v) {          intent calintent;         **calintent = new intent(ihbcaptureactivity.this, loginactivity.class);**         startactivity(calintent);                } } 

error cumes in line

calintent = new intent(ihbcaptureactivity.this, loginactivity.class); 

for loginactivity.class that

loginactivity cannot resolved type . how solve it?

here simple code how can load 1 activity another,

i have created 2 activities this

firstactivity.java

package com.rdc;  import android.app.activity; import android.content.intent; import android.os.bundle; import android.view.view; import android.view.view.onclicklistener; import android.widget.button;  public class firstactivity extends activity implements onclicklistener {     /** called when activity first created. */     @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.first);          button btnload = (button) findviewbyid(r.id.btn);         btnload.setonclicklistener(this);     }      @override     public void onclick(view v) {         // todo auto-generated method stub         intent = new intent(this, secondactivity.class);         startactivity(i);     } } 

secondactivity.java

package com.rdc;  import android.app.activity; import android.os.bundle;  public class secondactivity extends activity {     @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.second);       } } 

and manifest file is

androidmanifest.xml

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"       package="com.rdc"       android:versioncode="1"       android:versionname="1.0">     <uses-sdk android:minsdkversion="8" />      <application android:icon="@drawable/icon" android:label="@string/app_name">         <activity android:name=".firstactivity"                   android:label="@string/app_name">             <intent-filter>                 <action android:name="android.intent.action.main" />                 <category android:name="android.intent.category.launcher" />             </intent-filter>         </activity>          <activity android:name=".secondactivity"                   android:label="@string/app_name">             <intent-filter>                                 <category android:name="android.intent.category.launcher" />             </intent-filter>         </activity>      </application> </manifest> 

try implement in app , let me know if still doubt there.


Comments

Popular posts from this blog

How do you change vbulletin's home page to the forums instead of the default (CMS or Activity Stream)? -

c++ - Troubles when compiling phash program -