Hitendra
Hitendra

Reputation: 3226

how can i call activity class from other java class?

I have just started android.

I just want to know that how can i call activity class from other java class.

i just want to pass class object to activity class.

anyhelp please.

public class GsonParser extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    MagazineThread thread=new MagazineThread();
    thread.start();
}
public GsonParser(JsonMagazineParser Obj)
{

}

}

and i am just doing like from other class. GsonParser obj=new GsonParser(this);passing obj to activity class.how can i achieve that.

can u please tell me.

Upvotes: 0

Views: 3273

Answers (2)

user7641341
user7641341

Reputation: 209

import android.content.Context;
import android.content.Intent;

public class Genfunctions {
    public void menuActions(String title,Context ct){

        //this.context=context;
        switch (title){
            case "ENTRIES":

                Intent intent = new Intent(ct, RptentrylistActivity.class);
                ct.startActivity(intent);
                break;
        }
    }//end of functions
}

Upvotes: 1

Fredrik Leijon
Fredrik Leijon

Reputation: 2802

Have a look at the documentation: http://developer.android.com/reference/android/app/Activity.html

specifically startActivity and startActivityForResult

Upvotes: 0

Related Questions